Hello, I am working on nRF52840 and using nRF Connect SDK v2.9.0.
I want to know how I can configure the UART to be half-duplex tx or half-duplex rx.
I checked the APIs in zephyr/drivers/uart.h, but I didn`t find any function that can do this
Hello, I am working on nRF52840 and using nRF Connect SDK v2.9.0.
I want to know how I can configure the UART to be half-duplex tx or half-duplex rx.
I checked the APIs in zephyr/drivers/uart.h, but I didn`t find any function that can do this
Hi,
By Half-duplex, do you mean to use a single pin for both TX and RX, and switch between transmitting and receiving on that one pin?
The UART peripheral in nRF52840 does not support this directly. However, any GPIOs can be assigned to any serial peripheral pins, so it is technically possible to reconfigure the peripheral during runtime and alternate between connecting the GPIO to RX or TX pin of the UART. You can reference the Dynamic Pin Control sample to learn how to change UART pins during runtime\from application.
Best regards,
Jørgen
No, I mean by half-duplex to enable only the transmitter or receiver, not both.
When I used the function uart_configure (const struct device *dev, const struct uart_config *cfg), I didn`t find any element in the uart_config that specify the duplex mode
This needs to be handled by the application. You can control if RX is enabled using uart_rx_enable/uart_rx_disable APIs, and TX are started by application using uart_tx API. TX completion are notified in the uart_callback. What is the purpose of using half-duplex if you have separate pins for TX and RX? The nRF52840 is capable of transmitting and receiving at the same time, but it can't know or control when the external device transmits.