Hi
I use the SDK_2.2_TWR-K60D100M and try to use the freertos_uart.c on my TWR-K60D100M board to test receive data from UART.
The program like this
UART_RTOS_Receive(&handle, recv_buffer, 20, &n);
if(n==20)
UART_RTOS_Send(&handle, (uint8_t *)recv_buffer, n);
Now, I use the labtop send data to TWR-K60D100M board.
I found when the program run to UART_RTOS_Receive(&handle, recv_buffer, 20, &n), the program is going to block state, when receive data over 20 and the program will active.
My question is how to let the UART_RTOS_Receive(&handle, recv_buffer, 20, &n) immediately return, rather than wait the received data over 20.
RTOS Uart driver is blocking the current task until whole required data are received. Please check the API UART_RTOS_Receive.
int UART_RTOS_Receive(uart_rtos_handle_t *handle, uint8_t *buffer, uint32_t length, size_t *received).
In your case, you specify the number of data words as 20. If you define the length as 1, the function will receive just 1 byte every time and return immediately.
Have a great day,
Daniel
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------
I have same question, any update? I want receive non block data
What if i am streaming some data to the UART. I would like to use the RTOS UART DRIVER and process lets say 20 data word blocks, except that the last packet is only 8 words and i need to process it.Any suggestions as to how to handle this.
Thanks