Problem is solved.
1) I make Armbian5.20 image from source code ( https://github.com/igorpecovnik/lib/archive/v2016.09.tar.gz )
2) Write image to SD card 3) Boot from SD card 4) After initial initialization of system it is necessary to execute:
sudo apt-get update
sudo apt-get upgrade
sudo reboot
5) Boot orangepi and login
sudo modprobe gc2035
sudo modprobe vfe_v4l2
I have seen many tutorials about connecting real time clock hardware on Orange Pi and Raspberry Pi.
What i didn't like was removing of fake-hwclock service, because I want that RTC works when it is connected, and fake-hwclock when RTC is not connected.
Therefore, I changed /sbin/fake-hwclock script to work in this way.
So, here is how to do this, tested on OrangePi+2E, Armbian Ubuntu legacy kernel:
Purchase cheap DS3231 module on eBay (cca. $1) like this one:
http://www.ebay.com/itm/DS3231-AT24C32-IIC-Modul-High-Precision-Real-Time-Clock-Module-Arduino-New-/292041844936?hash=item43ff0ce8c8:g:d80AAOSwdGFYtsFP
Put battery in module.
Shutdown and powerof OPi and connect module:
Orange (i2c0 bus) RTC module (DS3231 RTC + 24C32 eeprom)
1 3.3V 2 VCC
3 PA12 (TWI0_SDA/DI_RX/PA_EINT12) 3 SDA
5 PA11 (TWI0_SCK/DI_TX/PA_EINT11) 4 SCL
9 GND 1 GND
Power up OPi
Install i2c-tools.
sudo apt install i2c-tools
Type command:
i2cdetect -y 0
You should see:
0 1 2 3 4 5 6 7 8 9 a b c d e f
00: -- -- -- -- -- -- -- -- -- -- -- -- --
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
40: -- -- -- -- -- -- -- -- UU -- -- -- -- -- -- --
50: -- -- -- -- -- -- -- 57 -- -- -- -- -- -- -- --
60: -- -- -- -- -- -- -- -- 68 -- -- -- -- -- -- --
70: -- -- -- -- -- -- -- --
This means that module is connected properly and that we have DS3231 on address 0x68 and eeprom 24C32 on address 0x57.
Type:
sudo echo ds1307 0x68 > /sys/class/i2c-adapter/i2c-0/new_device
i2cdetect -y 0
You should see:
0 1 2 3 4 5 6 7 8 9 a b c d e f
00: -- -- -- -- -- -- -- -- -- -- -- -- --
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
40: -- -- -- -- -- -- -- -- UU -- -- -- -- -- -- --
50: -- -- -- -- -- -- -- 57 -- -- -- -- -- -- -- --
60: -- -- -- -- -- -- -- -- UU -- -- -- -- -- -- --
70: -- -- -- -- -- -- -- --
This means that system is now using our RTC. Also, now should exist new device /dev/rtc1
Be sure that your system time is right, and type:
sudo hwclock -w -f /dev/rtc1
Now our RTC must have right time. Check with:
sudo hwclock -r -f /dev/rtc1
If everithing was ok, copy /sbin/fake-hwclock to bacup (just in case)
sudo cp ~/programming/sh/fake_hwclock/sbin/fake-hwclock /sbin/fake-hwclock
Edit /sbin/fake-hwclock and place this code in it:
Reboot.
Now you should have right system time backed up by RTC.
Yes, I tried a lot of different configuration of FEX file without success. The problem maybe is, that the platform data structure inside the driver contains pointer to the next structure, which is unable to initiate within startup process using BIN configuration and it remains null. Probing of driver is interrupted then. So I modified the driver itself a little and now is my mcp2515 working in loopback mode. I have to port my raspberry-based host board to the orangepi and test the real communication with car.
If you can, start from clean image within virtual machine. Get Ubuntu Xenial base image and our script makes the rest. This way it works 100% ... unless you got some network issues. In this case deboostrap process also fails ... but you won't get that far without a net anyway.