ESP32 UART Register "UART_TXD_INV"

For general Flowcode discussion that does not belong in the other sections.
Post Reply
dvcam99
Posts: 89
http://meble-kuchenne.info.pl
Joined: Fri Dec 04, 2020 11:03 am
Has thanked: 6 times
Been thanked: 12 times

ESP32 UART Register "UART_TXD_INV"

Post by dvcam99 »

Hello ESP32 experts,
Hello Matrix team,

I would like to write to the following ESP32 UART register in order to invert the output signal:


UART_TXD_INV Set this bit to invert the level of the UART TxD signal. (R/W)

Can sombody please teach me what is the correct C-code /syntax in order to change this UART register.

Many thanks in advance
Dirk
Happy FC9, FC-8 and FC-6 professional user ;)

LeighM
Valued Contributor
Posts: 401
Joined: Mon Dec 07, 2020 1:00 pm
Has thanked: 73 times
Been thanked: 218 times

Re: ESP32 UART Register "UART_TXD_INV"

Post by LeighM »

Hi Dirk,
The function you need is ...

esp_err_t uart_set_line_inverse(uart_port_t uart_num, uint32_t inverse_mask);

Where uart_num is 0,1,2 etc, corresponding to Flowcode Channels 1,2,3
So if you are using Channel2, UART1, then the C code you require is ...

Code: Select all

uart_set_line_inverse(1, UART_SIGNAL_TXD_INV);

dvcam99
Posts: 89
Joined: Fri Dec 04, 2020 11:03 am
Has thanked: 6 times
Been thanked: 12 times

Re: ESP32 UART Register "UART_TXD_INV"

Post by dvcam99 »

Hello Leigh,

wonderful perfect support!!!! :D

I can confirm it works in ESP32 hard. Pls. see following Scope Screen Shoot.
inverteduart.png
inverteduart.png (171.47 KiB) Viewed 2868 times

Many thanks!!

Dirk
Happy FC9, FC-8 and FC-6 professional user ;)

dvcam99
Posts: 89
Joined: Fri Dec 04, 2020 11:03 am
Has thanked: 6 times
Been thanked: 12 times

Re: ESP32 UART Register "UART_TXD_INV"

Post by dvcam99 »

Hello Leigh,

today I came again into the need in order to invert ESP32 UART lines. Since the above TX invert commands works very well I have the need to invert the UART RX line too.

I`ll tried modified command

Code: Select all

uart_set_line_inverse(1, UART_SIGNAL_RXD_INV);
but unfortunately this is not working. At least if you put that command in the C-Box it re-inverts the TX line back.

Any ideas are welcome to overcome this problem.




BR
Dirk
Happy FC9, FC-8 and FC-6 professional user ;)

dvcam99
Posts: 89
Joined: Fri Dec 04, 2020 11:03 am
Has thanked: 6 times
Been thanked: 12 times

Re: ESP32 UART Register "UART_TXD_INV"

Post by dvcam99 »

Hi Leigh,

I played a bit with the Syntax / Command and my the following was accepted by the compiler and the TX output is inverted too.

Code: Select all

uart_set_line_inverse(UART_NUM_1, UART_SIGNAL_RXD_INV | UART_SIGNAL_TXD_INV);
In the next days I can check if the UART RX port is accepting the inverted incoming signal too.

Further thoughts from your side are still welcome.

BR

Dirk
Happy FC9, FC-8 and FC-6 professional user ;)

LeighM
Valued Contributor
Posts: 401
Joined: Mon Dec 07, 2020 1:00 pm
Has thanked: 73 times
Been thanked: 218 times

Re: ESP32 UART Register "UART_TXD_INV"

Post by LeighM »

Hi Dirk,
Yes, that's the correct way, as the second parameter is an ORed mask of the wires that need to be inverted
Leigh

Post Reply