Jump to content
Forum sending old emails Read more... ×
zeke

Best information for those new to the MSP430?

Recommended Posts

Hi,

yyrkoon mentioned a book Making Embedded Systems

I looked at this book last night.  I think it is pretty good, overall, and the emphasis on state machines is very important.  On MSP430 especially, which only has a global interrupt, state-machines are the best vehicle for implementing most types of event-driven features.  Even on more sophisticated cores like Cortex-M -- or even device drivers on desktop OS -- you never really get away from state machines.  

 

Anyway, MSP430's architects went to extra lengths to emphasize state machines.  One somewhat unique feature of MSP430 is the "Interrupt Vector" (IV) register that most peripherals have, which nicely fits-into a state machine architecture.

 

One area of the book I disagree-with strongly is the idea that optimization should be an afterthought.  This is how snowballs turn-into avalanches, which is a bigger problem in embedded than it is in desktop software.  I can't tell you how many times I've seen a product get hamstrung because it was built on a mountain of legacy code that had not been sufficiently optimized at each product release stage.  In my experience, you need to constantly optimize.  Marketing managers rarely accept that you need 2 extra months to fix the problems of the last release, when building the next release.  On this recommendation alone, I wouldn't hire the author.

Share this post


Link to post
Share on other sites

Does any one have any suggestions for a complete beginner. I am 12 years old and I only know some basic python and a little bit of objective-c. Almost all of these resources assume you know something already.

Share this post


Link to post
Share on other sites

Does any one have any suggestions for a complete beginner. I am 12 years old and I only know some basic python and a little bit of objective-c. Almost all of these resources assume you know something already.

The best way to start learning is by doing. Of course you have to read too, to figure various things out as you go.

 

But start off by setting yourself a single goal. Lets say echoing characters back into a terminal app from the launchpad.. This will require you to learn about the UART on the launchpad v1.5, and various things such as how to use a teminal app, set it up properly for use with the launchpad.

 

That is just an example though, you can start off anywhere you like. But for for starters, keep things simple, and perhaps do the things that interest you most. Later, you'll decide you need more functionality for what ever reasons, and then you can expand on previous ideas.

 

It would probably be a good idea to check out the 1 day launchpad workshop, which will walk you through everything you need to know to get started. Take your time, do everything the guys say, such as downloading the workbook, users guide/datasheet, PDF, and reading through the header files. Plus the videos can be quite informative too, plus are downloadable.

Share this post


Link to post
Share on other sites

I looked at this book last night.  I think it is pretty good, overall, and the emphasis on state machines is very important.  On MSP430 especially, which only has a global interrupt, state-machines are the best vehicle for implementing most types of event-driven features.  Even on more sophisticated cores like Cortex-M -- or even device drivers on desktop OS -- you never really get away from state machines.  

 

Anyway, MSP430's architects went to extra lengths to emphasize state machines.  One somewhat unique feature of MSP430 is the "Interrupt Vector" (IV) register that most peripherals have, which nicely fits-into a state machine architecture.

 

One area of the book I disagree-with strongly is the idea that optimization should be an afterthought.  This is how snowballs turn-into avalanches, which is a bigger problem in embedded than it is in desktop software.  I can't tell you how many times I've seen a product get hamstrung because it was built on a mountain of legacy code that had not been sufficiently optimized at each product release stage.  In my experience, you need to constantly optimize.  Marketing managers rarely accept that you need 2 extra months to fix the problems of the last release, when building the next release.  On this recommendation alone, I wouldn't hire the author.

Optimization as an afterthought is not what I got out of this book so far. Thing is though, with any bit of information such as this, we being individuals do things differently. As such, we do not have to agree with any single idea in any book. This book is meant mainly for intermediate to advanced programmers, as such, the readers should have already established their own style, and programming methodologies. But perhaps do not know microcontrollers well, or are looking for ideas concerning design patterns where microcontrollers are involved.

 

In the end, no code is ever perfect from the start. Ever. So with this in mind, the message I get out of that one single statement would be "worry less about perfecting your code from the start, and focus more on the task at hand." Unless you think that the existing libraries you've been writing / have written for yourself, for various things are already perfect. But, the idea of re-factoring as I understand it it to make the code better, without breaking the actual usage. e.g. the code is used in exactly the same way, but has somehow been changed internally, for the better.

 

