SparkFun Forums 

Where electronics enthusiasts find answers.

Discussions on how to get your MSP JTAG programmer up and running.
By Konrad
#19828
G'day,

I'm using an MSP430F169 (first time coding) and an FT232RL connected to the MSPs USART0 port (in UART). I am attempting to get serial comms through the USB port to the MSP.

The issue I'm having: Currently, the code just 'echos' what send it. However, not all ASCII chars echo correctly. If I send a 'd' or 'f' or 'n' or 'm', it will echo that same char. If I send 'a' it will send back a 'y', if I send '0' (zero), it will reply with a '8'. There are more, most numbers I send come back as symbols, other chars send back symbols as well. lower and upper case characters are effected equally. i.e. 'a' and 'A' are both effected, but 'd' and 'D' are not.

I have tried changing clocks (using ACLK at 8MHz and tried MCLK), tried USART1, changing intitalisation parameters (extra stop bit, 7 or 8 bit char, etc etc), faster and slow baud rates, tried inverting the output of FT232RL and anything else I can think of.

UART0 intialisation (I have another version which does pretty much the same thing):
// Enable module
ME1 |= (UTXE0);
// Reset UART
U0CTL = (CHAR);
U0TCTL = (TXEPT+UTCTL_ACLK);
// Setup 2400 baud with ACLK
U0BR0 = 0x0D;
U0BR1 = 0x05;
U0MCTL = 0x6B;
// Set Tx Flag
IFG1 |= (UTXIFG0);
// Enable module pin functions
P3SEL |= (BIT5);
// Enable module
ME1 |= UTXE0 + URXE0;
// Reset UART
U0RCTL = (URXEIE);
IE1 |= (URXIE0);

UART0 RX interrupt service routine:
#pragma vector=UART0RX_VECTOR
__interrupt void UART0RX (void)
{
TXBUF0 = RXBUF0;
}

Also, another problem I'm having:
How do you write code to just transmit chars through the UART? I haven't been able to find any code to learn from.

All I want to do, is say transmit the string: "abcde". Either one char at a time or all at once. How do you do it?

Thanks for any help in advance!

Cheers,
Matt
By Konrad
#19829
Sorry, I forgot to add. I'm also using hyperterminal to send and receive the characters. It's baud rate and other parameters are matched with the MSP code.
By jbwork
#21058
USB to serial adapters are not a drop in replacement for actual serial ports. I have had multiple problems with applications failing when using them. It seems like the buffering does not work properly.
In addition, Hyperterminal seems problematic. I would suggest using TeraTerm, a freeware terminal program.

As far as echoed characters, try the following link.
http://msp430.info/modules.php?name=Gadgets&op=uart for recommended settings for buad rate vs clock.

Also check your parity settings, word length etc.
You should also note that while TI shows 8Mhz, you can't regulate the supply well enough to ensure proper operation.

I notice you are not resetting the uart bu setting SWRST to 1 before init and clearing it after init.

Hope this helps,
Jim
By sans
#50145
Have you found any solution which echos characters/string ?
By gm
#50160
Matt,

There are several things wrong with your code but it is difficult to tell you how to set it up without knowing how your basic clocks are configured. You will need to have an external crystal to have the stability to reliably use the uart's. What does your clock setup code look like?

gm
By sans
#50376
I used this code for msp430f1611. But, it doesn't work. Please let me know if you have found any solution for echoing characters/strings. Even, I am using hyperterminal for tx and rx.
By OldCow
#50459
Mat,

I think you did not set the baud divider correctly.
I think the MSB of the divider should go to BR1 and the LSB to BR0.
You got them backwards.
The fractional part of the divider should be converted to a pattern and goes to MCTL. I think you did not convert it right either. But this is not critical