FreeRTOS UART Receive without waiting for a character

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

FreeRTOS UART Receive without waiting for a character

1,384件の閲覧回数
ericoneill
Contributor II

Hello,

I'm new to FreeRTOS and Kinetis processors in general. I'm trying to create a program where the UART sends a short message every second, and additionally the program can receive characters and store them in a buffer. With the example provided in the KSDK 2.0, the program waits until 4B are received before sending them all back. I would like the program to continue sending another message without waiting.

Would I need to create another uart task just for the receive buffer? Or is there a way to only call UART_RTOS_Receive once there is a character on the UART RX waiting to be received.

I am using a K66 processor with FreeRTOS. I used the freertos_uart example program from the KSDK 2.0 to start.

Let me know if there needs to be any clarification. Any help would be greatly appreciated.

Thanks,

Eric

ラベル(1)
タグ(2)
1 返信

896件の閲覧回数
danielchen
NXP TechSupport
NXP TechSupport

Hi  Eric O'Neill

RTOS Uart driver is blocking the current task until whole required data are received.

It works like this,  in the UART ISR, when the predefined number of data has been received already, the callback functioin is called, the in the callback function, a semaphore is posted.

In the freertos_uart demo, the predefined number of data is 4. if you define the length as 1, the function will receive just 1 byte every time and return immeediately.

UART_RTOS_Receive(uart_rtos_handle_t *handle, uint8_t *buffer, uint32_t length, size_t *received)

Regards

Daniel