Quantcast
Channel: MSP430 Technical Forums
Viewing all articles
Browse latest Browse all 2077

Strange baud rate issue (MSP430G2553)

$
0
0

I am currently working on a project that is transferring data to a host computer via UART. Standard baud rate is 9600bps, UART is clocked with SMCLK 8MHz (using calibrated DCO values). I am not using the launchpad, the MSP430 is connected to the computer by a Prolific serial to USB converter. So far so good.

 

To speed up the data transfer I implemented the feature to increase the baud rate by a command send from the computer. Target idea was to change from 9600 to 38400. It did not work, the MSP430 changed the baud rate but the PC could not identify the characters (I changed the baud rate on the PC as well). I changed the UART settings to 19200bps and it worked. Back to 38400, same problem. Double checking the settings revealed nothing.

 

The suggested settings for 38400Bps are:

UCA0BR0 = 0xD0

UCA0BR1 = 0x00

UCA0MCTL = 0x03

 

I then added some test code (see below) that looped the UART settings, varying the modulator value since this caused significant distortion at an other issue.

 

It turned out that every time the modulator value has an even number 2, 4, 6, 8 the 38400 setting is working correctly.

 

What can be the reason why the recommended modulator setting is not working?

for (i=0; i<16; i++)
{
 IE2 &= ~UCA0RXIE;
 IE2 &= ~UCA0TXIE;

 UCA0CTL1 |= UCSWRST;						// UART state machine Reset
 UCA0CTL1 |= UCSSEL_2;						// SMCLK

 UCA0BR0 = 0xD0; //0xD0;					// 8 MHz, 38400 Bps
 UCA0BR1 = 0x00; //0x00;					// 8 MHz, 38400 Bps
 UCA0MCTL = i;   //0x03;					// 8 MHz, 38400 Bps
 UCA0CTL1 &= ~UCSWRST;						// UART state machine

 IE2 |= UCA0RXIE + UCA0TXIE;
 tempChar=i+48;
 transmitByte_UART(tempChar);
 transmitBytes_UART ("\r\n", 2);
}

Viewing all articles
Browse latest Browse all 2077

Trending Articles