UART - ring buffer full, uart_flush_input(uart_port_t uart_num) doesn't clear buffer
Posted: Tue Aug 03, 2021 9:01 am
I use idf v4.4-dev.
When I transmit to esp lot of data with high frequency the event UART_BUFFER_FULL appears but uart_flush_input() doesn't clear buffer but returns ESP_OK status.
Next event is UART_FIFO_OVF and it apears continously when data is receive.
This is my while loop in uart task:
When I transmit to esp lot of data with high frequency the event UART_BUFFER_FULL appears but uart_flush_input() doesn't clear buffer but returns ESP_OK status.
Next event is UART_FIFO_OVF and it apears continously when data is receive.
This is my while loop in uart task:
Code: Select all
while(1) {
if( xQueueReceive( uart_console_queue, ( void* )&event, 1) ){
switch( event.type ) {
case UART_DATA:
uart_console_read_data( event.size );
break;
case UART_FIFO_OVF:
ESP_LOGW( UART_TASK_TAG, "hw fifo overflow, err %s ", esp_err_to_name( uart_flush_input( UART_CONSOLE ) ) );
xQueueReset( uart_console_queue );
break;
case UART_BUFFER_FULL:
ESP_LOGI( UART_TASK_TAG, "ring buffer full" );
uart_flush_input( UART_CONSOLE );
xQueueReset( uart_console_queue );
break;
case UART_BREAK:
ESP_LOGI( UART_TASK_TAG, "uart rx break" );
break;
case UART_PARITY_ERR:
ESP_LOGI( UART_TASK_TAG, "uart parity error" );
break;
case UART_FRAME_ERR:
ESP_LOGI( UART_TASK_TAG, "uart frame error" );
break;
default:
ESP_LOGI( UART_TASK_TAG, "uart event type: %d", event.type );
break;
}
}
}