Bananian
Bananian RTC DS3231 BananaPro
1
2868
View: 2868|Reply: 1
|
[Bananian]
Bananian RTC DS3231 BananaPro
[Copy link]
|
|
Edited by zaqwsx at Apr 13, 2016 11:57
Hi everyone!
Sorry for my English, and I hope you will forgive me 
I'm new here and I want to say: "I am a n00b," but I have a problem with DS3231 RTC and I want to ask you all for help!
Shame on me but it's my I first time using Linux 
I can't force DS3231 to work with my BananaPro.
I have 2 pieces DS3231:
2x DS3231
I tried all what I found on the internet, but it doesn't work. 'OK..'- I thought 'I'm n00b so I probably screwed up something in the system'.
I decided on a new system (Bananian version: 15.04 (released 2015-04-08)). The system is on SDcard (SSD is turned off).
Before i installed the new system i tried this ( https://n101n.xyz/n/apps.blog?id=32372 ) but no result.
What I did:
- new system
- bananian-config --> I chose "Board BananaPro OTG"
- apt-get update
- apt-get upgrade
- apt-get install i2c-tools
- shutdown -r now
Banana has internet connection via UTP, and when I write 'date' I have current time and date (OS bananian have default NTP?).
When banana is off (no power) and when I turn it on and I write 'hwclock', the following problem occurs:
- 74 root@BnananaPro ~ # hwclock -r :(
- hwclock: select() to /dev/rtc0 to wait for clock tick timed out: No such file or directory.
Copy the Code So one more 'shutdown -r now', and then one more time 'hwclock -r':
- root@BnananaPro ~ # hwclock -r
- Mon 11 Apr 2016 05:14:17 PM CEST -1.871221 seconds
Copy the Code Good, but this is 'fake-hwclock' or 'NTP time' (?)
So I found:
- pin definition ( http://forum.lemaker.org/forum.php?mod=viewthread&tid=10852&fromuid=1602 )
- tutorial how to use DS3231 and banana m3 ( http://forum.banana-pi.org/t/bpi-m3-bpi-rtc-ds3231-module-and-how-to-use/1092 )
1) I conneted RTC, read bpi-m3 tutorial and tried it on my banana:
- root@BnananaPro ~ # i2cdetect -y 2
- 0 1 2 3 4 5 6 7 8 9 a b c d e f
- 00: -- -- -- -- -- -- -- -- -- -- -- -- --
- 10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
- 20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
- 30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
- 40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
- 50: -- -- -- -- -- -- -- 57 -- -- -- -- -- -- -- --
- 60: -- -- -- -- -- -- -- -- 68 -- -- -- -- -- -- --
- 70: -- -- -- -- -- -- -- --
Copy the Code and it's OK.
2.
- root@BnananaPro ~ # echo ds3231 0x68 > /sys/class/i2c-adapter/i2c-2/new_device
Copy the Code Was no probelm.. I thought 'yyeeeaaa I'm hacker' 
3.
- root@BnananaPro ~ # hwclock -r -f /dev/rtc1
- 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.
- root@BnananaPro ~ # hwclock -r
- Mon 11 Apr 2016 01:38:42 PM CEST -1.353113 seconds
Copy the Code But this is not time from DS3231, because I plugged a total new chip in and I did't write time to RTC.. and that was the current date/time.
4.
- root@BnananaPro ~ # /usr/bin/watch -n 0.4 "i2cget -y 2 0x68 0; i2cget -y 2 0x68 1; i2cget -y 2 0x68 2"
Copy the Code- Every 0.4s: i2cget -y 2 0x68 0; i2cget -y 2 0x68 1; i2cget -y 2 ... Mon Apr 11 13:40:42 2016
- 0x49
- 0x53
- 0x01
Copy the Code
When i disconnect DS3231:
- root@BnananaPro ~ # /usr/bin/watch -n 0.4 "i2cget -y 2 0x68 0; i2cget -y 2 0x68 1; i2cget -y 2 0x68 2"
Copy the Code- Every 0.4s: i2cget -y 2 0x68 0; i2cget -y 2 0x68 1; i2cget -y 2 ... Mon Apr 11 13:41:55 2016
- Error: Read failed
- Error: Read failed
- Error: Read failed
Copy the Code Hmmm... So I know now: RTC is not damage..
Than lsmod...- root@BnananaPro ~ # lsmod
- Module Size Used by
- cpufreq_conservative 5966 0
- cpufreq_powersave 1197 0
- cpufreq_userspace 3294 0
- cpufreq_stats 5901 0
- 8021q 18594 0
- garp 6114 1 8021q
- stp 1993 1 garp
- llc 5491 2 stp,garp
Copy the Code
..modprobe..
- root@BnananaPro ~ # modprobe rtc-ds1307
- FATAL: Module rtc-ds1307 not found.
- root@BnananaPro ~ # modprobe rtc-ds3231
- FATAL: Module rtc-ds3231 not found.
Copy the Code ..etc..
- root@BnananaPro ~ # cat /proc/devices | grep rtc
- 254 rtc
Copy the Code- root@BnananaPro ~ # dmesg | grep ds3231
- [ 133.512498] i2c i2c-2: new_device: Instantiated device ds3231 at 0x68
Copy the Code- root@BnananaPro ~ # ls /dev/rtc*
- /dev/rtc0
Copy the Code- root@BnananaPro ~ # zgrep CONFIG_RTC_DRV_DS13 /proc/config.gz
- # CONFIG_RTC_DRV_DS1307 is not set
- # CONFIG_RTC_DRV_DS1374 is not set
- # CONFIG_RTC_DRV_DS1305 is not set
- # CONFIG_RTC_DRV_DS1390 is not set
Copy the Code- root@BnananaPro ~ # zgrep CONFIG_RTC_DRV_DS32 /proc/config.gz
- # CONFIG_RTC_DRV_DS3232 is not set
- # CONFIG_RTC_DRV_DS3234 is not set
Copy the Code
There is no this RTC in the system and I don't know how read time from ds3231, how install driver...
Is this tutorial helpful? ( http://forum.lemaker.org/thread-4276-1-1.html ) But here is the black magic- (rebuild kernel and modules) 
I don't know what to do. I want RTC in my banana, because I want to disconnect banana from the internet.
Is it possible the GPIO are blocked or something? Do I need an additional driver or is it implied within the system? Has someone a working DS3231 or DS1307 in BananaPro?
Can someone tell me step by step what to do, to make this RTC functional? Or maybe, if it is not possible at all, to connect this chip and banana together from technical perspective?
Thank you for any advice.
|
|
|
|
|
|
|
|
Since there is no driver for DS1307,you'll have to configure it in the kernel and build the module as well as the kernel.
Use this as a reference...wouldn't be too difficult.
http://forum.lemaker.org/forum.p ... page%3D1&page=1
Select the appropriate module (CONFIG_RTC_DRV_DS1307=m) in the "make menuconfig" stage. |
|
|
|
|
|
|