MSP-EXP430G2ET: Using MSP430 with a RTC for long (low power) sleep times

Part Number: MSP-EXP430G2ET
Other Parts Discussed in Thread: CCSTUDIO, ENERGYTRACE

Tool/software:

Hello,

I am undertaking a new project. Actually - it's not new, but I've learned after several failed attempts using a Raspberry Pi RP2040/RP2350 that this device "will not cut the mustard"  :)  From all that I've read about the MSP430, I feel this part has the ability to get the job done. However...  I'm not a very experienced developer of micro-controller code, and I've wasted a lot of time on the Raspberry Pi; IOW I need some help as I'm unfamiliar with TI's tools, resources and coding in general. I have bought a 'MSP-EXP430G2ET', but am struggling to get beyond the intial "Hello World" app. So - that concludes the "introduction"; let me now get into the specific objective for this project.

As suggested by the title, I need the MSP430 to sleep for hours, days or even months at a stretch. I have read (somewhere) that this is "problematic" with the timers on most uC due to "clock drift". Based on this, I thought to use an accurate (battery-powered) Real Time Clock (RTC). I've tentatively selected either the DS3231 or the RV3028. Both are capable of <2 PPM drift, and both have an external 'INT' line that can (hopefully) be used as an external "wakeup"/time source for the MSP430. 

So the scheme would be that the MSP430 code does the RTC "configuration" over I2C, then puts itself into a "deep" sleep waiting on the RTC's 'INT' line to go low, and wake it to do it's "normal" job (reading I2C sensors & setting GPIO lines accordingly).

I'm posting here asking for both "General" and "Specific" advice: The "General" advice would be (for example) what tools should I use - and whether or not my objective is even feasible. The specific advice would perhaps be in the form of applicable code samples, and any potential "Gotcha's" I should look out for.

So, that's it. Thanks in advance for any help you can offer.

