Page 1 of 1

UART - ring buffer full, uart_flush_input(uart_port_t uart_num) doesn't clear buffer

Posted: Tue Aug 03, 2021 9:01 am
by filipESP
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:

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;
			 }
        }
	}

Re: UART - ring buffer full, uart_flush_input(uart_port_t uart_num) doesn't clear buffer

Posted: Tue Aug 17, 2021 2:05 pm
by filipESP
Still no suggestions?

Re: UART - ring buffer full, uart_flush_input(uart_port_t uart_num) doesn't clear buffer

Posted: Fri Sep 30, 2022 1:01 pm
by linus.lundin
Hi,

I have the exact same issue, did you find a solution?`

/Linus