Wednesday 28 September 2016

Sheevaplug - set the real time clock (RTC)

Today I needed to set the date/time on a Sheevaplug like this:


Using NTP wasn't an option as it was installed with no Internet access.

The device has a real-time-clock built-in but using the "hwclock" command in Linux didn't survive a reboot.

To properly set the RTC you need to go in to the u-boot bootloader.

  • connect the mini-USB serial cable to a PC
  • if using Windows, you may need to install some drivers, there's instructions for this on the Internet
  • reboot the sheevaplug and press any key when prompted during the boot sequence
Then you see the u-boot prompt which says "Marvell" on a Sheevaplug.

To set the time & date there is a command "date".  With no other options, the command returns the current time/date of the RTC, like this:

Marvell>> date
Date: 2016-09-28 (Wednesday)    Time: 10:37:04

To set the date/time, you format is slightly weird (to me at least anyway).  It is:

MMDDhhmmYYYY 
So the year comes after the hours & minutes.  Set it like this:

 Marvell>> date 092812272016
Date: 2016-09-28 (Wednesday)    Time: 12:27:00

And that's it, the hardware clock will now be set and survive reboots.