Page 1 of 1
ESP32 UART Register "UART_TXD_INV"
Posted: Sun Jan 24, 2021 10:38 am
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
Re: ESP32 UART Register "UART_TXD_INV"
Posted: Mon Jan 25, 2021 9:06 am
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);
Re: ESP32 UART Register "UART_TXD_INV"
Posted: Mon Jan 25, 2021 12:35 pm
by dvcam99
Hello Leigh,
wonderful perfect support!!!!
I can confirm it works in ESP32 hard. Pls. see following Scope Screen Shoot.
- inverteduart.png (171.47 KiB) Viewed 3115 times
Many thanks!!
Dirk
Re: ESP32 UART Register "UART_TXD_INV"
Posted: Tue Nov 29, 2022 9:05 pm
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
Re: ESP32 UART Register "UART_TXD_INV"
Posted: Tue Nov 29, 2022 10:39 pm
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
Re: ESP32 UART Register "UART_TXD_INV"
Posted: Wed Nov 30, 2022 9:13 am
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