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.

MSP430F5438A REV D UART register read problem

Other Parts Discussed in Thread: MSP430F5438A

Hello,

I am working with MSP430F5438A REV D on Experimenters board by TI. I want to do serial communication using USCI_A1 module in polling mode (by checking UCBUSY bit in UCA1STAT register). The baud rate is 9600 with ACLK= 32.768KHz. Here is the code for the the same. My IDE is Code Composer Studio v5.2

#include <msp430f5438a.h>

void main(void)
{
    WDTCTL = WDTPW + WDTHOLD;        // Stop watchdog timer

    P5DIR |= 0x01;                             // Set P1.0 to output direction
    P1DIR |= 0x01;                             // Set P1.0 to output direction
    UCA1CTL1 |= (1<<0);                // reset the UART and hold in logic high state

    UCA1MCTL &= ~(1<<0);            // UCOS16 = 0 for low baud rate
    P5SEL |= (1<<6);                        // P5.6 as TxD
    P5SEL |= (1<<7);                       // P5.7 as RxD

    /* UCA1CTLW0 = 0x4120; */
    UCA1CTL1 |= 0x41;                // clock source for BRclk= ACLK
    UCA1CTL0 |= 0x20;                // parity disable, MSB first, 8bit data, 1 stop bit, UART mode, Asynchronous mode
    UCA1BR0 = 3;                         // for baud rate of 9600 with ACLK=32.768KHz
    UCA1BR1 = 3;
    UCA1IE |= 0x03;                          // transmit and receive interrupt enable

    UCA1CTL1 &= ~(1<<0);            // release USCI for operation
    while(1)
    {
        UCA1TXBUF=65;                 // start transmitting the data
        while(UCA1STAT & 0x01);  // wait for transmit complete
        volatile unsigned int i;         // volatile to prevent optimization

                P1OUT ^= 0x01;           // Toggle P1.0 using exclusive-OR

                i = 10000;            // SW Delay
                do i--;
                while(i != 0);
    }
}

But I am not able to do communication. The program gets stuck at line

while(UCA1STAT & 0x01);

While debugging, in registers window I get error as "Cannot Read the register" which are related to USCI_A1 UART. They are memory mapped registers.In some other forum related to OMAP I read that it can be a problem with GEL file.

Is it so? Or any problem with code? Or any problem with REV D series? What can be the problem?

  • In my firmwares, I always fill the UCA1TXBUF after the while, no before, because that means that any execution are using the UART. That's it:

    while(UCA1STAT & 0x01);  // wait for transmit complete wait until UART is not busy

    UCA1TXBUF=65;                 // start transmitting the data


  • Luis L��pez said:
    In my firmwares, I always fill the UCA1TXBUF after the while, no before, because that means that any execution are using the UART. That's it:

    It will indeed work, but it makes the double-buffering of the USCI worthless, reducing maximum throughput.
    The good thing about the double.buffering is, that you can fetch the next data byte and store it in TXBUF while the previous byte is still being sent. So you get seamless transfer with maximum speed.
    If you read or write SD cards through SPI, this makes the difference between 2MB/s and 0.5MB/s throughput.

**Attention** This is a public forum