energia

New Energia release 0101E0013 - 09/05/2014

48 posts in this topic

I am happy to announce that release 0101E0013 just went up on http://energia.nu. This release adds support for the awesome CC3200 WiFi LaunchPad and CC3100 BoosterPack for MSP430 and TivaC.

 

I want to thank everybody for their support and contributions. Energia would not have been possible without such an awesome community!

 

Details of the release can be found on http://energia.nu

bobnova, Thorvard, bluehash and 9 others like this

Share this post


Link to post
Share on other sites

NEW FEATURE folks will want to be aware of!

 

For msp430 and lm4f (Tiva/Stellaris), there are three new ways to pause or halt the CPU-

 

void sleep(uint32_t milliseconds);

void sleepSeconds(uint32_t seconds);

void suspend();

 

and a complementary function: wakeup()

 

For the lm4f/tm4c platform, these are mostly just placeholders that do not consume any less power than usual; in the future I'd like to explore the ARM's low-power features to make them workable.

 

For msp430 though, the first two use LPM3 modes, and the third enters LPM4.

Energia tests XT1 osc. fault on reset to see if a 32.768KHz XTAL is present; if so, ACLK is set to that and it's noted that ACLK is being driven at 32.768KHz.  If not, VLOCLK is used and its nominal frequency is assumed to be its speed.

 

