Tool/software:
使用uart_callback freertos的demo,发现默认
This thread has been locked.
If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.
Tool/software:
使用uart_callback freertos的demo,发现默认
Hi,
Could you help to describe your question via English? this will more helpful to discuss with World wide team.
Thanks!
Best Regards
Johnson
OK, thank you!
I’m working with the UART callback + FreeRTOS demo from the drivers library. By default, the example uses:
uartParams.readReturnMode = UART_ReadReturnMode_PARTIAL;
#define CONFIG_UART_BUFFER_LENGTH 1
In this case, the callback (callbackFxn) is triggered correctly for each received byte.
However, when I change the buffer length to 10:
#define CONFIG_UART_BUFFER_LENGTH 10
I notice that the callback is not triggered multiple times as expected. It seems that the low-level logic depends on a timeout interrupt, which is only generated when the FIFO is not empty and the timeout expires. This causes situations where the timeout interrupt is never fired, so the callback is not invoked.
Question:
How should I correctly configure or implement UART_ReadReturnMode_PARTIAL in the drivers library so that the callback is reliably invoked when using a buffer length greater than 1?
Hi,
The example is used with RXFIFO>= 1 entry for Interrupt trigger.
And it trigger the interrupt when there receieved one byte. The timeout function is not required if the FIFO trigger level set as 1.
I am not familar with RTOS itself, while this looks like the UART task is not trigger when you received more data.
I checked the Rxbuffer can normally update large data length with interrupt task, but the first UART mian task only triggered at the first data received, which makes it pending in while loop.
B.R.
Sal
And after modify the while loop, it look work with more than 1 byte data packet.
char input[10];
....
while (1) {
bytesRead = 0;
while (bytesRead <= 9) {
status = UART_read(uart, &input, 10, &bytesRead);
if (status != UART_STATUS_SUCCESS) {
/* UART_read() failed */
while (1) {
}
}
}
bytesWritten = 0;
while (bytesWritten == 0) {
status = UART_write(uart, &input, 10, &bytesWritten);
if (status != UART_STATUS_SUCCESS) {
/* UART_write() failed */
while (1) {
}
}
}
}
B.R.
Sal