AnsweredAssumed Answered

Multiple tasks using single UART0 device not working S32K144

Question asked by Mohan kumar on Oct 30, 2017
Latest reply on Oct 31, 2017 by Mohan kumar

Hi,

 

I have 2 tasks scheduled in freeRTOS. Both of them using same uart 0 device for transmit and receive.

 

Code snippet:

xTaskCreate( Task1, "X", configMINIMAL_STACK_SIZE, NULL, TASK_PRIORITY, NULL );
xTaskCreate( Task2, "Y", configMINIMAL_STACK_SIZE, NULL, TASK_PRIORITY, NULL );

 

/*Task1 receives the request from processor ABC and sends the response back from S32K144 over UART0*/

Task1() 

{

   while(1)

   {

      LPUART_DRV_ReceiveData(UART0, &buffer[count], 1);
      while(LPUART_DRV_GetReceiveStatus(UART0, &bytesRemain) != STATUS_SUCCESS);

      -

      -

      -

      LPUART_DRV_SendData(UART0, buffer, count);
      while(LPUART_DRV_GetTransmitStatus(UART0, &bytesRemain) != STATUS_SUCCESS);

   }

}

 

/*Task2 sends the event from S32K144 over UART0 to processor ABC and waits for the aknowledgement*/

Task2()

{

   while(1)

   {

 

      Send some event over UART0.

      -

      -

      -

       LPUART_DRV_ReceiveData(UART0, &buffer[count], 1);
      while(LPUART_DRV_GetReceiveStatus(UART0, &bytesRemain) != STATUS_SUCCESS)  

   }

}

 

When I run single task, receive and transmit works properly.

However when I run both the tasks, Task2 is never receiving the ackowledgement.

 

Any suggestion please?

 

Thanks

Mohan

Outcomes