zephyr: esp32-usb-serial tx-complete interrupt not working in interrupt mode on esp32c3
Describe the bug
Hi! I’m running into some issue when trying to use the usb_serial device on an ESP32C3 system. When running the shell_module sample, I can tell that the data is received correctly, but the output buffer is only flushed as a reaction to a receive event. For example I can type a command, but the echo is delayed and the output is not printed until something else is sent on the serial port. The behavior seems to indicate that serial_esp32_usb_isr is not being called as it should when the transmit buffer is empty, hence stopping the application from flushing its transmit queue.
The driver works correctly in polling mode (CONFIG_SHELL_BACKEND_SERIAL_INTERRUPT_DRIVEN=n).
Additionally, the USB debug interface fails entirely when building the wifi sample (that is, does not enumerate, errors in dmesg, have to reset it in bootloader mode to flash it again). Could this be some interrupt management issue?
Disclaimer: I’m actually using a Seeed XIAO-ESP32-C3 board, not the official esp32c3_devkitm, but I think the problem should be the same since the device is builtin.
To Reproduce Steps to reproduce the behavior:
- patch
boards/riscv/esp32c3_devkitm/esp32c3_devkitm.dts
- zephyr,shell-uart = &uart0;
+ zephyr,shell-uart = &usb_serial;
- build and flash the
shell_modulesample
west build -p -b esp32c3_devkitm samples/subsys/shell/shell_module
west flash
- access the shell interface (minicom, west espressif monitor…), send some command, output is not flushing
- build and flash with
west build -p -b esp32c3_devkitm samples/subsys/shell/shell_module -DCONFIG_SHELL_BACKEND_SERIAL_INTERRUPT_DRIVEN=y, the shell works fine
Expected behavior The USB serial works as expected.
Impact Annoyance
Environment (please complete the following information):
- Linux, Zephyr SDK 0.15.2, main (55843e7d77), Seeed XIAO-ESP32-C3
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Reactions: 1
- Comments: 16 (9 by maintainers)
@fabiobaltieri, The below has been fixed already, but needs west.yml update, which depends of other PRs).
I was able to confirm the same issue, will take a look. Thanks!
Also confirmed it works, thanks.
Hey that did it, mind sending a PR with the change? https://docs.zephyrproject.org/latest/contribute/guidelines.html#contribution-guidelines
Calling irq callback after enabling tx interrupt fixed this issue for me.