Wednesday, 8 February 2017

Tiva and Stellaris Launchpad RTC usage in Energia

For those of you who still have one of those old Stellaris Launchpads, I'm going to show how to utilize one of its most useful features - real time clock - in a simple way. Actually, the Hibernation module is the same in the new Tiva Launchpad, so it's supposed to work there as well.

Some time ago I ordered one of those Stellaris boards, which were great for their price (about 12USD) - 80MHz ARM core with lots of I/O, UARTs, SPIs and I2Cs, USB device, Hibernation module and Arduino-like IDE (called Energia) support for simplicity of programming. Later, the line got rebranded to Tiva and Texas Instruments made another launchpad, almost identical to this one.
Basically, Tiva Launchad is the same Stellaris Launchpad with a slightly different processor - LM4F120 on Stellaris was replaced with TM4C123G on Tiva.
Meanwhile, the Stellaris Launchpad was collecting dust on my shelf, when I realized - it can be used as simply as any Arduino-compatible dev board, but it has something more to offer - RTC in Hibernation module!
I started digging the internet and eventually I had this proof-of-concept code that makes use of Hibernation module as a simple RTC. It's limited to only telling you time (without date), but that was what I needed anyway.

Upload it to your Stellaris or Tiva Launchpad and open Serial monitor:

Send g to get current time, send s to set time. That's all, you are welcome to use this anywhere you want. This code snipped could be a base for a digital clock with some cool features, or an automated watering system, it's up to you!


  1. Cool post Vadim! I assume the Stellaris has to be powered for the RTC to keep a set time meaning a power loss would reset it to zero, yes?

    1. Yup, unless you are willing to do some truly tedious and microscopic work of soldering a separate wire to VBAT (pin 37 on Stellaris's LM4F120). I'll post a followup if I find the guts to do it :)