1. This forum section is a read-only archive which contains old newsgroup posts. If you wish to post a query, please do so in one of our main forum sections (here). This way you will get a faster, better response from the members on Motherboard Point.

Problem in Receiving char on MSP430F449

Discussion in 'Embedded' started by mahesh_shobhraj, Apr 3, 2005.

  1. 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
    }
     
    mahesh_shobhraj, Apr 3, 2005
    #1
    1. Advertisements

  2. mahesh_shobhraj

    Paul Burke Guest

    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
     
    Paul Burke, Apr 4, 2005
    #2
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.