UART invert signal
Hi, I am trying to connect to serial communication and I need signal inversion on the TX line, but it does not work.
Maybe someone knows what I'm doing wrong?
from machine import UART
uart = UART (1, baudrate = 9600, pins = ('P20', 'P21'))
uart.init (invert = UART.INV_TX)
uart.write (bytes (0xAF))
In the documentation I found UART.INV_TX inverts Transmitter dataline. But it doesn't work.
robert-hh last edited by robert-hh
@Norbert-Szczesny The PR is here: https://github.com/pycom/pycom-micropython-sigfox/pull/362
The only affected file is mods/machuart.c.
Since it is a change to the sources, you have to rebuild the firmware yourself. But that is not too hard.
Edit: it is also included in the homebrew branch of my fork, which has also a few other fixes:
Hi, @robert-hh thank you for your quick reply.
Can you send link to your pull request?
Thank you in advance.
This post is deleted!
robert-hh last edited by
@Norbert-Szczesny uart.init() must contain all settings that are different from the default in one call. You cannot call uart-init() for single changes.But you can put all uart.init() parameters into the constructor. e.g.
uart = UART (1, baudrate = 9600, pins = ('P20', 'P21'), invert=UART.INV_TX)
I'm a little bit surprised that the paramter invert= .. is accepted. I made that PR once, but did not see it yet in the Dev or Release/1.20 branch.