Roosbeh Almasi

Kinetis SDK UART Driver (MQX)

Discussion created by Roosbeh Almasi on Sep 14, 2017
Latest reply on Sep 23, 2017 by Roosbeh Almasi

Hi everybody 

I used to use this set of drivers (UART drivers) for my application and it was working fine. basically, it was working very nice off the shelf.  however, I have been running into trouble recently. the UART_DRV_SendDataBlocking()  function after transmitting the data it wont return. I debug the the code and realised that the code will mess up where it calls the OSA_SemaPost(&uartState->txIrqSync);

which is done inside the interrupt service routine. I am not sure how this semaphore posting is done behind sense but all I realised is that somewhere a long line the software goes into idle task and runs there for ever.  basically semaphorePost function never returns anything.  

the code is very simple as following:

 

----------------------------------------------------------

uart_state_t uartStatee;

uart_user_config_t  uartConfigg = {
                 .bitCountPerChar = kUart8BitsPerChar,
                .parityMode = kUartParityDisabled,
                .stopBitCount = kUartOneStopBit,
                .baudRate = 9600
};

 

 

int main()

{

 

   UART_DRV_Init(4, &uartStatee, &uartConfigg);   // initialise the uart module
    configure_uart_pins(UART4_IDX);                      // initialise the pins for the uart module

 

   while(1)

    {

         UART_DRV_SendDataBlocking(4, "this is a string\r\n", strlen("this is a string\r\n"), 100);

     }

 

}

 

// uart isr 

void UART4_RX_TX_IRQHandler(void)    
{
    UART_DRV_IRQHandler(4);
}

--------------------------------------------------------------------------------------

the code is as simple as written above

Note1 : non-blocking function is still working fine. however, if I don't put any delay after calling the non-blocking function that will screw up everything. it prints off rubbish. it was not like this at all.    

Note 2 : my micro runs mqx os though. KSDK Mqx

Note 3: the semaphore seems to be working for other modules well. it is only happening with UART driver.  

 

 

any help! I am very thankful in advance 

Outcomes