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.
Hello fellows,
I'm trying to communicate my launchpad with my serial port PC with HyperTerminal.
Here is what's happening:
Using the example code I can get communication when I select the following settings:
HYPERTERMINAL
@9600 8bits, non-parity, 1stpbit. Flow=none.
Success when set ACLK (UCA0CTL1 |= UCSSEL_1) and UCA0BR0 = 0x03.
But when I try with SMCLK (UCA0TL1 |= UCSSEL_2) and UCA0BR0 = 6 or 104 (as shown on pdf), I've got wrong characters at hyperterminal. Doesn't match with keyboard.
The point is: I NEED to use 38400bps. And with ACLK at 32k, the fastest BR is 9600. So using BR @38400, I've got the same wrong characters.
What is the problem, anybody?
Here is the code:
#include "msp430g2553.h"
void main(void)
{
WDTCTL = WDTPW + WDTHOLD; // Stop WDT
P1DIR = 0xFF; // All P1.x outputs
P1OUT = 0; // All P1.x reset
P2DIR = 0xFF; // All P2.x outputs
P2OUT = 0; // All P2.x reset
P1SEL = BIT1 + BIT2 ; // P1.1 = RXD, P1.2=TXD
P1SEL2= BIT1 + BIT2 ; // P1.1 = RXD, P1.2=TXD
P3DIR = 0xFF; // All P3.x outputs
P3OUT = 0; // All P3.x reset
UCA0CTL1 |= UCSSEL_2; // CLK = SMCLK
UCA0BR0 = 26; // 1MHz/38400
UCA0BR1 = 0x00; //
UCA0MCTL = UCBRS1 + UCBRS0; // Modulation UCBRSx = 3
UCA0CTL1 &= ~UCSWRST; // **Initialize USCI state machine**
IE2 |= UCA0RXIE; // Enable USCI_A0 RX interrupt
__bis_SR_register(LPM3_bits + GIE); // Enter LPM3, interrupts enabled
}
// Echo back RXed character, confirm TX buffer is ready first
#pragma vector=USCIAB0RX_VECTOR
__interrupt void USCI0RX_ISR(void)
{
while (!(IFG2&UCA0TXIFG)); // USCI_A0 TX buffer ready?
UCA0TXBUF = UCA0RXBUF; // TX -> RXed character
}
Thanks everybody!
Any help can be helpful!
Regards
Try to load calibration constant for 1MHz clock right after stopping the watchdog to gain a more precise frequency:
BCSCTL1 = CALBC1_1MHZ;
DCOCTL = CALDCO_1MHZ;
Also, try without modulation (the default at reset, UCA0MCTL=0).
Regards,
Peppe
For UART configuration check http://forum.43oh.com/topic/2640-uart-configurator
Also, USB-UART bridge from TI programming tools is limited to 9600 bps.
Thanks so much! It worked out! I was missing calibration definitions.
Regards,
João
Joao Kohler said:I'm trying to communicate my launchpad with my serial port PC with HyperTerminal.
[...]
The point is: I NEED to use 38400bps.
It doesn't apply here (as you connect to a serial port and therefore use a separate connection), but it should be noted that the LaunchPads internal serial port only supports up to 9600Bd.
you wrote "communicate my LaunchPad woiht my serial port PC". So you're likely connecting the MSP to a real serial PC COM port with a USB/SER converter.Joao Kohler said:I see that. But how come I was able to send and receive with 38400?
Hmmmmmm. Sorry! I was misunderstanding your point. Now I got it!
Even then, I replaced the serial PC with another MPS430 kit, which has MPS430FG438. Now I can simulate my pc software on it and was able to communicate between them. Thanks, for helping me!
Hi, Joao
your mean is you can run uart at baudrate 38400 with SMCLK?
I have the the problem ~~~
can you tell me how you set the configuration?
thanks very much!
**Attention** This is a public forum