This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

pqrst commander code: Sample code for controlling MSP430 ports via the serial UART

Other Parts Discussed in Thread: MSP430F149

I have posted sample working code for controlling the MSP430F149 via the UART using Hyperterminal.  It is the first release of a project that I hope to continue working on.  (I need to take a break to work on some other work projects for now however).  It allows you to password protect the interface and control the port output, input and direction.  The code is written for QUADRAVOX tool and is written on top of Pumpkin's Salvo lite OS.  This is my first post, so I am not sure how you get the files, but I posted them on my profile.  If you would like them and cannot get them, please contact me via this forum or at rsilbert_at_yahoo_.com.  I did not really get to exercise the part I wanted to learn regarding using Pumpkin's Salvo Lite, but I think I have some code pieces that some new developers may find useful.  I wrote a read me file in the package I posted and included here below, that explains the work so far.

Why I did this project.
-----------------------

Up to this point in my career, I have been an embedded systems engineer.  I had started
my career as a hardware design engineer for small battery operated, hand-held voice
recorders and MP3 players.  I then made the move to programming micro-controllers with
the Micro-chip PIC controller and finally the TI MSP430.  So, now I have moved on to
larger systems at a larger company as a test engineer and have been learning how to
work with Linux Operating Systems.  I never programmed any micro-controllers with an
operating system present. I wanted to learn more about programming with operating systems
and new that there were many free operating systems available for the MSP430 which I
was very familiar, so I decided that I would try to mimic Linux on the MSP430.

Doing this project, I was able to learn better programming skills.  Not having been a real
software programmer from the start, I learned how to better use standard C libraries instead
of "re-inventing the wheel" and writing my own routines to accomplish the same result.

I also wanted to allow for changes in code functionality without requiring JTAG.  For small
tasks that a micro-controller sometimes are used for, I thought I would come up with a
way for these small tasks to be accomplished with the resident code and no C code required.
It would be more like a simple script to accomplish the task.

As a result, I would hope that this project would help others trying to get started using
the MSP430 as the code would show how to exercise many parts of the device as well as
running the code with an operating system.  Also, it would be a foundation for builing
upon so that more functionality could be added by myself or another developer.

I looked into many different RTOSs that were available for now cost.  I looked at TinyOS,
FreeRTOS, and Salvo RTOS.  I also looked into using GCC MSP430, IAR, and QuadraVOX tools.
GCC was difficult to use for me and IAR tools I wanted to get working since that comes
free with MSP430 Kickstart package which I have.  I chose MSP430F149 since it was a
processor I was familiar with and the one of the parts I have that has a UART peripheral
on chip.`

The issues I had with IAR tools was that
there was a 4K C code limit with the free version that comes with KickStart from TI.
So, I decided on QuadraVOX, since I own a legal copy of the tools and I am very failiar
with using the tools.  The RTOS I chose was Salvo since it has a release for QuadraVOX.
FreeRTOS had a release for QuadraVOX, but I believe it was not their own.  (This may not be
100% correct since I am writing this several months after I stated this project.)  Salvo
had very good documentation and it was vey easy for me to get started with their basics
for understanding RTOSs and kernels and Application Notes (AN) for getting setup for use
with QuadraVOX.  This project uses Salvo Lite, which is a free version from Pumpkin.
It limits the number of tasks to 3, so if more is needed, an upgrade will be required and
an expense will be incurred.  I set up this project to use two tasks.  The first task is
set to handle all of the serial commands and output to the terminal.  The second task
was setup for any application that would run from memory so that multi-tasking would be
possible for application and serial port.  The third task has been reserved for future use.
It is intended to be used for running a second application.

This project should be easily modified should the OS part of pqrst commander is not desired.

I called this project pqrst commander.  Commander because you can enter commands via the
serial port to control the processor.  The pqrst is for the various parts that make this
project work together:

p=pumkin, the operating system I chose for ther project www.pumkininc.com
q=quadravox, the IDE tools that I own for developing the C code
rs=rob silbert, that is me, the one responsible for ties this project all together
t=TI, Texas Instruments.  The manufacturer of the MSP430 micro-controller.

So what did I learn from this project?  To start off, I had trouble getting simple
printing to the PC terminal program over the UART.  I had to set functions
UARTInitTX() and FlashPortSettings in commander.h in a do/while loop in #define
statement to get it working.  I mimmiced what was shown in the Salvo documentation.
Also,remember to initiallize variables when using static variables required by Salvo.

I found application note AN-18 titled Building a Salvo Application Using Quadravox's
MSP430 Development Tools.  This app notes describes how to properly setup Quadravox
to properly use Salvo libraries and the directories to Salvo files.
This program is running on top of Salvo however, this release does not take advantage
of the Salvo task switching.  That I hope to have implemented in later versions.

Since I started working on this project, I discovered an interesting project on the
web via www.makezine.com at the site www.nootropicdesign.com.  The project called
Toolduino uses a USB connection to an Arduino developement board and with a graphical
interface, allows you to control the port pins with simple mouse clicks as well as
reading port pins.  This type of GUI could also be written to handle comands across
the RS-232 port of the MSP430F149.

Commands that are currently supported in pqrst commander:

cl clears the screen");
ps ps=prompt changes command prompt text
lo logout
v  prints version of commander;
sp#.#=# sets port and bits, sp1.1=1,sp1.1=0
   set whole port, sp1=xff, sp1=255
pr# reads port value pr1, pr6
     prp displays all port values until <ENTER>
pd#.#=# sets port direction, pd1.1=1,pd1.1=0
   set whole port direction, pd1=xff, pd1=255
   output=1, input=0
pm#.#=# set muxed port pins via P#SEL registers
   works as pd command above
su# sets new user. su1 replaces root, su2 for limited permissions
rb reboot pqrst commander
mr memory read, can read any location of ROM
    mr=x1000 will return value in hex at address x1000
    address must be 4 digits long.

lc load config. load config file using config.txt template.

lcp prints the config file.
pl print line. prints textup to 29 chars. ex. pl press <enter>    
?  Prints the abovelist of available commands

I have not yet taken advantage of or actually used the benefits of the Pumpkin OS.  I hope to
release future version that will handle the task switching and learn about using the OS.
Now that I have the basics down for the user interface, I can now focus on the OS programming.

Regards,

Rob Silbert
rsilbert@yahoo.com

The defalt username and password are:
root
password
UART set at 119,200 8-N-1

  • Rob Silbert said:

    ... This is my first post, so I am not sure how you get the files, but I posted them on my profile. ...

    I got the file from your profile. Will look inside later. Thanks.

    When you compose a posting here, if you click the icon that looks like a paper clip, it will let you insert a file inside your posting. This is in the tool bar above where your composing area. The "insert file" paper clip is the second right most icon. (The right most one is HTM, the left most one is B.)

    --OCY

  • OCY,

     

       Thank you for your help and sorry for the delay in my response.  I will add the code here as you suggested.  If you look at the project, let me know your comments.  I hope to continue working on it, but my time is limited due to work and family.  Hopefully early next year I will be able to continue.

     

    Regards,

     

    Rob

  • 8737.pqrst commander v01_00.zip

     

    Attached file above for convenience.

     

    Rob Silbert

**Attention** This is a public forum