Bananian

Bananian RTC DS3231 BananaPro

1 2399
zaqwsx  
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

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:
  1. 74 root@BnananaPro ~ # hwclock -r                                            :(
  2. 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':
  1. root@BnananaPro ~ # hwclock -r
  2. 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:

S73R0282.JPG

  1. root@BnananaPro ~ # i2cdetect -y 2

  2.      0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f
  3. 00:          -- -- -- -- -- -- -- -- -- -- -- -- --
  4. 10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
  5. 20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
  6. 30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
  7. 40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
  8. 50: -- -- -- -- -- -- -- 57 -- -- -- -- -- -- -- --
  9. 60: -- -- -- -- -- -- -- -- 68 -- -- -- -- -- -- --
  10. 70: -- -- -- -- -- -- -- --
Copy the Code
and it's OK.

2.
  1. 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.
  1. root@BnananaPro ~ # hwclock -r -f /dev/rtc1
  2. hwclock: Cannot access the Hardware Clock via any known method.
  3. hwclock: Use the --debug option to see the details of our search for an access method.
  4. root@BnananaPro ~ # hwclock -r
  5. 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.
  1. 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
  1. Every 0.4s: i2cget -y 2 0x68 0; i2cget -y 2 0x68 1; i2cget -y 2 ...  Mon Apr 11 13:40:42 2016

  2. 0x49
  3. 0x53
  4. 0x01
Copy the Code

When i disconnect DS3231:
  1. 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
  1. Every 0.4s: i2cget -y 2 0x68 0; i2cget -y 2 0x68 1; i2cget -y 2 ...  Mon Apr 11 13:41:55 2016

  2. Error: Read failed
  3. Error: Read failed
  4. Error: Read failed
Copy the Code
Hmmm... So I know now: RTC is not damage..

Than lsmod...
  1. root@BnananaPro ~ # lsmod
  2. Module                  Size  Used by
  3. cpufreq_conservative     5966  0
  4. cpufreq_powersave       1197  0
  5. cpufreq_userspace       3294  0
  6. cpufreq_stats           5901  0
  7. 8021q                  18594  0
  8. garp                    6114  1 8021q
  9. stp                     1993  1 garp
  10. llc                     5491  2 stp,garp
Copy the Code


..modprobe..
  1. root@BnananaPro ~ # modprobe rtc-ds1307
  2. FATAL: Module rtc-ds1307 not found.

  3. root@BnananaPro ~ # modprobe rtc-ds3231
  4. FATAL: Module rtc-ds3231 not found.
Copy the Code
..etc..
  1. root@BnananaPro ~ # cat /proc/devices | grep rtc
  2. 254 rtc
Copy the Code
  1. root@BnananaPro ~ # dmesg | grep ds3231
  2. [  133.512498] i2c i2c-2: new_device: Instantiated device ds3231 at 0x68
Copy the Code
  1. root@BnananaPro ~ # ls /dev/rtc*
  2. /dev/rtc0
Copy the Code
  1. root@BnananaPro ~ # zgrep CONFIG_RTC_DRV_DS13 /proc/config.gz
  2. # CONFIG_RTC_DRV_DS1307 is not set
  3. # CONFIG_RTC_DRV_DS1374 is not set
  4. # CONFIG_RTC_DRV_DS1305 is not set
  5. # CONFIG_RTC_DRV_DS1390 is not set
Copy the Code
  1. root@BnananaPro ~ # zgrep CONFIG_RTC_DRV_DS32 /proc/config.gz
  2. # CONFIG_RTC_DRV_DS3232 is not set
  3. # 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.

You have to log in before you can reply Login | Sign Up

Points Rules