Skip to content

After HardwareSerial input FIFO overflow, no more input is received. #6336

Closed
@hreintke

Description

@hreintke

Board

LOLIN 32

Device Description

LOLIN32

Hardware Configuration

Only Serial connected to PC using USB

Version

latest master

IDE Name

Sloeber Eclipse

Operating System

Window 10

Flash frequency

80 Mhz

PSRAM enabled

no

Upload speed

921600

Description

I have a 360 degree distance sensor which always outputs a data stream of 115200 baud.
When handling that datastream, an input FIFO can occour.
That is no problem as the messages have a crc so errors are detected by the protocol.
But what happens is that after the FIFO overflow, there are no more characters received from the Serial port.

I know I can increase the rxBufferSize, but that only makes the issue less frequent. I'd like to have a solid solution without the risk of hanging.

I would expect an overflow "only" gives loss of characters, but now it completely stops the uart from functioning.
Looks like the fifo error interrupt flag is not reset.

Checked in the 1.06 version, which uses uart directly (not using IDF).
In there on every interrupt the flag is reset uart->dev->int_clr.rxfifo_full = 1;

With that version all works as expected.

I used this small program to force the FIFO overflow, just send a larger message to the esp and it will trigger.
Any further input will only report another overflow

Sketch

#include "Arduino.h"

void setup()
{
	Serial.begin(115200);
}

void loop()
{
	if (Serial.available())
	{
		char c = Serial.read();
		delay(1);
		Serial.printf("%c",c);
	}
}

Debug Message

[↑☻☻☻??m◄um????2-hal-cpu.c:211] setCpuFrequencyMhz(): PLL: 480 / 2 = 240 Mhz, APB: 80000000 Hz

0
01234567890
1
01234567890
2
0123456789[  4783][W][esp32-hal-uart.c:119] uart_event_task(): UART0 Buffer Full. Flushing data. Consider encreasing your buffer size of your Application.
0[  4796][W][esp32-hal-uart.c:113] uart_event_task(): UART0 FIFO Overflow. Flushing data. Consider adding Flow Control to your Application.
[  4808][W][esp32-hal-uart.c:113] uart_event_task(): UART0 FIFO Overflow. Flushing data. Consider adding Flow Control to your Application.
[  4821][W][esp32-hal-uart.c:113] uart_event_task(): UART0 FIFO Overflow. Flushing data. Consider adding Flow Control to your Application.


### Other Steps to Reproduce

_No response_

### I have checked existing issues, online documentation and the Troubleshooting Guide

- [X] I confirm I have checked existing issues, online documentation and Troubleshooting guide.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions