Quantcast
Channel: MSP low-power microcontroller forum - Recent Threads
Viewing all articles
Browse latest Browse all 22232

MSP430F5438A: The Serial port UCA0 receive interrupt is not firing.

$
0
0

Part Number:MSP430F5438A

I have an unusual problem with the MSP430 UCA0 receive interrupt.  

I don't think this is a newbie problem, as this is the 7th device driver with ISRs I've written in this project.

Here are the symptoms, another processor (connected to its own console) writes the letter 'a' to the UCA0 Rx (port 3.5).  I can see the character on my oscilloscope when I probe pin 40 (port 3.5).

However, I don't hit the following breakpoint:

Also, looking at the data structures, it didn't receive the byte.

So if I pause the application, and look at the registers, I see this:

Note that UCA0RXBUF has received my 'a' (0x61).  That's good!

And it is complete (UCRXIFG is 1).  And Receive interrupts are enabled (UCRXIE is 1).  Elsewhere, I can see SR.GIE is 1.

But no Interrupt fires.

However, I knew interrupts in general work, because the data path in the other direction work fine.  That is, a string "hello world" is sent to transmit out UCA0_Tx, advancing through the string with interrupts, and that works fine. (also verified on my oscilloscope).  So UCA0 Transmit interrupts work fine. The linkage to this ISR routine is through the project cfg file here:

As you can see, I am using TI-RTOS because there is substantial concurrency.  Also, I am trying to use the DriverLib abstraction to all the low-level calls, because it improves readability, and I assume the project will be ported to a different processor (an MSP432).

Please examine my interrupt routine and tell me if there is an obvious flaw.   I will also list the INIT code below, as that is often relevant.

/**
 *  @brief      initialize the UCA0 serial UART
 */
void uart_UCA0_init(void) {

    // initialize the UCA0 UART

    // select UART peripheral module function
    GPIO_setAsPeripheralModuleFunctionInputPin( GPIO_PORT_P3, BIT5 /* UCA0_RX */);
    GPIO_setAsPeripheralModuleFunctionOutputPin(GPIO_PORT_P3, BIT4 /* UCA0_TX */);

    USCI_A_UART_initParam param = { 0 };

    param.selectClockSource = USCI_A_UART_CLOCKSOURCE_SMCLK;
    // BAUD Rate ... see slau208q.pdf, p.954,
    //     Table 36-5. Commonly Used Baud Rates, Settings, and Errors, UCOS16 = 1
    // SMCLK is 12Mhz, UART baud rate is 19200
    param.clockPrescalar = 39;
    param.firstModReg = 1;
    param.secondModReg = 0;
    param.parity = USCI_A_UART_NO_PARITY;
    param.msborLsbFirst = USCI_A_UART_LSB_FIRST;
    param.numberofStopBits = USCI_A_UART_ONE_STOP_BIT;
    param.uartMode = USCI_A_UART_MODE;
    param.overSampling = USCI_A_UART_OVERSAMPLING_BAUDRATE_GENERATION;

    bool rc = USCI_A_UART_init(USCI_A0_BASE, &param);
    assert(rc == STATUS_SUCCESS);

    UCA0STAT = 0;           // clear any error status

    // Enable USCI_UART module for operation
    USCI_A_UART_enable(USCI_A0_BASE);

    // Clear and Enable Rx interrupt
    USCI_A_UART_clearInterrupt(USCI_A0_BASE, USCI_A_UART_RECEIVE_INTERRUPT);
    USCI_A_UART_enableInterrupt(USCI_A0_BASE, USCI_A_UART_RECEIVE_INTERRUPT);

    // Disable Tx interrupt, until transmission bytes are queued
    USCI_A_UART_disableInterrupt(USCI_A0_BASE, USCI_A_UART_TRANSMIT_INTERRUPT);
}

Thanks, in advance, for any advice.

-allan schwartz, CodeValue Ltd., Haifa Israel


Viewing all articles
Browse latest Browse all 22232


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>