zeke

Best information for those new to the MSP430?

68 posts in this topic

If you are new to the MSP430 then you're probably drowning in information right now.

It's true that there are a zillion configurations to make before the 430 will do what you want it do do.

So I'm betting that you are asking yourself "Where do I start?"

I humbly suggest the following TI application notes and books that will get you going in the right direction:

1. slaa294: MSP430 Software Coding Techniques

This application report covers software techniques and topics of interest to all MSP430
programmers. The first part of the document discusses the MSP430 standard
interrupt-based code flow model, recommended for the vast majority of applications.
The next part discusses a handful of techniques that should be considered by any
developer that sets out to develop an MSP430 application. Using these methods can
greatly reduce debug time and/or provide additional robustness in the field. They
include initialization procedures, validation of supply rails before performing
voltage-sensitive operations, and use of special functions. Code examples are
provided.


2. : MSP430 32-kHz Crystal Oscillators

Selection of the right crystal, correct load circuit, and proper board layout are important
for a stable crystal oscillator. This application report summarizes crystal oscillator
function and explains the parameters to select the correct crystal for MSP430
ultralow-power operation. In addition, hints and examples for correct board layout are
given. The document also contains detailed information on the possible oscillator tests
to ensure stable oscillator operation in mass production.


3.
MSP430 Microcontroller Basics by John H. Davies

The best thing I can say about this book at this time is that it describes well how to make use of the clocking system of the MSP430. This book should be in your personal library or at least on your wishlist.

Once you digest the information above then you will be in good shape for success in working with the msp430.

Have something to add?
Then post up your valuable sources of knowledge.

JMLB, jsolarski, GeekDoc and 9 others like this

Share this post


Link to post
Share on other sites

As you progress in your development of an embedded system based upon the MSP430, you will eventually have to cut your dependency on your dev board. When you do this, you will have to give your system the ability to be programmed.

 

Whether by JTAG or by Spy-Bi-Wire, you will have to assimilate and understand the information inside this document. Otherwise, you will have a brick coming off the assembly line.

 

Do want to make a million bricks or a million dollars?

 

Knowing this information will save you time, money and prevent ulcers!

 

 

4. slau320: Programming via the JTAG Interface

 

This document describes the functions that are required to erase, program, and verify the memory module

of the MSP430

Share this post


Link to post
Share on other sites

So, now you got a job doing hardware design and you want to use the MSP430 in your design.

 

But you've discovered that your boss has insisted on using this "wicked cool awesome" and ancient 5V sensor because they have a bazillion in stock.

 

"What's the problem with that?" you ask.

 

The problem is this: the MSP430 is a 3.6V device and it doesn't have 5V tolerant I/O's. This means that you'll probably hurt the part if you put 5V into an input. Go ahead and google it. You'll find our very own OCY schooling someone on this topic back in 2008. I'll let you find the article. OCY is shy. And he's probably gonna rip me open for giving away his secret identity. ;)

 

So, what's the answer? SLAA148 is the answer.

 

It will take you through the various input and output scenarios that you may face trying to interface to higher voltage systems - not just 5V.

 

Using this information, you should be able to measure the status of a 12V power supply with the A/D inputs or figure out how to drive a 12V relay.

 

Have a read. It's useful info.

fj604, jsolarski, vicvelcro and 6 others like this

Share this post


Link to post
Share on other sites

This is a follow up to the 5Volt tolerant I/O posting above.

 

I decided that I should put up a picture of a sample circuit that I've used to do 5V tolerant I/O.

 

The resistive divider on the left will scale down the 5V to a range tolerable by the MSP430.

 

The NPN transistor will do the same in the output direction. You could drive anything with the NPN - not just a relay.

 

This should make things clearer.

post-955-135135499692_thumb.png

GeekDoc and Robby like this

Share this post


Link to post
Share on other sites

Note: This is a follow up on the JTAG posting above.

 

