Using the MSP-EXP430FR5969 LaunchPad at 16MHz in Energia


 This is a guest blog post by Bart Basile. Bart is a systems and applications engineer in the Texas Instruments' Smart Grid and Energy Solutions Team, focusing on renewables and distributed generation.

The new FRAM based MSP430FR5969 LaunchPad (MSP-EXP430FR5969) has a lot of great technology to help enable ultra-low-power applications. However, the stock 8MHz enabled in Energia (the software prototyping platform for TI's LaunchPads), can be limiting for some applications, despite the energy consumption benefits. While the FRAM technology itself is limited to an 8MHz read speed, it is rare that you will be clocking data out at this full rate, so to enable the faster core clock, a buffer was added to the memory so the two can operate asynchronously.

In Energia, we are used to the handful of board options available out of the box. We see that the other LaunchPads have various clock speed options, but the MSP430FR5969 microcontroller currently lists 1 8MHz option. While this is useful for many applications, there are occasions where we need 16MHz. A simple example is the usage of WS28xx addressable LEDs that are very popular in the community. In fact, there is already a library supporting them on the MSP430, it just requires a 16MHz core clock since the timing is so critical. We know that 16MHz is supported in hardware, so let’s go ahead and enable it in Energia!

In your Energia directory, navigate to /hardware/msp430/. Here you’ll find the “boards.txt” file which defines all the support MSP430 LaunchPads. Go ahead and open it in your favorite text editor.  If you scroll to the bottom, you’ll find the section for the FR5969 MCU, titled “lpmsp430fr5969.name=LaunchPad w/ msp430fr5969 (V2.0 and higher only!).”  There are two f_cpu defined there:

#lpmsp430fr5969.build.f_cpu=16000000L

lpmsp430fr5969.build.f_cpu=8000000L

The octalthorpe in front of the first line is a comment, so only the 8MHz line is active. A simple solution would be to just uncomment the 16MHz line, and comment the 8MHz line, but we don’t want to have to re-edit this file if we want 8MHz in the future. Another solution is to create a new board entry to support 16MHz.

You’ll notice that each line is prefixed with “lpmps430fr5969,” which is the name of the board that Energia uses to populate its lists. What we’ll do here, is rename the board to denote that it’s 8MHz on each line.  Here’s an example:

lpmsp430fr5969_8.name=LaunchPad w/ msp430fr5969 (8MHz)

So the board’s technical name is lpmsp430fr5969_8, and the name in Energia will be marked as 8MHz.  Go ahead and change the other technical names in the entry to match.

Now, we can copy this block to create a new board entry, and change it to 16MHz. The name I used is:

lpmsp430fr5969_16.name=LaunchPad w/ msp430fr5969 (16MHz)

We also need to be sure to rename all of the lines in this new block, uncomment the 16MHz cpu clock line, and then comment or delete the 8MHz line.  Here’s the final two board entries that I have in my list:

lpmsp430fr5969_8.name=LaunchPad w/ msp430fr5969 (8MHz)

lpmsp430fr5969_8.upload.protocol=tilib

lpmsp430fr5969_8.upload.maximum_size=65536

lpmsp430fr5969_8.build.mcu=msp430fr5969

lpmsp430fr5969_8.build.f_cpu=8000000L

lpmsp430fr5969_8.build.core=msp430

lpmsp430fr5969_8.build.variant=launchpad_fr5969

lpmsp430fr5969_8.upload.maximum_ram_size=1024

 

##############################################################

lpmsp430fr5969_16.name=LaunchPad w/ msp430fr5969 (16MHz)

lpmsp430fr5969_16.upload.protocol=tilib

lpmsp430fr5969_16.upload.maximum_size=65536

lpmsp430fr5969_16.build.mcu=msp430fr5969

lpmsp430fr5969_16.build.f_cpu=16000000L

lpmsp430fr5969_16.build.core=msp430

lpmsp430fr5969_16.build.variant=launchpad_fr5969

lpmsp430fr5969_16.upload.maximum_ram_size=1024

 

##############################################################


 Now, when we open Energia, we can see both board entries in the list. To test this out, I used the WS2811 driver library available here: http://forum.43oh.com/topic/2882-energia-library-ws2811driver-led-controller-class/

This library checks the CPU speed of the selected MSP430 microcontroller, and uses an appropriate assembly library for the timing critical elements, so if the CPU was running at 8MHz it wouldn’t work. Just loading the example that comes with the library, and connecting the LED strand however, shows that we are indeed running at 16MHz.

It should be noted though, that this has not been tested for all functions in the Energia libraries, and some things might not work 100% of the time, but it should work for most things, especially adding LEDs to your microcontroller projects!