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