Hi!
I am trying to get the TX/RX echo example program to work on an Olimex Easyweb II MSP430 starter kit. I am able to receive character on the host PC using HyperTerminal to monitor the serial connection (TX on embedded microcontroller). However, it does not receive any characters sent from the terminal program, and I am just about out of options on how to debug this problem. Anyone that could provide any help? I post my code (small changes from TI example to adapt to other oscillator frequency).
Thanks, regards
/Nicemark
#include
void main(void) { unsigned int i; WDTCTL = WDTPW + WDTHOLD; // Stop WDT P3SEL |= 0x30; // P3.4,5 = USART0 TXD/RXD P3DIR &= ~0x20; // set bit 5 to low = input P3DIR |= 0x10; // set bit 4 to high = output BCSCTL1 |= XTS; // ACLK = LFXT1 = HF XTAL
do { IFG1 &= ~OFIFG; // Clear OSCFault flag for (i = 0xFF; i > 0; i--); // Time for flag to set } while ((IFG1 & OFIFG)); // OSCFault flag still set?
BCSCTL2 |= SELM_3; // MCLK = LFXT1 (safe) ME1 |= UTXE0 + URXE0; // Enable USART0 TXD/RXD UCTL0 |= CHAR; // 8-bit character UTCTL0 |= SSEL0; // UCLK = ACLK UBR00 = 0x41; // 8Mhz/9600 = 0x341 UBR10 = 0x03; // UMCTL0 = 0x00; // no modulation UCTL0 &= ~SWRST; // Initialize USART state machine IE1 |= URXIE0; // Enable USART0 RX interrupt
TXBUF0 = 'x';
_BIS_SR(LPM0_bits + GIE); // Enter LPM0 w/ interrupt }
#pragma vector=UART0RX_VECTOR __interrupt void usart0_rx (void) { while (!(IFG1 & UTXIFG0)); // USART0 TX buffer ready? TXBUF0 = RXBUF0; // RXBUF0 to TXBUF0 }