This is very valuable information that you should remember.

 

The MSP-FET430UIF is TI's programming tool. It is able to program an MSP430 using either JTAG or Spy-Bi-Wire. I recommend that you get one if you don't already.

 

The MSP430 Hardware Tools - User's Guide is its user manual. You want this document because it will aid you in your circuit design choices.

 

Pay special attention to pages 25 and 26. These circuit diagrams will show you the difference between JTAG and Spy-Bi-Wire circuits.

 

When you design your product for your customer, you should refer to this User Manual so that you select the correct circuit and components. Then you will be able to mass manufacture your devices with confidence knowing that you will be able to program them.

 

Also, one more note. The LaunchPad can be used as a programmer for your devices. But, you should take note of which device will be supplying power. Will it be the LaunchPad or the Target Device? Please don't say both. You will light something on fire if you do. Most likely the Target MSP430 will suffer from the excessive amount of heat you generate in it. Learn from my personal experience!

bluehash likes this

Share this post


Link to post
Share on other sites

Zeke, a great set of posts! I started primarily with Davies' book. As you stated, this is a good source for information on the clock system and, I would add, the MSP430 peripherals. I've downloaded the tutorials and look forward to reading them.

 

I just finished crawling though Tom Baugh's "MSP430 State Machine Programming." I worked through the exercises using an Olimex H2274 header board holding an MSP430F2274 on a breadboard combined with a few parts and a couple of SMT to DIP adapter boards with an RS232 interface chip and a DAC. I used a Launchpad as a Spy-Bi-Wire programmer. A picture of the setup is in the Programmers and Debuggers forum under "Launchpad as external programmer."

 

This book is an interesting introduction to designing software based on state machine models without using an RTOS or a task scheduler of any sort. Lots of functionality can be had in 4K of flash. The book covers both bit-banged and peripheral-based UARTs, fancy button debouncing with stuck button detection, reading and writing flash from within a program, and so on. Definately a step or two beyond the examples in Davies. There is also early on an extensive discussion of machine instruction cycle times and addressing modes.

 

I learned a lot from this book. Its strength is that Baugh shows how to incorporate lots of functionality with an event-driven approach with very low power draw (LMP3) in the idle state. So many resources contain toy programs to illustrate a point or two, while this one shows goes much further into software design using its chosen approach.

 

There are a couple of downsides to this book. First, the reader is assumed to have a decent knowledge of C. Function pointers and structures abound. I played some catch-up here, but was glad to see these used as it increased my C abilities. Next, it is unlikely that a reader will absorb all the ins and outs on state machine programming in a first reading, even after working all the examples. You will need to try programming some of your own projects to "get it." You are exposed to many concepts like callbacks, event sinks, and so on that take time and experience to fully understand. The book would benefit from even more diagrams than it already has in this regard.

 

The book has convinced me that the event-driven state machine approach is a good one, and I'm buying a book UML statecharts that takes this approach, but in a more formal way.

 

Again, Zeke, many thanks for these posts.

 

Andy

zeke likes this

Share this post


Link to post
Share on other sites

You are so right about Tom Baugh's MSP430 State Machine Programming. I bought it at the same time as Davies' book.

 

I used the state machine approach to design and to code on a recent contract. The beauty is that I could complete a paper code design and know at once that it would work. After fixing two cut and paste errors, I had my code running bug free immediately.

 

So, I'm a big fan of state machine style programming. I even started a thread on how to design a state machine over here. I haven't finished it just yet due to work commitments but I'll get to it eventually.

vicvelcro and n1ksn like this

Share this post


Link to post
Share on other sites

Hi Zeke. Thanks for your comments on Baugh's book. I went over to your state machine thread and found it interesting, although I was disappointed to see no responses to it. At the risk of going off-topic, I did have a question on it. I assume that you will be in LPM3 while waiting for a timer ISR to signal a tick?

 

