QUERY · ISSUE
Esp32: Add explicit "wait_tx_done" method to UART
port-esp32
Hello folks,
Faced with issue, I cannot control time when UART TX done from MicroPython.
Use case is next:
- I've tried to communicate by raw RS485 and I should know when exactly disable TX pin.
Currently, there are couple workarounds (judged by sources and undocumented). In these methods called uart_wait_tx_done():
- Via
init()method. E.g. send bytes and callinit(). But if implementation will be changed in future such method stopped worked. Especially this method is very strange to call in the middle of the UART operation. - Via
sendbreak()method. But also undocumented plus it always sends\x00
Proposal:
- I think it would be good to add explicit method for waiting UART TX done.
CANDIDATE · ISSUE
ESP32-C3 UART init error
bugport-esp32
Discussed in https://github.com/orgs/micropython/discussions/18122
<div type='discussions-op-text'>
<sup>Originally posted by shariltumin September 22, 2025</sup>
Has anyone had the same experience when working with the UART on the ESP32-C3?
MPY: soft reboot
MicroPython v1.27.0-preview.160.g8757eb715e on 2025-09-20; ESP32C3 module with ESP32C3
Type "help()" for more information.
>>> from machine import UART, Pin
>>> u1 = UART(1)
E (38893) uart: uart_wait_tx_done(1444): uart driver error
>>> u1
UART(1, baudrate=115211, bits=8, parity=None, stop=1, tx=10, rx=9, rts=-1, cts=-1, txbuf=256, rxbuf=256, timeout=0, timeout_char=0, irq=0)
>>> u1.write(b'xxxxx yyyyyy zzzzz')
18
>>> u1.any()
18
>>> w = u1.read()
>>> w
b'xxxxx yyyyyy zzzzz'
>>> import platform
>>> platform.platform()
'MicroPython-1.27.0-preview-riscv-IDFv5.4.2-with-newlib4.3.0'
I got a "uart driver error," but the UART seems to be functioning normally. Can someone explain why this happened?
</div>