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))
print ('send')
uart.read (5)In the documentation I found UART.INV_TX inverts Transmitter dataline. But it doesn't work.
https://development.pycom.io/firmwareapi/pycom/machine/uart/ -
@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.
-
This post is deleted! -
Hi, @robert-hh thank you for your quick reply.
Can you send link to your pull request?
Thank you in advance. -
@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:
https://github.com/robert-hh/pycom-micropython-sigfox/tree/homebrew
Hello! It looks like you're interested in this conversation, but you don't have an account yet.
Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.
With your input, this post could be even better 💗
Register Login