I think you have inspired me to try a 10 minute countdown timer using the state machine approach. Such a timer (which is used in my ham radio shack to remind me to ID every ten minutes as per FCC regulations) was my very first microcontroller project, using a 14-pin PIC. However, that project used a seven segment display (one digit) to count down the minutes and I want to find a one or two digit display that is very low power to keep things in the spirit of the MSP430, but doesn't need an LCD controller module in the MSP430. Or maybe I can use a yellow warning LED with a low duty cycle blink for the last minute, and then the time-out red LED comes on, ....

 

As usual, I blather on. Again thanks for this thread and I hope you find the time to complete your state machine post.

 

Cheers,

Andy

Share this post


Link to post
Share on other sites
I assume that you will be in LPM3 while waiting for a timer ISR to signal a tick?

 

Yup. That's the plan. We can talk more in that thread if you'd like.

 

Again thanks for this thread and I hope you find the time to complete your state machine post.

 

Just need to find some time and inspiration.

 

Thanks for the kind words.

Share this post


Link to post
Share on other sites

If you are new to MSP430, best/simplest/cheapest way to start is with new MSP430f55x series. There is no need for flashing tool, because uC have USB and can be flashed by TI USB BSL tool, without any glue logic. There is no need for development board, because you can build it by yourself (less than 20 parts in total).

 

And why not to start with older series? Check for example MSP430F2232 / MSP430FF5510 from TI slab034 document. For the same price new series give much more. Development board for older series you can build by yourself too (very simple, 5 parts in total), but you also need to buy/build some flashing tool (BSL/JTAG/SBW).

Share this post


Link to post
Share on other sites
If you are new to MSP430, best/simplest/cheapest way to start is with new MSP430f55x series. There is no need for flashing tool, because uC have USB and can be flashed by TI USB BSL tool, without any glue logic. There is no need for development board, because you can build it by yourself (less than 20 parts in total).

 

And why not to start with older series? Check for example MSP430F2232 / MSP430FF5510 from TI slab034 document. For the same price new series give much more. Development board for older series you can build by yourself too (very simple, 5 parts in total), but you also need to buy/build some flashing tool (BSL/JTAG/SBW).

 

I have started using the F5438 experimenter board and it is great! Plenty of RAM and a massive amount of Flash. It would be nice if TI could make a new official (inexpensive) MSP430 launchpad with the F5438A.

 

The only problem I had is that the code between the Value Line and 5-series is not really compatible... interrupts have a different syntax and all the peripheral registers names have changed. Also I would prefer a DIP chip, which isn't available for these.

Share this post


Link to post
Share on other sites

hello fellow noobs. if your eyes are bleeding from reading but your brain is still hungry for more and you have an hour or so to kill i recently found this short series of brief youtube tutorials very easy to watch and quite helpful in getting my head around a few c programming basics, which has been useful when studying code examples.

 

cubeberg, oPossum, bluehash and 1 other like this

Share this post


Link to post
Share on other sites

For entering in USB BSL programming mode, there is no need to disconnect/connect USB cable from/to PC with BSL button pressed every time. USB cable can stay connected, and another entry to USB BSL mode can be done using RESET button. Just press BSL and RESET button together, first release RESET button, and after (1 second is enough) release BSL button.

Share this post


Link to post
Share on other sites

If you have board based on MSP430F5508, but can't download (even) blink led example firmware using TI USB BSL flasher, don't worry. With your board everything is OK. Everything is OK with flasher, too.

 

bsl0.gif

 

TI prepared examples for MSP430F5529, and because of this none of them will work with MSP430F5508 (blink LED example will work with MSP40F5510). If you have XTAL2 with different frequency than one on TI MSP430F5529 evaluation board, USB (CDC/HID) examples will not work with your MSP430F5529, too.

 

So, for the first test just select your firmware (prepared for uC used by you) in TI txt format and flash it. :thumbup:

