<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="https://devzone.nordicsemi.com/cfs-file/__key/system/syndication/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>UART half-duplex</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/118704/uart-half-duplex</link><description>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</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Fri, 07 Feb 2025 13:08:27 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/118704/uart-half-duplex" /><item><title>RE: UART half-duplex</title><link>https://devzone.nordicsemi.com/thread/521937?ContentTypeID=1</link><pubDate>Fri, 07 Feb 2025 13:08:27 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:805101ab-6777-4059-9bd2-53d001013260</guid><dc:creator>J&amp;#248;rgen Holmefjord</dc:creator><description>&lt;p&gt;This needs to be handled by the application. You can control if RX is enabled using&amp;nbsp;&lt;a href="https://docs.nordicsemi.com/bundle/zephyr-apis-2.9.0/page/group_uart_async.html#ga902e18c2a727ed2988e1b6caa6a444b8"&gt;uart_rx_enable&lt;/a&gt;/&lt;a href="https://docs.nordicsemi.com/bundle/zephyr-apis-2.9.0/page/group_uart_async.html#gafd4753bee51b230091a3c6ddb26ea734"&gt;uart_rx_disable&lt;/a&gt;&amp;nbsp;APIs, and TX are started by application using&amp;nbsp;&lt;a href="https://docs.nordicsemi.com/bundle/zephyr-apis-2.9.0/page/group_uart_async.html#gaf99f32ce2e2d9beb32a2f2e5a26320dc"&gt;uart_tx&lt;/a&gt;&amp;nbsp;API. TX completion are notified in the &lt;a href="https://docs.nordicsemi.com/bundle/zephyr-apis-2.9.0/page/group_uart_async.html#ga00b7c98a4da3ea3675d0a40c5dacb136"&gt;uart_callback&lt;/a&gt;. 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&amp;#39;t know or control when the external device transmits.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: UART half-duplex</title><link>https://devzone.nordicsemi.com/thread/521929?ContentTypeID=1</link><pubDate>Fri, 07 Feb 2025 12:54:33 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:9d8e8ff6-40c7-459a-8cbe-7db625154043</guid><dc:creator>Nedaa_H_Ahmed</dc:creator><description>&lt;p&gt;No, I mean by half-duplex to enable only the transmitter or receiver, not both.&lt;/p&gt;
&lt;p&gt;When I used the function&amp;nbsp;&lt;a class="el" href="https://docs.zephyrproject.org/apidoc/latest/group__uart__interface.html#gaa0b75777b879af10543f7e8f463ff9a2"&gt;uart_configure&lt;/a&gt;&lt;span&gt;&amp;nbsp;(const struct&amp;nbsp;&lt;/span&gt;&lt;a class="el" href="https://docs.zephyrproject.org/apidoc/latest/structdevice.html"&gt;device&lt;/a&gt;&lt;span&gt;&amp;nbsp;*dev, const struct&amp;nbsp;&lt;/span&gt;&lt;a class="el" href="https://docs.zephyrproject.org/apidoc/latest/structuart__config.html"&gt;uart_config&lt;/a&gt;&lt;span&gt;&amp;nbsp;*cfg), I didn`t find any element in the uart_config that specify the duplex mode&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: UART half-duplex</title><link>https://devzone.nordicsemi.com/thread/521883?ContentTypeID=1</link><pubDate>Fri, 07 Feb 2025 09:53:26 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:ebb5e187-0748-418b-a7fd-da51b0c7e5ab</guid><dc:creator>J&amp;#248;rgen Holmefjord</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;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?&lt;/p&gt;
&lt;p&gt;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&amp;nbsp;&lt;a title="Dynamically change pin configuration at boot time." href="https://docs.nordicsemi.com/bundle/ncs-2.9.0/page/zephyr/samples/boards/nordic/dynamic_pinctrl/README.html#nrf_dynamic_pinctrl"&gt;Dynamic Pin Control&lt;/a&gt;&amp;nbsp;sample to learn how to change UART pins during runtime\from application.&lt;/p&gt;
&lt;p&gt;Best regards,&lt;br /&gt;Jørgen&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>