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 · PULL REQUEST
machine_uart.c: Call uart_wait_tx_done() only with installed driver.
port-esp32
Summary
Call uart_wait_tx_done() only with installed driver. Otherwise an error message will pop up at the first instantiation of the UART object.
Addresses #18122 / #18123.
Testing
Tested with a ESP32 classic and ESP32C3. Test objective:
- Verify the the error message disappeared. (ESP32 classic, ESP32C3)
- Verify that an ongoing TX finishes when uart.init() is called while sending. (ESP32 classic).