RobG likes this

Share this post


Link to post
Share on other sites

And here's the information on how to configure your CCS/IAR to create txt file.

BTW, if your project has spaces in its name, you will have to add .txt extension ("My F5510 Project" will produce "My" file in the Debug folder.)

Share this post


Link to post
Share on other sites

While not specific to the MSP430 processors . . .

 

I found http://www.amazon.com/Making-Embedded-Systems-Patterns-Software/dp/1449302149 a very good read so far. 

 

Also http://kjarvel.wordpress.com/2011/10/26/table-driven-state-machine-using-function-pointers-in-c/ is a decent intro into table driven state machines, using function pointers. Do keep in mind that the code as presented is close to functional, but will not compile without some minor additions, or adjustments. See if you can spot the omissions :smile:

 

The author of the arduino PID library I believe wrote a decent article on beginner to commercial grade PID controllers. http://brettbeauregard.com/blog/2011/04/improving-the-beginners-pid-introduction/

 

Also google + general C programming keyword works great for things I am either rusty on, or haven't quite grasped yet. My personal preference is to stick with posts mostly from stackoverflow.com( there are even some MSP430 specific questions / answers here ). Although stuff from The Code project can be very good too.

 

Again, the book, and the links are not MSP430 specific, but are a few sources of information I found useful while trying to wrap my brain around different programming concepts. 

 

Unfortunately for me, I have not found most of the MSP430 related subject matter very useful. So far the users guide for the device im using, and the data sheet while extremely terse have helped me the most. Not to mention this forum, and the fact that the friend I am workign in colaboration with is an excellent electronics engineer ( me being the code monkey .  .) Do realize that most of my programming experience over the last 15 or so years has been OOP in nature, and anything outside of that realm in style makes my head hurt, and eyes bleed. So when I say somethign did not work for me, does not mean it couldnt work for someone else. with that in mind . . .The MSP430 basics book was good up to a point. But being a code snob ( sorry I can not help it ) I find the authors coding style atrocious, and hard to read through because of my own coding style preferences. Coupled with dated material, and code examples written for a different MSP430 than what I am learning on / developing for. I just moved on to different material.

 

EDIT:

 

One thing that *can* be very useful for MSP430 specific subject matter is using google + <keyword> + PDF. There are all kinds of whitepapers, written by various people, and institutions that can be very helpful for topic specific information. As an example just searching for "MSP430 and SPI external memory" I eventually ran into a very interesting white paper written by a college professor from some college ( which I can not remember the name of offhand ). Anyways, perhaps obvious to some, but maybe not to others . . .

Share this post


Link to post
Share on other sites

Hi RichardVowles,

 

I have not read this book personally, but based on the reviews and book description. It seems you would get just as much out of the MSP430 basics book, or possibly even the MSP430 workshop videos from TI.

 

Obviously since I have not read it, I could be wrong. Please let us know what you think if you do end up purchasing it.

Share this post


Link to post
Share on other sites

Hi,

yyrkoon mentioned a book Making Embedded Systems, just because it's publicly accessible I give this link to the pdf here: http://Edit

 

Regards,

tml

Edited by GeekDoc
[ADMIN] - Changed link to Amazon. Original link would probably get the forum in trouble. [Mod] Fixed "edit " URL to Amazon also.
bluehash likes this

Share this post


Link to post
Share on other sites

Yeah, that's probably not a cool thing to do. The author expects payment for her hard work . . .

 

I'd agree if it was torrent or sth like this, but this link is returned on the 7th position of Google Search for serarch string Making Embedded Systems. Anyway, I have no idea how come such site may still openly operate.

Share this post


Link to post
Share on other sites

Well it is up on the web, and torrents do exist for it as well. It is a good book IMHO, at least up to page 98  where I left off to read on other things.

 

I probably should not say too much, as I have been known to "try before you buy" myself. As I get tired of paying good money for garbage.

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