EmbeddedRelated.com
Forums

Help with serial comunication and Servo controller

Started by Ramon February 28, 2012
Hi everyone Im a noob with msp430 and Im having troubles with serial comunication with a pololu maestro servocontroller, I got serial comunnication with an arduino board an it was easy but with the msp430 has been imposible for me.

I dont know where is the problem and i cant get the serial comunication, please If someone can tell me whats wrong with the code I'll be so grateful, thank you.

Beginning Microcontrollers with the MSP430

while the subroutine can be optimized, the following should give you a clue
as to what was wrong...

Hi,

you should look at the 9600 baud UART example code for your chip
provided by TI. Every time you need to send something you have to load
it into the UCA0TXBUF now if you hate typing that you can always do this:



and you should always check if the Tx flag is up on the UART line,if it
is 1 it is ready for the next data if it is 0 it is busy.

Jake G.
Ok I changed the code its look better but its doesnt work



Any other advice?
You need to set UCSWRST in UCA0CTL1 before you initialize any of the other UART register settings. You should probably also initiaklize UCA0CTL0 to make sure you have the correct stop bits, parity and character length (even if it is 8,n,1 which is the power on default)
I think that I set UCSWRST, I wrotein the code:

UCA0CTL1 &= ~UCSWRST;

Is that incorrect? Im sorry but Im a begginer.
Hi,
Now I am not sure on this because TI example code I have seen has done
it both ways, but I usually set it at the start of initialization.

my Uart Init code:
for the MSP430F543xA chip



Jake G
You need the sequence below. The 1st line sets the UCSWRST bit putting the UART in "Setup mode". The last line clears the UCSWRST bit putting the UART in "Operational mode". You need to set the UCSWRST bit first before any other bits can be set, so you cannot combine the 1st and 2nd lines in the example below.

Unless some TI example code is wrong (BLASPHEMY), I think some USCI's
,or whatever the abbreviation is, have the UCSWRST already set as a
default, but like I said before I set it every time just to be safe.

Jake G
That is true, the bit is set after PUC for most of not all of the TI MSP430 parts. I set the bit because my UART init routines are also used for error recovery as well as being safe in case TI changes their minds in the future.