Timeouts in LPUART with FreeRTOS

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

Timeouts in LPUART with FreeRTOS

2,384件の閲覧回数
andrew_walsh
Contributor II

Hello,

I'm currently planning to use the LPUART FreeRTOS driver (fsl_lpuart_freertos.*) from the MCUXpresso SDK, but I've noticed that it is not possible to specify a timeout. This appears to be the case in 2.5.0, which I think is the latest (dated 11th Jan 2019).

For example, inside the function LPUART_RTOS_Send(), there is a call to LPUART_TransferSendNonBlocking(), followed by a call to the FreeRTOS xEventGroupWaitBits(), which is as I might expect. The problem, however, is that a hardcoded value, portMAX_DELAY is passed for the parameter xTicksToWait, which I think means it will wait forever.

Would NXP consider modifying the SDK, providing an extra parameter to LPUART_RTOS_Send() which would allow this wait time to be specified? If xEventGroupWaitBits() then returns with no event bits set, LPUART_RTOS_Send() would call LPUART_TransferAbortSend(), perhaps?

If this change was made, I think similar modifications would also be needed in LPUART_RTOS_Receive().

Many Thanks,

Andrew.

0 件の賞賛
返信
4 返答(返信)

2,068件の閲覧回数
BlackNight
NXP Employee
NXP Employee

Hi Andrew,

you might have a look at the files in mcuoneclipse/uart.c at master  · GitHub 

where it implements a simple non-blocking UART driver with FreeRTOS.

I hope this helps,

Erich

0 件の賞賛
返信

1,879件の閲覧回数
Meera_123
Contributor II

Hiii I tried your code https://github.com/ErichStyger/mcuoneclipse/blob/f2a1361e8a49cc0a2428618796fde21d559cc304/Examples/M... 

void UART_Init(void) {
  MSG_Init();
  if (xTaskCreate(UartTask,      /* pointer to the task                      */
          "UartTask",            /* task name for kernel awareness debugging */
          500/sizeof(portSTACK_TYPE),  /* task stack size                          */
          NULL,                      /* optional task startup argument           */
          tskIDLE_PRIORITY+1,       /* initial priority                         */
          NULL /* optional task handle to create           */
          ) != pdPASS)
  {
      for(;;) {}
  }
  MSG_SendStringTxQueue("AT\r");
  MSG_SendStringTxQueue("AT+CSQ\r");
}

Then it transmits both the string together("AT\rAT+CSQ\r"). I checked here MSG_GetStringTxQueue(localBuf, sizeof(localBuf)); and gives response of first string. 

0 件の賞賛
返信

2,068件の閲覧回数
andrew_walsh
Contributor II

Hi Erich,

Thanks for this, and sorry for the delay of my reply; I'll take a look.

I am thinking, in any case, that I'll have to modify the MCUXpresso API, but I was hoping that NXP would consider modifying the standard API.

Best regards,

Andrew.

0 件の賞賛
返信

2,068件の閲覧回数
danielchen
NXP TechSupport
NXP TechSupport

Hi Andrew:

Thanks for your good suggestion, I will issue a feature request to the develop team.

Regards

Daniel

0 件の賞賛
返信