Hi, I am having problem in receiving any char using the following code on MSP430-449STK2 board from OLIMEX. This code is as it is taken from example "fet440_usart01_19200" given with IAR. I have been struggling with this since ages.... :-( Any help in this matter willbe appreciated. Regards, -mkh #include <msp430x44x.h> void main(void) { WDTCTL = WDTPW + WDTHOLD; // Stop WDT FLL_CTL0 |= XCAP14PF; // Configure load caps UTCTL0 = SSEL1; // UCLK = SMCLK UBR00 = 0x36; // 1MHz 19200 UBR10 = 0x00; // 1MHz 19200 UMCTL0 = 0x00; // no modulation UCTL0 = CHAR; // 8-bit character *SWRST* ME1 |= UTXE0 + URXE0; // Enable USART0 TXD/RXD IE1 |= URXIE0; // Enable USART0 RX interrupt P2SEL |= 0x30; // P2.4,5 = USART0 TXD/RXD P2DIR |= 0x10; // P2.4 output direction _EINT(); // Enable interrupts for (;;) // { _BIS_SR(CPUOFF); // Enter LPM0 _NOP(); // Required only for C-spy } } interrupt[UART0RX_VECTOR] void usart0_rx (void) { while ((IFG1 & UTXIFG0) == 0); // USART0 TX buffer ready? TXBUF0 = RXBUF0; // RXBUF0 to TXBUF0 }
Problem in Receiving char on MSP430F449
Started by ●April 3, 2005
Reply by ●April 4, 20052005-04-04
mahesh_shobhraj@hotmail.com wrote:> Hi, > I am having problem in receiving any char using the following code on > MSP430-449STK2 board from OLIMEX. > > This code is as it is taken from example "fet440_usart01_19200" given > with IAR. > > I have been struggling with this since ages.... :-( > > Any help in this matter willbe appreciated. >I can't go into it in detail, but how about this for an approach: (1) Take the character echo out of interrupt into a tight loop in main(). That eliminates interrupt snafus. Remember to test for character received etc. (2) Make it flash a LED when it receiuves a character. If it doesn't, the problem is on the receive side (have you selected port alternate functions etc.?) (3) Use a scope to check that the character is getting to the board at all, and if so, if anything at all comes out of the transmit port. Paul Burke