Jump to content
Sign in to follow this  
NurseBob

Seeking advice - MSP430F5529 C/C++ vs Energia

Recommended Posts

I've been lurking here for awhile... I am a noob to Energia, but have more than a little experience designing and writing interrupt-driven C code for msp430f2013, as well as some time spent with the value line devices.
I am working on a personal project with the F5529, connecting to a GPS (the adafruit ultimate BOB), an Iridium 9602 Sat-Comm device (sparkfun RockBlock), and a cap touch TFT LCD (have worked with both the adafruit 2.8" BOB and a www.buydisplay.com version of same). The project is a DIY short-burst-data comm device to let my wife know I've not been eaten by a bear on an upcoming 250 mile hike on the John Muir Trail. Oh, and I'm aware that there are commercial devices available ($600 - $1200 plus subscription fees).
I chose the F5529, in part, for the dual hardware UARTs, one connected to the GPS @9600 and the other to the 9602 @19200. The LCD uses SPI for screen management and I2C for the cap-touch interface. While the system is up and running, the different devices will not be running concurrently. I had been thinking of a LPM3 timer interrupt-based system that would capture and communicate position data on an hourly basis during the day, and that I could put into LPM4 at night to conserve battery.  The LCD merely provides a UI for mostly menu-driven messages and system-state options, but may include a free text option to send a special message, or read a message from my wife.

In C, I have successfully connected to all three devices using both UARTs for the two async devices with both a F5529 launchpad, and also an MSP-FET430U80+F5529. I've been intrigued by Energia as a means to code my project a little more quickly with "trusted" libraries.  But on closer inspection, I see that the basic construct for Energia is one focused on Arduino compatibility and not necessarily low power interrupt-driven designs.

I've read several discussions on this board regarding using low power modes, and the potential for interfering with the Energia architecture, as well as possible workarounds. I've also looked at pabigot's class libraries, and they look like a solid alternative, but I'm not sure my C/C++ skills are really up to snuff to effectively use the work.

I do have some questions regarding Serial, Serial1 and the backchannel UART, but I need to do some more experimenting so I can ask better questions, assuming I can't find my own solutions.

 

TIA for any thoughts, suggestions, etc!

Bob
 

Share this post


Link to post
Share on other sites

I have had good success with using Energia libraries via Code Composer Studio for the TI MSP430. And for low power, interrupt driven application needs. Energia is a framework/libraries that help with some of the nitty stuff. And you have the source to Energia which helps with learning. I have made my own version of certain Energia modules, specifically to extend them to help with event driven needs :)

 

You are right that it is C++. It always amazes me that we can use full object oriented C++ on these little MCUs. But we can. Classes, encapsulation, methods, and so forth.

 

The UARTs work well and are straight-forward to use via Energia.

 

It all takes a bit of learning and experimenting, that's for sure!.

 

BTW, one of the low power apps I've built the system spends most of its time in LP3 but is awakened when traffic comes in from the Bluetooth module to the UART RX channel. After it processes the command it falls back into LP3 till next time or until the internal timer wakes it up to do periodic work.

Share this post


Link to post
Share on other sites

I have had good success with using Energia libraries via Code Composer Studio for the TI MSP430. And for low power, interrupt driven application needs. Energia is a framework/libraries that help with some of the nitty stuff. And you have the source to Energia which helps with learning. I have made my own version of certain Energia modules, specifically to extend them to help with event driven needs :)

 

You are right that it is C++. It always amazes me that we can use full object oriented C++ on these little MCUs. But we can. Classes, encapsulation, methods, and so forth.

 

The UARTs work well and are straight-forward to use via Energia.

 

It all takes a bit of learning and experimenting, that's for sure!.

 

BTW, one of the low power apps I've built the system spends most of its time in LP3 but is awakened when traffic comes in from the Bluetooth module to the UART RX channel. After it processes the command it falls back into LP3 till next time or until the internal timer wakes it up to do periodic work.

Thanks!

I was looking at your thread on the BT and AT commands. The rockblock uses a number of both the standard and custom AT commands. 

Re: UARTS - I figured out how to use the port mapping feature to move the backchannel pins to replace P4.0 and P4.3 before I realized that the pins were available on the backchannel - however, relocating the pins simplified the PCB layout for the Rockblock.

My plan was/is to use appropriate class methods to send the AT commands and parse the responses from both the GPS and the rockblock.

 

I may send a query or two your way if I run into problems with LMPx.  What I'd like to do is a variant of the typical:

while (1)

{

    LMP3;

    do_some_flag_based_processing();

 }

Coupled with: low_power_mode_off_on_exit();

when exiting an interrupt.

 

Do you use the Energia Setup()/Loop() construct? Or are you running a traditional main()?

I actually bought a license for CCS 6, which I may not have really needed for this project, but do for another more complex bit of work.  So, like you, I do love having access to a good debugger.  While I far preferred IAR's UI, there was no way I could afford a license.  It was hard enough justifying one for CCS.  But, I like having good tools...

 

If all goes well with my DIY locator, I'll be putting any non-embarassing code and design files in the public domain.

Thanks again!

 

Bob

 

Share this post


Link to post
Share on other sites

My recommendation is to use the Energia Setup()/Loop() construct, And use CCS as the IDE rather than the Energia IDE. CCS is Eclipse and so the its debugger can be used.. Without the debugger progress will be tough.

 

LPM3 is encapsulated in Energia by the sleep() methods so you make sleep() calls rather than LP3 directly.

 

