FreeRTOS UART Receive without waiting for a character

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

FreeRTOS UART Receive without waiting for a character

1,369 Views
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

Labels (1)
1 Reply

881 Views
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