I am currently using a Raspberry Pi Pico with MicroPython 1.16 and using its UART to simulate a sensor using a serial protocol with a transmitter. The transmitter only using the data wire and ground meaning RX and TX are physically tied so my UART RX and TX will also be tied. This causes my receive line to pickup whatever the transmit line sends to the transmitter as well. I want to try to clear this by simply turning off and back on the UART port.
I have already implemented this same project and idea using PySerial and an FTDI driver and would use the serial.open()
and close()
to clear the buffer instead of the actual method reset_input_buffer()
that would not work properly. This is the reasoning behind wanting to deinitialize and reinitialize the UART port.
I was wondering if the MicroPython UART.init()
and deinit()
methods do not work as the documentation specifies since the interpreter gives me a AttributeError: 'UART' object has no attribute 'init' micropython
same happens for 'deinit'
as well. Or if anyone knows how to clear the input buffer for a UART port?