~JM

  • The ds3231 draws more power in battery standby mode than the MSP430 does in LPM3 and I see 5ppm 32KHz crystals in stock at Mouser. Do you really need 2ppm accuracy?

  • Maybe not... my goal was not to drift by more than a "few seconds" over a 12 month period. 5 PPM might do it - I'll look into that - thanks.

    But my more pressing need is to get some help on the other items in my original post. Any thoughts on those items?

  • Your tool choice depends on what you need. I assume that you are planning on doing this in C. So pick your poison. Perhaps an IDE based system. I prefer the GNU tools.

    As for examples, I doubt if there are any but then only you know what your code needs to do.. Probably your code will perform some setup then sleep until an interrupt indicates it is time to do something. Very simple.

  • I don't mind using GNU tools - I used them regularly during my foray with The Raspberries. Re "IDE based system", could you be a bit more specific?

    But I do need some examples!  I looked into getting the MSP430 to sleep some time ago, and it was bewildering. As I stated in my question, "I'm not a very experienced developer of micro-controller code", and unfamiliar with the MSP430 to boot.

  • Look at the page for the device you are using. For example, the msp430g2553.

    You will find links to the data sheet, user guide, and errata. Don't forget the errata. The user guide provides all of the details on using the various peripherals. It is a lot to take in at once. So do it in steps.

    Under Design & Development (software) you will find a package of code examples. (SLAC485) Very basic examples. There are a couple that demonstrate LPM3 but they use the watchdog in timer mode. Generally a bad idea as you want to use it a watchdog. There are timers available for that sort of thing.

    Plus a link to CCStudio, an IDE.

    Getting a MSP430 to sleep is simple. Really. Start slow. Do a "hello world", aka blink an LED. Then add a timer with interrupt to blink the LED. Then add more. Build slowly. That is what I do with a new device.

  • Build slowly. That is what I do with a new device.

    That sounds like good advice :)  I'll do that.

    I'll leave this question open for a while if that's OK?

  • To pile on, just get yourself a launchpad, CCS20 and the MSP430SDK and start. The latest launchpad has EnergyTrace to monitor the supply current.

  • You can then use the debugger on the board to debug/flash any custom board you create.

  • To pile on, just get yourself a launchpad, CCS20 and the MSP430SDK

    Where do I get/find these things Keith?

  • The auto link above leads you to the page to buy the launchpad:

    https://www.ti.com/tool/MSP-EXP430G2ET

    You can also get it from folks like Digikey.

    Here is a link to CCS:

    When installing you can choose the MSP430SDK.

    https://www.ti.com/tool/CCSTUDIO

  • To pile on, just get yourself a launchpad,

    From the message that started this: "I have bought a 'MSP-EXP430G2ET',"

    That is a launchpad.

  • Can't hurt to have another. 8^)

  • Hi James,
    I'll set this thread to Waiting for Costumer since it seems you got your first head start in your project. If you need further help, I recommend creating a new E2E thread. I'll add that if you need further reference to how the modules work in MSP430, I would recommend our example code from the MSP430 SDK. I'll leave a link to the online version of it (Driver Lib is not available for this device, only Assembly or register level projects.)

    Link: https://dev.ti.com/tirex/explore/node?node=A__AKiKhJ.RK5NvZWMeHCfwCg__msp430ware__IOGqZri__LATEST

    Best Regards,

    Diego Abad

  • Diego - sorry, but I don't understand most of what you wrote!

  • Hi James,
    What I mean is that you can use the MSP430 SDK (a repository of projects, code examples, and documentation) to start running examples in your launchpad (Evaluation board.) The link I provided should lead you the online version of the MSP430 SDK, but you should be able to see a similar version if you download it from TI's website. You'll also need to download CCS (the IDE we use to run, debug, and other things to the MSP430 devices.) I would recommend starting with the simple GPIO(I/O) toggle example I linked you in my previous message. If you need a guide on CCS, I'll also leave a link to its Userguide.

    Link: https://software-dl.ti.com/ccs/esd/documents/users_guide_ccs_20.1.0/index.html

    Best Regards,

    Diego Abad

  • David - do you recommend the  "TI version" of the GCC tools, or is there another one that you feel is better?

  • Thanks Diego - that's much more clear  :)

  • I don't think there is any other version of GCC for the MSP430.

  • Well - I've just spent a scary 15 minutes trying to kill TI's renegade Mac GCC installer!  And since the "TI version" is a non-starter, and I don't have a Windows machine any longer, I'll have to re-assess the tool situation. I wonder why the "Mitto Systems" people (who TI apparently hired to create this package) haven't done something about this?

  • I have always used the Linux version. It has been a few years since there has been an update so it is possible that something changed in the Mac OS that broke the installer.

    You could always try building from the source but you would have to be pretty motivated to do that.

  • This *was* the Linux version, only packaged by "Mitto Systems" for TI. 

    I don't think there is any other version of GCC for the MSP430.

    I guess I'm confused by what you've said???

    Anyway - there's a version available through MacPorts (which I use), but it's called "msp430-elf-gcc" do you know what the 'elf' means?  I'd guess this simply denotes the format of the code it creates for upload to the "Launchpad", but I'm a little paranoid now :)  And the mspdebug package is also available.

  • Hi James,
    Eld stands for Executable and Linkable Format and refers to file formats used for storing executable programs, libraries, and object files. Nevertheless, I'm not that familiar with MACOs and the MPS430, but there should be a CCS MAC version available. 

    Best Regards,

    Diego Abad

  • but it's called "msp430-elf-gcc"

    Every program in the MSP430 GCC bin directory starts off "msp430-elf" in order to distinguish it from other versions of the gcc tools. Of which I have two others, native (arch64) and ARM living on my system.

  • You could always try building from the source but you would have to be pretty motivated to do that.

    Yeah... but it turns out that motivation isn't quite enough :)  After the experience with the Mac installer from "Mitto Systems", I decided that I was going to try something that did not involve a Mac. And so I downloaded the "full-source" package from this page to one of my (Debian) Linux boxes. Started the build late last night; this morning learned it had failed b/c there is no Python2.7 on my system. I checked, and there apparently isn't even a package available for Python2.7 on Debian bookworm :/

    Anyway, it seems my compiler options are "narrowing" :)

  • Anyway, it seems my compiler options are "narrowing" :)

    What is stopping you from using the CCS IDE as pointed out by Keith and Diego, which includes the MSP430 compiler and the option to easily add all of the SDK and examples? It is not GCC, but works just fine especially if you are just starting out.

  • Hi James,
    I accidentally erased your previous message. I'm not so familiar with this Python environment like for MAC, but I strongly recommend using CCS since it will make the programming process easier.

    Best Regards,

    Diego Abad

  • I seem to have received that message via email before it was deleted.

    I haven't tried building gcc from sources for a long time. But the last time I had trouble building a project because of missing dependencies I read the ./configure script. It had hints in it for workarounds when it couldn't find things.

  • Diego,

    I'm sure you're trying to help. But what I do not understand is your claim that "CCS...will make the programming process easier". All I can say is this: I have tried CCS, and it did not make anything easier for me. I wish that instead of offering such advice, you would take some action to fix the files and documentation that TI (apparently) paid "Mitto Systems" to develop. IMHO, the files are badly out-of-date, and the docs are poor quality. Please don't take this the wrong way; If you've read anything I've written in this thread you will know 2 things: 1) I'm OK with gcc itself; 2) the gcc software & installers offered by TI are the problem.

  • But the last time I had trouble building a project because of missing dependencies I read the ./configure script. It had hints in it for workarounds when it couldn't find things.

    David - Yeah, tried that, but I can't seem to break the "code"  :)  Anyway, that's enough of that for me. I'll try something else... 

  • Hi James,
    Thanks for your feedback. I'll let the software team know about this.

    Best Regards,

    Diego Abad

  • Thank you Diego, please let me know if they fix something - or release an update.

  • Hi James,
    I'll make sure to do so.

    Best Regards,

    Diego Abad

**Attention** This is a public forum