So with all that in mind, I think you make a very strong case of why small portable(modular) code is nearly a must. A whole project might be large, but that does not mean your methods need to be 500 lines long, or that non related code needs to be grouped in the same file.

Share this post


Link to post
Share on other sites

What do you mean by "echoing" characters back into a termnial?

I mean, when you press a certain key, the launchpad would print the corresponding key back into the terminal app. Without code to deal with this, when you press a key, nothing will happen.

Share this post


Link to post
Share on other sites

Does any one have any suggestions for a complete beginner. I am 12 years old and I only know some basic python and a little bit of objective-c. Almost all of these resources assume you know something already.

Do you have Energia for Launchpad?  That's probably the best starting point.

Share this post


Link to post
Share on other sites

Thanks! I'll look at those both. Since I am 12 years old, I don't have a company nora  university email. How would I order samples from TI since they require you to have a company or University email.

Share this post


Link to post
Share on other sites

Well, izdane, I am in my 40's and only slightly ahead of you when it comes to microcontrollers. I am fluent in analog (but not digital) devices and had 2 classes in "C" back in 1993. The "C" used today looks absolutely nothing like the "C" I used to see. Unfortunately, my professors were the type that would say "do this, convince yourself it is true, and move along to the next example" without ever explaining anything. I still can't figure out what a preprocessor is nor a function (I've seen them, I know one when I see it, but I don't truly know what it is I am looking at). Everything I look up seems to assume I already have a complete background education of the topic.

 

If you like, I can provide you an email address from my company, that you may use. But, to be quasi-official, there should be some connection between you and my company. Send a private message to me if you like, and maybe I can label you an intern or a consultant or something. I'll even send you some goodies for the MSP430 (and an MSP430 if you need one), if your parents are OK with me having your address so I can ship to you.

 

Anyone who can point me (and possibly izdane) to the location of information that a true beginner can start from, we would very much appreciate it. Cut-and-Paste and decipher afterward is getting a bit tedious. I would prefer to know what I am coding before I code it.

 

I confess that I already understand bits and pieces. I didn't pick them up in linear order, though. I'm missing several bits and pieces plus the glue to hold it all together.

Share this post


Link to post
Share on other sites

vicvelcro, there are tons of tutorials concerning C/C++, and ASM on the web. But the best way to learn really is by doing.

 

But here is a link I just found  6 Free E-Books on C and C++

 

Thinking in C++ by Bruce Eckel is an excellent book, especially considering its free. He also has a book named "Thinking in C" Which as I recall is an audio book wrapped in a local web type "interface". He has several good books on his MindView (dot com ?) webpages.

 

Lots of people also swear by K&R, but I have not read that series of books. There is like 4 volumes as I recall.

 

Again, much of your learning is going to come from doing. However you need to motivate yourself in order to do so. For me, how I do this is read examples on the web, or in a book, and adapt the basic concept to my own usage.  Also, keep in mind you're going to change a lot as you learn, so do not be disappointed as you realize that some code you've written before is not as useful, or as good as you originally thought( as you progress ). This is normal, and is something even experienced programmers go through, as they pick up new knowledge. Just keep at it, change as you learn, and in the end you'll become much better over time.

 

Do everyone including yourself a favor however. Stay away from languages like Java, C#, VB.NET, and perl for a while. You'll probably know when it is time to use one of these languages, when the time comes. They're not exactly bad languages really, but the usage of, and teaching of these types of languages, tend to promote bad habits for a beginning programmer.  Basically, anything scripting language like ( except maybe python ), interpreted,, or obscure languages( ADA comes to mind ) are good things to stay away from for a while.

 

C would probably be the best place to start. Or ASM if you can stomach the syntax(many can not ). ASM is probably the best place to start, from an overall understanding of how code really works on a low level. But again, reading through, and learning ASM can be quite terse at times.

 

If you have any further questions feel free to ask away :smile: Also try searching amazon for book based on a given language. note the ones with high reviews, and then read the reviews to see if the reviews jibe with how you feel. If you think you might like the book, go to the nearst B&N, sit down with a cup of coffee, and read a bit of it, if its in stock.

Share this post


Link to post
Share on other sites

yyrkoon,

 

Thanks for the suggestions. I appreciate your advice regarding which languages to avoid, early on. My understanding, so far, supports that advice. Specifically, not to start with Java as a learning tool. I have the direct link to Mr. Eckel's book (well, audio visual seminar) that you mentioned. I appreciate you pointing it out. The home page is here, and looks like it may have a lot of other useful tids and bits.

 

