AnsweredAssumed Answered

UART4 interrupt handler on K24

Question asked by Ryan Lush on Feb 13, 2018
Latest reply on Feb 14, 2018 by Ryan Lush

I've setup my UART like so. Notice most of the interrupts are commented out.

 

   // Configure the UART
    UART_GetDefaultConfig(&config);
    config.baudRate_Bps = 9600;
    config.enableTx = true;
    config.enableRx = true;
    UART_Init(UART4, &config, 120000000);

 

    // Enable RX interrupt.
    UART_EnableInterrupts(UART4, kUART_RxDataRegFullInterruptEnable /* |
                                    kUART_NoiseErrorInterruptEnable |
                                  kUART_FramingErrorInterruptEnable |
                                   kUART_ParityErrorInterruptEnable */ );
    EnableIRQ(UART4_RX_TX_IRQn);

 

and here is my handler

 

static void GPS_UART_ISR(void)
{
    uint8_t statReg = UART_GetStatusFlags(UART4); /* Read status register */
    uint8_t data; /* Temporary variable for data */

 

    /* Is any error flag set? */
    if(statReg & (kUART_NoiseErrorFlag | kUART_RxOverrunFlag | kUART_FramingErrorFlag | kUART_ParityErrorFlag))
    {
        data = UART_ReadByte(UART4);
    }
    else if(statReg & kUART_RxDataRegFullFlag)
    {
        data = UART_ReadByte(UART4);
        if (gpsMode == 0)
            HandleBootData(data);
        else
            HandleNMEAData(data);
    }
}

 

I'm feeding it a near perfect (104.4us bit width) 9600 baud signal yet all I catch is errors. Every error flag is set when I enter the handler. Am I doing something wrong? I've been using this handler for a couple years now with no issue.

Outcomes