esp-hal icon indicating copy to clipboard operation
esp-hal copied to clipboard

Uart: polarity inversion

Open anti-social opened this issue 1 year ago • 3 comments

As I can see an Esp32c3 chip supports inversion: uart_set_line_inverse

Have tested it from Micropython connecting to external module pins of my Radiomaster handset (it uses half-duplex serial interface with inverted polarity). So it would be nice to have the option in Rust.

anti-social avatar Feb 28 '24 14:02 anti-social

There is an open PR for that already here: https://github.com/esp-rs/esp-hal/pull/1151

But it should already work via a slightly different mechanism introduced in https://github.com/esp-rs/esp-hal/pull/912

bjoernQ avatar Feb 28 '24 14:02 bjoernQ

Oh, sorry. Haven't searched in PRs.

But it should already work via a slightly different mechanism introduced in https://github.com/esp-rs/esp-hal/pull/912

To make it work I should configure inversion on uart pins and then create a uart device?

anti-social avatar Feb 28 '24 14:02 anti-social

Oh, sorry. Haven't searched in PRs.

No problem! 😄

To make it work I should configure inversion on uart pins and then create a uart device?

Yes, it should work that way but t.b.h. I haven't tried it with UART myself, yet

bjoernQ avatar Feb 28 '24 14:02 bjoernQ

As discussed in #1703, it appears we already have a method of inverting the GPIO, which are then in turn correctly configured for inverted UART. As such, perhaps no additional code is required, just some updates to documentation.

cc @SergioGasquez @bjoernQ

jessebraham avatar Jun 25 '24 17:06 jessebraham