When sleep() is called, the WDT is reworked to fire every ~1.9ms (varies XT1 vs VLO) using WDT_ADLY_1_9 while incrementing millis() and micros() as accurately as it can (which isn't always accurate... particularly with VLOCLK).  Alas, it does give you true LPM3 mode!

 

sleepSeconds() uses WDT_ADLY_250, which is a much more coarse sleep interval but allows the chip to spend a whole lot more time asleep.

 

suspend() just runs LPM4.

 

The catch here is that normally IRQs firing won't wake up the chip permanently, and since Energia occupies the ISRs with its own routines, it's not possible for a user's ISR (registered via attachInterrupt() or similar) to run __bic_SR_register_on_exit to cancel the LPM mode.

 

Enter wakeup().  The wakeup() function sets a volatile global flag which signals to the sleep(), sleepSeconds() or suspend() function that sleep mode should be aborted.  Moreover, many of the ISRs have been reworked to check for a change in this flag after it executes the user's ISR in order to determine if it should run __bic_SR_register_on_exit(LPM4_bits) itself.  This allows the user's ISR to cancel LPM mode.

 

These functions (sleep(), sleepSeconds(), suspend() and wakeup()) also exist on the lm4f/tm4c platform, they just don't use any particularly low-power modes yet.  But still, the code should port over, and it does give you as a programmer a simple way to "halt" the CPU or pause with the option of aborting it early.

 

Also note, LPM3/LPM4 will cause any Serial input to be corrupt, since the SMCLK isn't running for the UART module to correctly detect the bits.  This isn't the case for the Tiva/Stellaris yet, but will be once we implement true low power modes over there.

 

The wakeup() handler has been added to the I2C ISR handler too, so it is (in theory) possible to configure the chip as an I2C slave with the Wire library and then suspend() to enter LPM4, then wakeup() upon receiving a request, since I2C is clocked externally.  (I haven't actually tested this yet...)

 

I never got around to adding these functions to the cc3200 port, but will do so by the next release (or maybe offer a patch for it in between).

(I just added the suspend() and wakeup() stuff, all props go to @@energia for the sleep/sleepSeconds/ACLK implementation :D )

bobnova, Marc, Automate and 3 others like this

Share this post


Link to post
Share on other sites

Very very cool. I'm glad to see Energia supporting deeper sleep modes. That was something I was missing. I'd worked around it by repurposing the WDT, sleeping, then setting the WDT back to how it was, but that does bad things to millis and such.

 

Thanks for the features and the heads up!

Share this post


Link to post
Share on other sites

Another thing I discovered, not about Energia but noteworthy for folks using the new CC3200 - ADC inputs are measured against a 1.46V reference, the analog input buffers are only supposedly tolerant up to 1.8V.  That could be a problem if you have some 3.3V-level analog inputs.

 

This doesn't seem to apply with digital I/O mode for these pins, but as the datasheet cautions, having the digital I/O output buffers enabled & set high while the ADC mode is configured for the pin could cause the MCU to blow up its own ADC buffers.  Since Energia uses the CC3200 driverlib I assume there's no risk of that here...

dpharris and bobnova like this

Share this post


Link to post
Share on other sites

Wow!

 

I have been waiting in anticipation for this version of Energia. I am very impressed with the work done!

 

Let the tinkering begin!

 

Kind regards, Eelco

Share this post


Link to post
Share on other sites

Just downloaded this much anticipated upgrade as have a cc3200 launchpad. Got caught out straight away when trying my very first example using the liquidcrystal library - I literally just opened up "hello world" without even attaching my board just to see if it would compile. I then went and selected the cc3200 as my board in Energia (under tools menu) and the compile routine bombed. The reason being is that I selected the example from the examples menu before selecting the board under tools menu and therefore the compile error was that it could not find the liquidcrystal library. 

 

I thought most odd! Looking beneath the hood I see that the standard libraries are filed in the hardware directory with each hardware platform having its own "libraries" directory. Somewhat different to what you would find with Arduino IDE. Hence if I had selected my cc3200 under the tools menu and then tried to select the liquidcrystal libraries it would not have shown up in the examples menu as it does not exist for the cc3200 as yet. 

 

Of course this makes sense due to each platform having unique characteristics. Now question. As you may know, with Arduino IDE, I can download and store my own libraries in my own workspace inside a libraries folder rather than download my libraries and store inside the Arduino program libraries folder. How does this work with Energia especially now that we have separate libraries for each hardware platform. Does Energia look inside its workspace folder for a libraries folder and then search for a hardware folder (or vice versa) or does it not do this at all.

Share this post


Link to post
Share on other sites

Thanks for good job.

Is it possible to add support for 2230/2210 8pin uP with correct initialization unused pins?

 

PS. Why don't upgrade repository with new rxtxSerial.dll? Old verions make a lot of problems when You use PC Bluetooth interface (long startup, crashes etc.)

http://forum.arduino.cc/index.php?PHPSESSID=adocda7ptvtdma9c0fnms2qgo3&topic=136173.msg1023542#msg1023542

Share this post


Link to post
Share on other sites

I'm unsure of the proper place to list problems, please excuse me if this post is out of place.

 

When trying the ScanNetworks example program, it would not compile due to a missing #endif

 

I added it as shown here:

 

#ifndef __CC3200R1M1RGC__
// Do not include SPI for CC3200 LaunchPad
#include <SPI.h>
#endif

Share this post


Link to post
Share on other sites

 

I'm unsure of the proper place to list problems, please excuse me if this post is out of place.

 

When trying the ScanNetworks example program, it would not compile due to a missing #endif

 

I added it as shown here:

 

#ifndef __CC3200R1M1RGC__
// Do not include SPI for CC3200 LaunchPad
#include <SPI.h>
#endif

 

Thanks ... yep this is a known issue, a fix for it went into the github master repo but just shortly after the release was out I think.

Share this post


Link to post
Share on other sites

Of course this makes sense due to each platform having unique characteristics. Now question. As you may know, with Arduino IDE, I can download and store my own libraries in my own workspace inside a libraries folder rather than download my libraries and store inside the Arduino program libraries folder. How does this work with Energia especially now that we have separate libraries for each hardware platform. Does Energia look inside its workspace folder for a libraries folder and then search for a hardware folder (or vice versa) or does it not do this at all.

 

It looks like it looks in the [workspace]/libraries folder first, and then in the [energia]/hardware/[platform]/libraries folder.  In Arduino (1.5.2 at least) it looks in 3 places - the [workplace]/libraries, [arduino]/libraries, and [arduino]/hardware/arduino/[platform]/libraries.

 

It looks like users are supposed to put libraries in the workspace folder.  I don't see any provision for distinguishing user installed libraries by platform (so if you use CC3200 and Tiva, you may just have to remember which libraries work with which device).  [Edit: I should clarify - that is in Energia, or for Arduino 1.0 libraries.  The draft Arduino 1.5 library specifications do have ways to specify what platform a library supports.]

 

It would be helpful if Energia (or Arduino) gave a warning about duplicate libraries installed in the workspace and the hardware libraries folder.  While there are reasons one might want to do this (to override a system supplied library), there are also cases where it could cause considerable angst.  (e.g. if one has different versions of a library in the workspace folder and the hardware folder, or one has a user installed library for a Tiva that happens to have the same name as a system library for an MSP430.)

Share this post


Link to post
Share on other sites

If you find what you think is an error in Energia, or have a suggestion for an improvement, you may want to check through the list of issues at the Energia github repository: https://github.com/energia/Energia/issues

(You may find that somebody has already reported the issue, or that a fix is available.)

Likewise, for issues involving the Energia programming environment, the Arduino issues section may be helpful https://github.com/arduino/Arduino/issues (since Energia is an offshoot of Arduino, they share many of the same features and problems).

Share this post


Link to post
Share on other sites

@@energia

 

Thanks for your hard working.

But I think energia-0101E0013 is having a small bug in Serial Communication

In ASCII Table Example:

when I upload code in version 0101E0013 the response of the msp430 is slower 3 seconds when I press reset button.

The similar thing does not happen in older version 0101E0012. Whenever I press reset button It clears and give me a new response.

MSP430G2553.

Please fix this.

Share this post


Link to post
Share on other sites

That's not a bug, it's a timeout in energia 13's new LPM code which tries to see if you have a working 32.768KHz XTAL or not.

 

Sent from my Galaxy Note II with Tapatalk 4

Share this post


Link to post
Share on other sites

Onboard temperature sensor example did not work for  me. Anyone can help?

QuickTMP006.ino:17:20: fatal error: tmp006.h: No such file or directory

 

Please note that the example you are trying to load is for a TMP006 infra-red temperature sensor, which is part of the Educational Boosterpack Mark 2.  I do not believe that there is a TMP006 temperature sensor built in to the CC3200, so this probably is not an onboard sensor. [Edit: My memory was wrong, turns out it does have a TMP006]

 

It looks like there is indeed an omission in the CC3200 section of energia.  It could be that the TMP006 driver has not been tested or does not work with the CC3200 (and they neglected to remove the demo), or that the TMP006 driver was inadvertently omitted.

 

If you want to read from the temperature sensor built in to the CC3200, if it works like the Stellaris/Tiva processors, then there would be a special ADC channel to read that sensor.  (Don't know if there are demos that cover this specifically.)

 

I did a little poking around and it looks like all the BP mark 2 examples which rely on libraries (Servo, LCD_, TMP006) do not work on CC3200 because the requisite libraries do not exist on that platform.  I will submit an issue.

janisalnis likes this

Share this post


Link to post
Share on other sites

That's not a bug, it's a timeout in energia 13's new LPM code which tries to see if you have a working 32.768KHz XTAL or not.

 

Sent from my Galaxy Note II with Tapatalk 4

So how can I disable this time out?

Share this post


Link to post
Share on other sites

So how can I disable this time out?

Install XT1 and it will shorten, otherwise you can't (well, find the code in wiring.c and modify if you want)

 

Sent from my Galaxy Note II with Tapatalk 4

Share this post


Link to post
Share on other sites

Hello all,

 

I think I found a mistake in the CC3200 Launchpad pin map (pins_energia.h).

In the file I have (Energia 0101E0013), the push-button 1 is defined as Pin 3

static const uint8_t PUSH1 = 3;
but from the map on the energia.nu it should be on the Pin 4

static const uint8_t PUSH1 = 4;
Regards,

Liviu

 

PS Sorry if this issue was already reported, I've found nothing on the github list.

Share this post


Link to post
Share on other sites

 

So how can I disable this time out?

Install XT1 and it will shorten, otherwise you can't (well, find the code in wiring.c and modify if you want)

 

The function enableXtal() looks suspiciously like it may be what you want.

At one of the calls to it it says.

/* Attempt to enable the 32kHz XTAL */

 

Seems a little odd that this function is called twice for some parts.

(if __MSP430_HAS_BC2__ is defined, it is called up near the top of initClocks(), and then it is called again down at the end of initClocks().)

Not clear from the code why it needs to be called twice.

 

enableXtal is not present in previous version of Energia.

(I haven't tested it to be sure that it is the part you want, or to figure out how to bypass the timeout).

 

Might be nice if there was a user configurable way to turn the check off.

Share this post


Link to post
Share on other sites

I think I found a mistake in the CC3200 Launchpad pin map (pins_energia.h).

I was looking a little more and I think the mistake is in the documentation (or in the way I'm reading it).

Sorry for the false report.

Share this post


Link to post
Share on other sites

UPDATE-

 

Energia 13 unfortunately was built to use "-O0" (optimization turned off) for all ARM Cortex-M platforms (lm4f Stellaris, tm4c Tiva-C, cc3200) which can bloat code size or otherwise alter performance.  This was done in the testing of the new CC3200 platform but never intended to stick around for the release.  MSP430 not affected.

 

Rob did a quick rebuild of the IDE with "-Os" (optimize for size, the typical default for embedded applications) and provided an updated "pde.jar" file here - http://forum.43oh.com/topic/5876-energia-0101e0013-how-turn-on-optimization-for-tivacc3200/?p=51199

 

Please d/l that, unzip it and replace the "pde.jar" in your Energia install with that.  Under Linux it's located in energia-0101E0013/lib, see his instructions for OSX and Windows should be similar to Linux's location.

Share this post


Link to post
Share on other sites

Please note that the example you are trying to load is for a TMP006 infra-red temperature sensor, which is part of the Educational Boosterpack Mark 2.  I do not believe that there is a TMP006 temperature sensor built in to the CC3200, so this probably is not an onboard sensor.

On CC3200-LAUNCHXL is onboard I2C temperature sensor TMP006 chip and accelerometer BMA222 chip. They are used in Out-Of-the-Box demo. And in CCStudio examples there are files tmp006drv.c and tmp006drv.h. I have used these files in my CCStudio projects.

Hope that will be possible to read them in Energia.

igor likes this

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