For those of you frustrated with lack of progress on RTC support, here's a blog post detailing how you can add a DS3231 (used by RPI) to the NEO (or QUAD). It requires some knowledge on compiling a kernel/dtb but nothing too complicated if you put your mind to it.
Actually I'm using a DS3231 in my arduino script without kernel recompiling. SDA/SCL are connected to SDA/SCL Cortex M4 pins I'm using this library: https://github.com/JChristensen/DS3232RTC I edited it in order to make it works with Udoo.
Yes, sure! I adjusted Wire/Wire1 in setup and I added alarms. I use it in my sketch in order to do: Code: rtc.now().unixtime(); ... rtc.adjust(DateTime(y, m, d, hh, mm, ss)); ... rtc.setAlarm(ALM1_MATCH_MINUTES, newAlarm, 0, 0); rtc.alarmInterrupt(ALARM_1, true); ...
SORRY Guys. I realized I linked a wrong library. The working one is this one: https://drive.google.com/open?id=0B7ojBWcMT6tTZEZLb21wNzBzbzQ
Did you mean the url or the files? I edited the url. The file is similar but with some changes respect to the previous one.
I'm trying your tutorial. I set my clock on I2C4 on J5, but "i2cdetect 3" returns: Code: root@udooneo:~# i2cdetect 3 WARNING! This program can confuse your I2C bus, cause data loss and worse! I will probe file /dev/i2c-3. I will probe address range 0x03-0x77. Continue? [Y/n] 0 1 2 3 4 5 6 7 8 9 a b c d e f 00: -- -- -- -- -- -- -- -- -- -- -- -- -- 10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- UU -- 20: UU -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 50: -- -- -- -- -- -- -- 57 -- -- -- -- -- -- -- -- 60: -- -- -- -- -- -- -- -- 68 -- -- -- -- -- -- -- 70: -- 71 -- -- -- -- -- 77 (The 56/71/77 is another sensor, but I tried even without it and I have UU twice and a 68, that is our DS3231) I add DALLAS DS1307 on the make menuconfig and in imx6sx-udoo-neo.dtsi ARCH=arm make udoo_neo_defconfig ARCH=arm make menuconfig ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- make zImage -j5 ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- make dtbs -j5 ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- make modules -j5 and I copied everything on the SD. On reboot dmesg doesn't contain ds1307 and hwclock doesn't work Code: udooer@udooneo:~$ sudo hwclock -r hwclock: Cannot access the Hardware Clock via any known method. hwclock: Use the --debug option to see the details of our search for an access method. How to fix it?
The kernel driver should have opened the device, when you run i2cdetect it should return the device as reserved with 'UU': Code: root@udooneo:~# i2cdetect 3 WARNING! This program can confuse your I2C bus, cause data loss and worse! I will probe file /dev/i2c-3. I will probe address range 0x03-0x77. Continue? [Y/n] Y 0 1 2 3 4 5 6 7 8 9 a b c d e f 00: -- -- -- -- -- -- -- -- -- -- -- -- -- 10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 60: -- -- -- -- -- -- -- -- UU -- -- -- -- -- -- -- 70: -- -- -- -- -- -- -- -- You can check if the kernel driver is loaded: Code: dmesg | grep ds1307 rtc-ds1307 3-0068: rtc core: registered ds1307 as rtc0 rtc-ds1307 3-0068: 56 bytes nvram So a number possibilities: 1. The dsti isn't correct. 2. The correct dtb isn't copied or to the right location. 3. The kernel module isn't copied or loaded :
I retry with a clean image without success. My configuration: - Udoo Neo FULL - RTC DS3231 https://www.dropbox.com/sc/3mlpq7jbj3cx0ka/AAAq6tz_258FHvBiT930PKo8a These are the steps: - dd the Udoobuntu 2.1.2 img on the sd card - First boot - From the beginning I don't have UU like in your tutorial but 68 instead Code: root@udooneo:/home/udooer# i2c i2cdetect i2cdump i2cget i2cset root@udooneo:/home/udooer# i2cdetect 3 WARNING! This program can confuse your I2C bus, cause data loss and worse! I will probe file /dev/i2c-3. I will probe address range 0x03-0x77. Continue? [Y/n] 0 1 2 3 4 5 6 7 8 9 a b c d e f 00: -- -- -- -- -- -- -- -- -- -- -- -- -- 10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- UU -- 20: UU -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 50: -- -- -- -- -- -- -- 57 -- -- -- -- -- -- -- -- 60: -- -- -- -- -- -- -- -- 68 -- -- -- -- -- -- -- 70: -- -- -- -- -- -- -- -- - Following this page, I downloaded the kernel. ARCH=arm make udoo_neo_defconfig ARCH=arm make menuconfig ( I add the RTC like in your picture, and save) ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- make zImage -j5 (Image) ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- make modules -j5 (Modules) - Edit imx6sx-udoo-neo.dtsi Now is: Code: &i2c4 { clock-frequency = <100000>; pinctrl-names = "default"; pinctrl-0 = <&pinctrl_i2c4_1>; accelerometer: fxos8700@1e { compatible = "fsl,fxos8700"; reg = <0x1e>; }; gyroscope: fxas2100x@20 { compatible = "fsl,fxas2100x"; reg = <0x20>; }; rtc@68 { compatible = "dallas,ds1307"; reg = <0x68>; }; }; - ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- make dtbs -j5 - cp arch/arm/boot/zImage /media/gorgo/boot/ - cp arch/arm/boot/dts/*.dtb /media/gorgo/boot/dts - ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- make firmware_install modules_install INSTALL_MOD_PATH=/media/gorgo/udoobuntu/ - dmesg | grep ds1307 returns null
I suspect the module is not loaded, so you need to: 1. Check the module is correctly copied to the /lib/modules folders for the correct kernel version compiled. 2. You can try loading the module after the kernel has booted by using the 'insmod' command.
Code: udooer@udooneo:~$ ls /lib/modules/3.14.56-gacf7670-dirty/kernel/drivers/rtc/rtc-ds1307.ko /lib/modules/3.14.56-gacf7670-dirty/kernel/drivers/rtc/rtc-ds1307.ko udooer@udooneo:~$ sudo modinfo rtc-ds1307 filename: /lib/modules/3.14.56-gacf7670-dirty/kernel/drivers/rtc/rtc-ds1307.ko license: GPL description: RTC driver for DS1307 and similar chips alias: i2c:rx8025 alias: i2c:pt7c4338 alias: i2c:mcp7941x alias: i2c:m41t00 alias: i2c:ds3231 alias: i2c:ds1340 alias: i2c:ds1388 alias: i2c:ds1339 alias: i2c:ds1338 alias: i2c:ds1337 alias: i2c:ds1307 depends: intree: Y vermagic: 3.14.56-gacf7670-dirty SMP preempt mod_unload modversions ARMv7 p2v8 udooer@udooneo:~$ sudo insmod /lib/modules/3.14.56-gacf7670-dirty/kernel/drivers/rtc/rtc-ds1307.ko insmod: ERROR: could not insert module /lib/modules/3.14.56-gacf7670-dirty/kernel/drivers/rtc/rtc-ds1307.ko: File exists I tried to rmmod it and insmod it without success. It doesn't return error but i2cdetect shows 68 instead of UU and Code: udooer@udooneo:~$ sudo hwclock -r hwclock: Cannot access the Hardware Clock via any known method. hwclock: Use the --debug option to see the details of our search for an access method.
Then check the compiled dtb file that you copied has the i2c setting included in it. You can de-compile the dtb to verify it has the setting by: Code: ./scripts/dtc/dtc -I dtb -O dts -o test.dts <name of dtb file>.dtb dtc utility should be in the kernel source path Also check the dtb file that uboot loaded is the correct one. I'm surprised this is turning in to something so tedious, finding the cause is just a process of elimination.
Code: udooer@udooneo:/opt/dtweb/dtbkernel$ sudo ./scripts/dtc/dtc -I dtb -O dts -o test.dts /boot/dts/imx6sx-udoo-neo-full.dtb udooer@udooneo:/opt/dtweb/dtbkernel$ cat test.dts Complete file: http://pastebin.com/M1Xx5psP In i2c@021f8000{} there's rtc@68. Where Can I check it? Note that, according to your tutorial, I edited imx6sx-udoo-neo.dtsi but in /boot/dts/ I don't have any imx6sx-udoo-neo.dtb but I think It has become imx6sx-udoo-neo-full.dtb Thank you again
On serial console when uboot boots (when neo is powered up). If you can pastebin the whole output from the serial console from power on to login prompt then that may be useful.
http://pastebin.com/tphhc2kT Device Tree: dts-overlay/imx6sx-udoo-neo-full-hdmi-m4.dtb reading dts-overlay/imx6sx-udoo-neo-full-hdmi-m4.dtb
Then you need to copy your dtb files to 'dts-overlay' not 'dts' directory Code: cp arch/arm/boot/dts/*.dtb /media/gorgo/boot/dts-overlay
[ 7.082302] rtc-ds1307 3-0068: rtc core: registered ds1307 as rtc0 [ 7.082330] rtc-ds1307 3-0068: 56 bytes nvram Now it's working! Thank you! So is this procedure wrong? @Andrea Rovai
It is correct. It works only for fresh installs. However, @ektor5 is editing the docs to make it clearer and avoid misunderstandings. EDIT: The docs have been edited.