AnsweredAssumed Answered

MQX UART Non-Blocking

Question asked by Scott Morrison on Apr 15, 2016
Latest reply on Apr 19, 2016 by soledad

     Hello, I am using a K60 with MQX.  I am trying to install a second UART driver, in addition to the one used for stdout.  I have set up the port using UART_DRV_Init.  The port works fine if I send data using SendDataPolling, but as soon as I call SendData, the non blocking version, the system hangs.  If I stop the debugger, the code looks like it is in the unhandled interrupt processing section.


Do I have to install my own handler?  Here is the initialization portion of my code, this is happening inside of a thread :


uart_state_t uartState;


uart_user_config_t uartConfig = {
    .bitCountPerChar = kUart8BitsPerChar,
    .parityMode  = kUartParityDisabled,
    .stopBitCount= kUartOneStopBit,
    .baudRate    = BOARD_DEBUG_UART_BAUD




    uint8_t buff[TX_BUFFER_SIZE],respBuf[32],txBuf[128];

    uint32_t count = 0;


    TASK_PARAMS_PTR task_p = (TASK_PARAMS_PTR) param;



    // Initialize the uart module with base address and config structure


    SIM_HAL_EnableClock( SIM , kSimClockGatePortE );

    SIM_HAL_EnableClock( SIM , kSimClockGatePortD );

    SIM_HAL_EnableClock( SIM , kSimClockGatePortA );




    configure_uart_pins( UART5_IDX );


   // Get working uart clock


    UART_DRV_Init(5u , &uartState, &uartConfig);


uartSourceClock = CLOCK_SYS_GetUartFreq( UART5_IDX );


// Initialize UART baud rate, bit count, parity and stop bit


UART_HAL_SetBaudRate(baseAddr, uartSourceClock, BOARD_DEBUG_UART_BAUD);
UART_HAL_SetBitCountPerChar(baseAddr, kUart8BitsPerChar);
UART_HAL_SetParityMode(baseAddr, kUartParityDisabled);



UART_HAL_SetStopBitCount(baseAddr, kUartOneStopBit);



// Enable the UART transmitter and receiver



buff[0] = 'Z';


UART_HAL_SendDataPolling(baseAddr, buff , 1 );



UART_HAL_SendDataPolling(baseAddr, buff, 1 );




   buff[0] = 'Z';


   //UART_HAL_SendDataPolling(baseAddr, buff, 1 );      // This works fine
     UART_DRV_SendData( 5u , buff, 1 );                            // This crashes
     OSA_TimeDelay( 250 );





Any insights or help is appreciated.