I have  the MCU to respond to traffic on the UART RX channel while in LPM3 by processing the requests during the RX ISR wakeup.

 

Thank you,

Share this post


Link to post
Share on other sites

Energia is two things:

  • a pretty limited IDE you can change for CCS,
  • a framework acting as a hardware abstraction layer (HAL) for easier port management. 

The underlying language remains C/C++.

 

Using the HAL means your code can run on other LaunchPads supported by Energia.

Share this post


Link to post
Share on other sites

I actually prefer to use the Energia toolchain, with an IDE like code::blocks. But, I do also use a different MSP430 ( G2 ). To write, and edit code I prefer to use yet another separate text editor. Visual studio code, Sublime text 3, whatever suites me at the time.

 

But the main reason why I prefer code::blocks is that it's very flexible, and one can create in IDE tools to perform various tasks. Which could also be achieved by using make, and make "build" options. This is just where I arrived first, and now am used to.

Share this post


Link to post
Share on other sites

I actually prefer to use the Energia toolchain, with an IDE like code::blocks. But, I do also use a different MSP430 ( G2 ). To write, and edit code I prefer to use yet another separate text editor. Visual studio code, Sublime text 3, whatever suites me at the time.

 

But the main reason why I prefer code::blocks is that it's very flexible, and one can create in IDE tools to perform various tasks. Which could also be achieved by using make, and make "build" options. This is just where I arrived first, and now am used to.

I've played with the G2, but wanted a "native" USB for another '430 project.  I went with the F5529 because it was convenient, which I recognize is NOT an appropriate approach, but for a "quick and dirty" - lazy won. :)

 

Bob

Share this post


Link to post
Share on other sites

Energia is two things:

  • a pretty limited IDE you can change for CCS,
  • a framework acting as a hardware abstraction layer (HAL) for easier port management. 

The underlying language remains C/C++.

 

Using the HAL means your code can run on other LaunchPads supported by Energia.

I found the Energia IDE not very useful. I have worked with IAR and CCS for some time, and immediately ran into the limitations.  However, the HAL approach, which is what I thought I saw, is very appealing.  Thanks!

 

Bob

Share this post


Link to post
Share on other sites

LPM3 is encapsulated in Energia by the sleep() methods so you make sleep() calls rather than LP3 directly.

 

I have  the MCU to respond to traffic on the UART RX channel while in LPM3 by processing the requests during the RX ISR wakeup.

Are you running much code in the ISR?  Or setting a flag for the main loop?

Oh well, time to experiment. 

Thanks again. :)

Now that I'm home from a brief vacation to Portland, OR I can do more than mind experiments! :)

Bob

Share this post


Link to post
Share on other sites

I've played with the G2, but wanted a "native" USB for another '430 project.  I went with the F5529 because it was convenient, which I recognize is NOT an appropriate approach, but for a "quick and dirty" - lazy won. :)

 

Bob

Just saying, I use a G2, so using my guide for setting up the Energia toolchain for different MSP430 could prove to be more difficult than it seems on the surface.

 

Funny thing is. I view all these "larger" MSP430 as unnecessary. Because I know enough about ARM Cortex M0/M0+ M3/M4 to be fairly dangerous ;) But seriously. You can get a good ARM processor, that is better in many ways compared to some of these more expensive MSP430 options. Then pay less while you're at it. I'd suppose that distinction could be a bit subjective . . .

 

But, you know thats me. I do not expect everyone to see things the way I do. Nor do I think any less of people because they do not think like me.

Share this post


Link to post
Share on other sites

@@NurseBob If you want to use the F5529 for its USB support, CCS is probably your only option. You may still use parts of the Energia framework as suggested by @@RobertWoodruff , but as far as I know, Energia does not have a USB library yet.

 

I use the USB CDC libraries coming with the MSPWare driverlib which work well with the F5529 LaunchPad.

Share this post


Link to post
Share on other sites

@@NurseBob If you want to use the F5529 for its USB support, CCS is probably your only option. You may still use parts of the Energia framework as suggested by @@RobertWoodruff , but as far as I know, Energia does not have a USB library yet.

 

I use the USB CDC libraries coming with the MSPWare driverlib which work well with the F5529 LaunchPad.

Yes, CCS combined with Energia is the plan for my other project. I see Energia as a convenience "tool" for some of the stuff I'd rather not write from scratch.  Energia supports a lot of the things I want to do. The main challenge is figuring out where to put the effort, especially when Energia doesn't do something I want, or takes over a resource I need. Do I write a workaround? Or just write what I need... :)

Thanks for your thoughts.

Bob

Share this post


Link to post
Share on other sites

 

I have  the MCU to respond to traffic on the UART RX channel while in LPM3 by processing the requests during the RX ISR wakeup.

 

Thank you,

Ok, I've managed to miss something along the way...

I've got comms between my various async devices talking to a debug console.  Happy with that, but...

if I have the following:

 

void loop()

{

   gpsGetFix();

   satCommSendLocationMessage();

   sleepSeconds(600); //wait 10 minutes between locations

}

 

I'm lost on just where you're putting the RX ISR wakeup() call?

The satComm receives AT commands and may take several 10's of seconds to acknowledge with its result codes.

I took a look at attachInterrupt() and it's clearly focused on button-type events.

So, how are you tying-in to the RX ISR? I've been wandering through the Energia docs and can't seem to find the right thread to search on in the reference docs.

 

TIA - you've been very helpful and it's much appreciated.

 

Bob

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×