Hi Guys,
I got a BBB rev C. (w debian). I have connected an esternal battery on the right PMIC inputs, I setting the date/hour, but the processors doesn't remember them. I cannot use an external RTC.
Can You help me.
Thanks a lot
Enrico
Hi Guys,
I got a BBB rev C. (w debian). I have connected an esternal battery on the right PMIC inputs, I setting the date/hour, but the processors doesn't remember them. I cannot use an external RTC.
Can You help me.
Thanks a lot
Enrico
What do you mean by "I cannot use an external RTC" ?
As far as I know, the BBB does not have an onboard RTC. There is a guide on Adafruit on how to add an external RTC: https://learn.adafruit.com/adding-a-real-time-clock-to-beaglebone-black/overview
Other alternatives are to configure NTP in case the BBB is connected to the internet via wifi or ethernet.
Frederick
Hi Frederick,
I want to use the RTC present on AM3358 (see DS http://www.ti.com/lit/ds/symlink/am3358.pdf) processors.
From the BBB schematic I can see that can use a battery pack, through PMIC, for maintain the RTC in "live" mode....
I tried it but, after reboot, the system has a bad date/time....
Hi Enrico,
The AM335x does have a built-in RTC, but what driver did you use to try to program it and use it? Does the Angstrom or Debian releases support it?
I don't know anyone who has tried to use it on the BBB.
Also, I know a LiPo battery can be used with the BBB's PMIC, but I don't know if a Lithium coin cell is supported - I've not checked the schematic.
I think you'll find an external RTC is way easier, otherwise you'll probably be the one trailblazing here - depends how much time you have.
Now it is time to connect the device and see if you can read the time. execute the following command:
echo ds1307 0x68 >/sys/bus/i2c/devices/i2c-2/new_device
If all is well you should get the prompt back with no errors. Now lets make sure it is registered and that you can read it. Enter the following:
cat /sys/class/rtc/rtc1/name
You should see:
[root@BBB-40638 ~]# cat /sys/class/rtc/rtc1/name ds1307
Which is the name of the RTC chip. Now enter:
cat /sys/class/rtc/rtc1/time
You can also substitute 'date' for 'time' but since the clock is not set it will be meaningless. You can later use these commands to look at your RTC directly for testing. The RTC when set is UTC time.
You should see some random time as the clock is not set. Hit the up-arrow key and re-execute the command. Do this several times and the time should be incrementing like a normal clock.
Now we are ready to set it but first your system time has to be accurate. If you are already using ntp and the time is set and correct then you can continue on. If not you need to use 'timedatectl' to set the system time and also the time zone correctly.
timedatectl set-time [TIME]
The time is entered in the format - "2014-11-15 18:17:16".
Once you local time is correct as shown by typing 'date' at the Linux prompt you can go on to setting the clock. To synchronize the RTC to the system type the following:
hwclock -f /dev/rtc1 –w
This sets the RTC, which is /dev/rtc1, to match the accurately set system time
Both of these commands can be executed as a script at boot. I choose to put the script in /usr/local/bin and I called it rtc_init. The script simple has the two initialization lines with a delay before reading.
#!/bin/bash echo ds1307 0x68 >/sys/bus/i2c/devices/i2c-2/new_device sleep 2 hwclock -f /dev/rtc1 -s
I then placed the call to this script just after the delay in /usr/local/etc/rc.allstar as shown here:
# start delay, START_DELAY is configured in the allstar.env file sleep ${START_DELAY} # Initialize and read the RTC /usr/local/bin/rtc_init # enable or disable openvpn
Because the time is up and stable at this point you could probably lower the boot delay. I have successfully used 10 seconds. I would probably not go less than 5 seconds.
Note that the rc.allstar script has a write to the hwclock,
# set clock /usr/bin/hwclock -w
after the above entries which is still necessary.
Note: change the name of the chip to yours and the same setup should work. BTW, I use NTP to set my time very accurately at boot time since I have internet!
Clem
Thanks Guys.
Have a nice WE.
Enrico