-
Notifications
You must be signed in to change notification settings - Fork 7.8k
Description
Environment
- Development Kit: none
- Kit version N/A
- Module or chip used: ESP32-WROOM-32D
- IDF version: v4.4
- Build System: idf.py
- Compiler version (run
xtensa-esp32-elf-gcc --version
to find it):
// 1.22.0-80-g6c4433a - Operating System: Windows
- environment type: PowerShell
- Using an IDE?: Yes, VS Code with Espressif IDF extension
- Power Supply: external 3.3V
Problem Description
When calling uart_flush() with a full UART RX buffer, the ring buffer is cleared, but all subsequent calls to uart_read_bytes() return zero bytes. I have tracked the problem down to "xSemaphoreTake(rbGET_RX_SEM_HANDLE(pxRingbuffer), xTicksRemaining)" returning pdFALSE in ringbuf.c at line 776 and subsequently not actually reading any data. This essentially means, that once you call uart_flush() with a full RX buffer, you can no longer read any UART data until you reboot the device. If the buffer is not full, when flushing, everything functions as expected.
Expected Behavior
calling uart_flush() with a full UART RX buffer, clears the ring buffer and subsequent calls to uart_read_bytes() return data received after flushing.
Actual Behavior
calling uart_flush() with a full UART RX buffer, clears the ring buffer but subsequent calls to uart_read_bytes() return 0 bytes.
Steps to reproduce
- Load the uart_echo example from the release/v4.4 branch
- Configure pins etc. in menuconfig
- Paste code below into uart_echo_example_main.c
- Compile and upload to ESP
- Launch JTAG debugger
- Send enough data to fill UART buffer
- Set a break point at "if (change_me == true)"
- change the value of change_me to true
- Follow code execution
Code to reproduce this issue
Debug Logs
Debug log goes here, should contain the backtrace, as well as the reset source if it is a crash.
Please copy the plain text here for us to search the error log. Or attach the complete logs but leave the main part here if the log is *too* long.
Other items if possible
- sdkconfig file (attach the sdkconfig file from your project folder)
- elf file in the
build
folder (note this may contain all the code details and symbols of your project.) - coredump (This provides stacks of tasks.)