About a year ago, I decided it was time to learn something new. Something to compliment what I already know and something that suits my personal character. MICROCONTROLLERS!

 

In my attempt to gather some material and base knowledge before buying the gear, I determined that the only way forward was to buy the gear and get my hands dirty (Stellaris, MSP430, Wolverine with FRAM, Arduino R3 and Mega, wireless modules, darlington pairs, H bridges, boost/buck converters, and more) . I've bought a lot of it, and decided to take 'the dive' in the last week of August 2012. I've been making forward progress, so far, doing mostly what you suggested above. However, this leaves some holes between one thing learned and another thing learned.

 

I mentioned preprocessor directives and functions in my previous post. Those are two good examples of holes - due to hands-on-learning without adequate reference material to study or use as a guide. Watchdogs, interrupts, and other such things are vague to me - I think mostly due to those terms being used differently by different groups of people. Day Care professionals use the term 'interrupt' differently than Programmers, it seems. Likewise, 'watchdog' has two different meanings - depending on whether we ask a Security Guard or a Programmer. A glossary would be useful. Short definitions of how these terms are used for programming, and possibly links to more detailed examples with tutorials.

 

My independent attempts to use google, wikipedia, and some online "C" tutorials (and even full blown lessons) has led me to conclude that most people who want to help don't quite realize where the 'beginning' is. Everyplace I have found (I'm sure there's better places but I haven't found them by chance yet) assumes I already know what #include is, why it is used, and when to #incude what and to what purpose. So, I #include Servo.h and know that I must do so when using a servo because it does for me what I don't quite know how to do myself at this time.

 

I have gone through the "Getting Started" lessons for MSP430, but it starts in the middle instead of at the beginning. No mention of 'prerequisite knowledge or experience' to warn us that there are things we should already know before we proceed with "Getting Started". I did learn a few things from it, though. Mainly, that there is an assumption that beginners already have some level of background in digital components and prior experience with some other programming language. It should not be titled "Getting Started", as that is a bit misleading.

 

Up until recently, I've been an 'analog man'. Shift registers and real time clocks were those little black boxes with spidery legs on the outside and magic inside. I am gradually making the change, and happier for it. I can't say there has been a complete lack of frustration in the process, though.

 

I've finished quite a few simple projects I devised, as practice and learning experiments. Here is one and here is another. Believe it or not, the second one was featured on Instructables. I don't doubt that the 'code' could be greatly improved. I wanted to use the crystal I soldered onto one of the launchpads for timing the RGB LED, but haven't yet figured out how to implement it. I also wanted to use the real-time-clock I purchased, but it seems that isn't as simple as I expected it would be. It might be a while before I know the things I need to know before I can get that far.

 

This site and the posts made by members of the forum have been more helpful to me than any other place I have wandered during my safari to learn.

 

Thank you, to everyone here and to the people who have provided Energia.

Share this post


Link to post
Share on other sites

I have gone through the "Getting Started" lessons for MSP430, but it starts in the middle instead of at the beginning. No mention of 'prerequisite knowledge or experience' to warn us that there are things we should already know before we proceed with "Getting Started". I did learn a few things from it, though. Mainly, that there is an assumption that beginners already have some level of background in digital components and prior experience with some other programming language. It should not be titled "Getting Started", as that is a bit misleading.

There is no beginning. One starts where ever they are. Can one use a computer running Linux or Windows? Can one plug in a cable without directions? Can one program in any computer language? There are far too many prerequisites to have a true beginning. I find there is so much to learn I often don't pick up many of the subtleties offered in a particular lesson. Doing them again can lead to new insights as I grow in understanding of the material presented.

Share this post


Link to post
Share on other sites

vicvelcro, you would probably be better off programming on the PC for a little while. If you're running Windows, pick up an IDE like Pelles C, or code::blocks. 

 

Another thing, there are people who have series of programming tutorials on youtube. Bucky's C++ tutorials are pretty good from a beginners standpoint, or even an experienced programmer, who has no C++ experience or needs to freshen up on a topic or two. Just keep in mind, that he does not really teach proper coding technique, at least from my own beliefs. C++ may also not be the proper place to start, even if you plan on using it as a language later on. Many people think in order to understand C++ properly, you should at least spend some time in C first. I am among those people.

 

Anyway, give me a little while and I'll see if i cant briefly "review" some youtube videos. 

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

×