[HowTo] Battery backup RTC

Jetson TK1 does not have a battery backup RTC. Ofcoure time and date can be synchronized with the network. but the problem occurs in the absence of a connection. If you have a little desire, you can make yourself the clock itself.

Requirments:

Wiring:

Installation:

  1. Check DS3231 connection on ic2-1 bus
sudo i2cdetect -y -r 1

You should look address “68”

0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f
00:          -- -- -- -- -- -- -- -- -- -- -- -- -- 
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
60: -- -- -- -- -- -- -- -- 68 -- -- -- -- -- -- -- 
70: -- -- -- -- -- -- -- --
  1. Attach new device DS3231
echo ds3231 0x68 | sudo tee /sys/class/i2c-dev/i2c-1/device/new_device

If succesfully, module “rtc_ds1307” will be loaded and device /dev/rtc1 will be created:

lsmod
Module                  Size  Used by
rtc_ds1307             10881  0
ls /dev/rtc*
/dev/rtc  /dev/rtc0  /dev/rtc1
  1. Set proper date and time (if required)
sudo date --set "2014-8-21 23:00:00"
  1. Store date and time in rtc1 (DS3231)
sudo hwclock -w -f /dev/rtc1

You can read current time from DS3231 now to check is writed correctly:

sudo hwclock -r -f /dev/rtc1
Thu 21 Aug 2014 11:01:38 PM UTC  -0.434869 seconds
  1. Add to /etc/rc.local two lines:
echo ds3231 0x68 | sudo tee /sys/class/i2c-dev/i2c-1/device/new_device
sudo hwclock -s -f /dev/rtc1
  1. Reboot! You have battery backup RTC clock

RECOMMENDED OPTIONAL STEPS

You have two RTC clocks /dev/rtc0 (rtc_as3722) and /dev/rtc1 (rtc_ds1307). Strongly recommended is disable rtc0 and make rtc1 as default clock.

  1. Add rtc_as3722 module to blacklist in /etc/modprobe.d/blacklist.conf
blacklist rtc_as3722
  1. Modify /etc/rc.local script to use rtc0 (after reboot, ds3231 will be default one RTC clock)

line:

sudo hwclock -s -f /dev/rtc1

replace to:

sudo hwclock -s -f /dev/rtc0

and roboot.

Nice work! We need more HW hacks :)

Just a reminder for those coming from microcontroller world: Most of the pins in Jetson seem to use 1.8V logic level but the generic I2C seem to use 3.3V. So be sure not to connect 3.3V logic to a 1.8V pin.

Yep. J3A1 20 and 18 pins are 3.3V I2C (GEN2_I2C). Is pulled up to 3.3V by 1kohm resistors.

But i have question to develeopers. CAM_I2C is I2C 3.3V too, but is pulled up to +1.8V RUN_CAM and connected to VDDIO_CAM (1.8 - 3.3V). But supply on pins 8,11 (J3A2) is not available. How do enable supply RUN_CAM? I try pull up SDA and SCL to 3.3V manualy but connected devices have problems with communication on read data, but write and i2cdedtect works. any glue?

I’m working from the upstream kernel. I’m wondering, what would need to be added to the dts file to get this to automatically load on boot? Specifically, where would that go in this file?
https://git.kernel.org/cgit/linux/kernel/git/stable/linux-stable.git/tree/arch/arm/boot/dts/tegra124-jetson-tk1.dts?id=refs/tags/v3.18.7

Where would the wifi enable go in here as well?

Thanks!

Hello,

Jetson TK1 uses AMS AS3722 Power Management Unit, which has low power real time clock and +VBAT_BKUP pin.

Also AS3722 is correctly connected to TK1.
I tried following:
TK1 was 30 minutes down with connected power supply without internet connection. After power up without internet connection Jetson shows current time!

@NVIDIA: Is +VBAT_BKUP pin connected to one of the expansion pins?

I looked at the schematic, VBAT_BKUP is connected to capacitor C6D4, but not to J3A1 nor to J3A2. This capacitor is near the power connector, bottom side of the board. It kind of looks like removing that capacitor and tacking on to the trace there is the only way to wire this to the outside world. Anyone see an alternate access to this?

+1 to your question linuxdev.

Also if we remove C6D4 where do we need to connect ground pin of the battery backup?
Also what does exactly powers VBAT_BKUP+ pin? (all the functions of the AS3722 or just the RTC or … something else)

That capacitor has one side to ground, one side to VBAT_BKUP+; this capacitor is the one some people remove to force Jetson to reboot whenever power drops and comes back, and emulates a small battery (probably not the ideal way to cause the desired reboot behavior, one should be able to have battery backup and still control reboot). Almost any ground could be used, including grounds on J3A1/J3A2.

As to the source of current which charges the capacitor, I don’t know. Hopefully someone else has an answer. I see hints on the schematic when going through the 3722 PMU that this is closely related to +2.5VAON_RTC and LDOVRTC_OUT, but it isn’t exactly clear what is going on internally. The schematic trace label 31B5 seems to tie it together, you may find more information looking at everything touching 31B5, e.g., I see a reference to one of the BGA pins (PWR_INT_N routed to PMU_INT_L).

here is small demo for WakeUp Jetson by integrated RTC

I tried following these instructions, and everything worked except that the date was not getting set correctly from the hwclock command when run in the /etc/rc.local file. I discovered that there are some other scripts (Upstart scripts I believe) in the /etc/init folder that mess with the date as well. I ended up removing all the commands in the /etc/init/hw-clock.conf file, and things started working as expected.

Hello,
I’m trying to use the DS3231 RTC.
I have followed the steps:

- :~$ sudo i2cdetect -y -r 1

 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: -- -- -- -- -- -- -- --
- :~$ echo ds3231 0x68 | sudo tee /sys/class/i2c-dev/i2c-1/device/new_device

ds3231 0x68
- :~$ lsmod
Module                  Size  Used by
dm_crypt               13259  0 
dm_mod                 73887  1 dm_crypt
joydev                  8875  0 
rfcomm                 38351  0 
bnep                   10469  2 
bluetooth             307060  10 bnep,rfcomm
rfkill                 10365  3 bluetooth
nvhost_vi               3064  0

It looks like the module is not loaded

:~$ ls /dev/rtc*
/dev/rtc  /dev/rtc0

rtc1 is not listed.

What am I doing wrong?. Any advice?
Thanks.

yes,i have the same question,had you figured out??

sorry,i follow your steps in jetson nano B01,but it fail,[HowTo] Battery backup RTC - #11 by Ricardomd83
and how to find the devices new ,i use the lsmod but i can’t see the right device.

你好,这边需要重新编译内核,然后再试试