MSPM0C1104: Uart Reciever Interupt handler does not get called

Part Number: MSPM0C1104
Other Parts Discussed in Thread: SYSCONFIG

Tool/software:

Hello Together,

i have just started developing on the MSPM0C1104 (using the SDK and CCS 20.2.0) and encountered a problem with the UART communication.

I am using the MSPM0C1104 as Uart reciever. I checked the bussignal with Osziloscope and the transfared data is looking good.

I was debuging with a breakpoint at the UART_0_INST_IRQHandler(void) and it never gets called although the data that is transfered is valid.

The Uart configuration is similar on sender and receiver.

Did i missed a register setting?

my code:

uart_receiver.c:

#include "uart_receiver.h"
#include "ti_msp_dl_config.h"

static void (*uart_rx_callback)(uint8_t, uint32_t) = 0;
static uint8_t uart_rx_buffer[4];
static uint8_t uart_rx_index = 0;

void uart_receiver_init(void) {
    // RX interrupt already configured in ti_msp_dl_config.c
    // Enable NVIC interrupt
    NVIC_EnableIRQ(UART_0_INST_INT_IRQN);
}

void uart_set_rx_callback(void (*callback)(uint8_t, uint32_t)) {
    uart_rx_callback = callback;
}

// UART interrupt handler
void UART_0_INST_IRQHandler(void) {
    uint32_t status = DL_UART_Main_getPendingInterrupt(UART_0_INST);

    if (status & DL_UART_MAIN_INTERRUPT_RX) {
        uint8_t byte = DL_UART_Main_receiveData(UART_0_INST);
        uart_rx_buffer[uart_rx_index++] = byte;
        
        if (uart_rx_index == 4) {
            uint8_t action = uart_rx_buffer[0];
            uint32_t check = ((uint32_t)uart_rx_buffer[1] << 16) |
                             ((uint32_t)uart_rx_buffer[2] << 8)  |
                             ((uint32_t)uart_rx_buffer[3]);

            if (uart_rx_callback) {
                uart_rx_callback(action, check);
            }
            uart_rx_index = 0; // Reset for next message
        }
        DL_UART_Main_clearInterruptStatus(UART_0_INST, DL_UART_MAIN_INTERRUPT_RX);
    }
}

 

main:

void handle_uart_message(uint8_t action, uint32_t check) {

    if ((check > check_comparator) && (check < (check_comparator + 5)) ) {
        switch (action) {
            case 0: Motor_Open();
            case 1: Motor_Close();
            case 2: Motor_OpenThenClose();
        }
    }
}
int main(void)
{
 
    SYSCFG_DL_init();
    Motor_init();
   
    uart_set_rx_callback(handle_uart_message);
    uart_receiver_init();
   
    while (1) {
       __WFI();
    }
}
ti_msp_dl_config.c:
static const DL_UART_Main_ClockConfig gUART_0ClockConfig = {
    .clockSel    = DL_UART_MAIN_CLOCK_BUSCLK,
    .divideRatio = DL_UART_MAIN_CLOCK_DIVIDE_RATIO_1
};

static const DL_UART_Main_Config gUART_0Config = {
    .mode        = DL_UART_MAIN_MODE_NORMAL,
    .direction   = DL_UART_MAIN_DIRECTION_RX,
    .flowControl = DL_UART_MAIN_FLOW_CONTROL_NONE,
    .parity      = DL_UART_MAIN_PARITY_NONE,
    .wordLength  = DL_UART_MAIN_WORD_LENGTH_8_BITS,
    .stopBits    = DL_UART_MAIN_STOP_BITS_ONE
};

SYSCONFIG_WEAK void SYSCFG_DL_UART_0_init(void)
{
    DL_UART_Main_setClockConfig(UART_0_INST, (DL_UART_Main_ClockConfig *) &gUART_0ClockConfig);

    DL_UART_Main_init(UART_0_INST, (DL_UART_Main_Config *) &gUART_0Config);
    /*
     * Configure baud rate by setting oversampling and baud rate divisors.
     *  Target baud rate: 38400
     *  Actual baud rate: 38400
     */
    DL_UART_Main_setOversampling(UART_0_INST, DL_UART_OVERSAMPLING_RATE_16X);
    DL_UART_Main_setBaudRateDivisor(UART_0_INST, UART_0_IBRD_24_MHZ_38400_BAUD, UART_0_FBRD_24_MHZ_38400_BAUD);


    /* Configure Interrupts */
    DL_UART_Main_enableInterrupt(UART_0_INST,
                                 DL_UART_MAIN_INTERRUPT_RX);
    /* Setting the Interrupt Priority */
    NVIC_SetPriority(UART_0_INST_INT_IRQN, 2);

    /* Configure FIFOs */
    DL_UART_Main_enableFIFOs(UART_0_INST);
    DL_UART_Main_setRXFIFOThreshold(UART_0_INST, DL_UART_RX_FIFO_LEVEL_FULL);

    DL_UART_Main_enable(UART_0_INST);
}
If wanted i can share the whole projekt.
Thanks in advance for the support.
  • Hello David,

    I saw that the FIFO threshold is "full", It means when there are 4 bytes in RX FIFO, after that the RX interrupt will be triggered. Maybe you can try to set the threshod as >= 1 entry

    best Regards

    Janz Bai