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!



One thought's been plaguing me while I used my Launchpad's RTC feature - it doesn't retain seconds counter after being powered off! That's the feature that makes those RTC chips useful: battery-backed memory. Bearing this in mind, I grabbed my trusty tweezers, precision knife and magnifier and opened up LM4F120 datasheet.
 Obvious solution would ripping of a trace near VBAT pin and soldering a wire to pin itself. Then you could connect this wire to CR2032 battery and that would be it, right?

Please don't mind the fact that I accidentally ripped a trace off of a nearby pin and then reconnected it, that step is not necessary :)

That's what I did and it worked (almost). Turns out VBAT is tied to VDD underneath the IC. After switching off main power source the battery was powering the whole microcontroller instead of just RTC...

Then I tried to get the IC off the board with soldering gun and rip off the traces underneath. That's when, not being able to handle precision work for so long, I finally snapped off both VBAT and RST pins...
Hope this failure log helps someone who attempts to the same.


  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 :)


Post a Comment