Add-ons

RTC Backup battery

10 3225
finger  
Hi Tony,

I just noticed from the photos and kernel log samples that RTC battery backup was removed on Rev. B? Is that correct?
Will it be possible to attach it to Rev. B and keep the time?
BR,
Finger




We remove the connector, but also levae the pad for battery (for system, not only for RTC) on the board. And we can use a external RTC module to get the RTC.

finger  
Hi Tony,

Ok, time has come and now i need to keep the time and date.

I would like to understand if baseboard has the RTC circuitry ready and you just need to wire a battery or i have to add a  RTC ds-1307 module for example and use I2C pins TWI2_SDA and TWI2_SCK.
In case it is ready, which battery should i wire, or if i need to add a module, i have here RTC DS-1307 module ready to test, can you share how to enable SDA and SCK and the steps?


Finger

No RTC on the board. we need add a rtc module and connect via the I2C.
The SDA and SCK is already enabled, you can find the i2c-2 under /dev/

neoe  
I wrote a guide on how to add a external RTC to Banana Pi,
hope this helps.
https://n101n.xyz/n/apps.blog?id=32372

finger  
Edited by finger at Jan 11, 2016 16:10

Here is how to setup a RTC ds1307 backup:

* disable platform RTC_DRV_ATC206X  and enable DS-1307 (need to re-compile kernel)
* Wiring the DS1307 module (or the one described by @neoe)

  1. SCL -> pin 5
  2. SDA -> pin 3
  3. 5v -> pin 4
  4. GND -> pin 6
Copy the Code


* Boot and Load the module rtc-ds1307.ko (insmod) or edit /etc/modules and add it there like:
  1. ethernet
  2. wlan_8723bs
  3. ctp_ft5x06
  4. #ctp_detect
  5. rtc-ds1307
Copy the Code


if you edit /etc/modules you need to reboot and make sure you update the time before writing to rtc chip
*  ntpdate -u ntp.ubuntu.com

* Instantiate to create the new_device (/dev/rtc0) like so:
  1. sudo su
  2. echo ds1307 0x68 > /sys/bus/i2c/devices/i2c-2/new_device
Copy the Code


check now if we get rtc0 (our clock)
  1. dmesg | grep rtc
  2. [   71.365808] rtc-ds1307 2-0068: rtc core: registered ds1307 as rtc0
  3. [   71.365876] rtc-ds1307 2-0068: 56 bytes nvram
Copy the Code


if everything is ok we can now write and read to the RTC chip like:
* Writing system data to rtc chip
  1. hwclock -w
Copy the Code


* Reading from rtc chip
  1. hwclock -r
  2. Mon 11 Jan 2016 07:27:30 PM BRST  -0.822205 seconds
Copy the Code


* Updating system time
  1. hwclock -s
Copy the Code


* You can also write directly to the rtc chip:
  1. hwclock --set --date="01/11/16 17:00:00"
Copy the Code



Unfortunately wiring the RTC module to TWI2 added an extra time to the system to shutdown completely, kernel might be busy doing waiting for something on I2C, i could not check with console debug to see what is behind the scenes.

Enjoy  !

finger  
Hi Tony,

Today i opened an issue on github.

Please, try to reproduce the shutdown problem and see if can be fixed.
I use LCD + camera and the TWI2 module attached.

BR,
finger

finger replied at Jan 13, 2016 11:12
Hi Tony,

Today i opened an issue on github.

OK. I will look over it.

12458  
Edited by 12458 at Jan 17, 2016 20:52
finger replied at Jan 12, 2016 06:07
Here is how to setup a RTC ds1307 backup:

* disable platform RTC_DRV_ATC206X  and enable DS-1307 (n ...

Instead of ntpdate (which is deprecated), use

  1. sudo service ntp stop
  2. sudo ntpd -gq
  3. sudo service ntp start
Copy the Code

finger  
Edited by finger at Jan 26, 2016 17:18

I updated some of my findings on github that may help to reproduce the problem.
There is no specific pattern but i believe is not related to RTC or RTC module, i don't have resources to go further than this on my findings.

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

Points Rules