<?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>NCS/Zephyr - Dynamically modifying pin&amp;#39;s function at runtime</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/106765/ncs-zephyr---dynamically-modifying-pin-s-function-at-runtime</link><description>Hi, 
 What would be the best way to alter pin&amp;#39;s functionality from UART TX -&amp;gt;RX-&amp;gt;GPOUT -&amp;gt;GPIN in runtime? (NCS2.5/Zephyr nRF52840) 
 
 Is it supported by Zephyr/devicetree ( this old thread says it&amp;#39;s not, but maybe it has changed since)? 
 If such functionality</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Thu, 02 Oct 2025 13:59:43 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/106765/ncs-zephyr---dynamically-modifying-pin-s-function-at-runtime" /><item><title>RE: NCS/Zephyr - Dynamically modifying pin's function at runtime</title><link>https://devzone.nordicsemi.com/thread/550506?ContentTypeID=1</link><pubDate>Thu, 02 Oct 2025 13:59:43 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:2bada277-6b1e-43c6-ab56-a229ae49beba</guid><dc:creator>Maria Gilje</dc:creator><description>&lt;p&gt;Hello,&amp;nbsp;&lt;/p&gt;
&lt;p&gt;In general, one peripheral can not be driven by both nrfx and Zephyr drivers. So Zephyr logging on an nrfx driven UART instance will not work, to my knowledge.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Maria&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: NCS/Zephyr - Dynamically modifying pin's function at runtime</title><link>https://devzone.nordicsemi.com/thread/550403?ContentTypeID=1</link><pubDate>Wed, 01 Oct 2025 18:38:22 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:f48b8ec5-3dcf-450c-acb0-068e7e689548</guid><dc:creator>yanbingyu</dc:creator><description>&lt;p&gt;&lt;a href="https://devzone.nordicsemi.com/members/maria-gilje"&gt;Maria Gilje&lt;/a&gt;&amp;nbsp; Even though this post was from 2 years ago, I still want to ask a follow up question, hope you can help.&lt;/p&gt;
&lt;p&gt;When using the nrfx UART driver, can the Zephyr log functions output to the UART port driven by the nrfx driver? I.e. log messages can be viewed on that UART port?&lt;/p&gt;
&lt;p&gt;Thanks!&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: NCS/Zephyr - Dynamically modifying pin's function at runtime</title><link>https://devzone.nordicsemi.com/thread/462040?ContentTypeID=1</link><pubDate>Fri, 29 Dec 2023 07:18:05 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:5de5bbba-1d6f-42c4-8b8a-8045c291f616</guid><dc:creator>Maria Gilje</dc:creator><description>&lt;p&gt;Sorry about the delay.&lt;/p&gt;
&lt;p&gt;Your devicetree can stay as it was.&lt;/p&gt;
[quote user="eyalasko"]What *.h files should be included&amp;nbsp; (I tried to #include &amp;lt;nrf_gpio.h&amp;gt; but got a build error)[/quote]
&lt;p&gt;Did you look at the samples I linked in my previous answers? Here is a link to the 2.5.0 versions on github as well: &lt;a href="https://github.com/nrfconnect/sdk-zephyr/blob/2e2523efe52a7ac89f0567b8798fd857b1e71ae3/samples/boards/nrf/nrfx_prs"&gt;nrfx prs&lt;/a&gt; and &lt;a href="https://github.com/nrfconnect/sdk-zephyr/tree/2e2523efe52a7ac89f0567b8798fd857b1e71ae3/samples/boards/nrf/nrfx"&gt;nrfx use&lt;/a&gt;&lt;/p&gt;
[quote user="eyalasko"]be advised the &lt;a href="https://developer.nordicsemi.com/nRF_Connect_SDK/doc/latest/nrfx/drivers/uarte/driver.html#c.nrfx_uarte_config_t"&gt;NRFX UARTE doumentation&lt;/a&gt; mentions tx_cache/rx_cache which are not available in nrfx_uarte.h...[/quote]
&lt;p&gt;tx_cache and rx_cache are in the main branch of NCS but not in any of the currently tagged releases (latest is v2.5.1).&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Maria&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: NCS/Zephyr - Dynamically modifying pin's function at runtime</title><link>https://devzone.nordicsemi.com/thread/461126?ContentTypeID=1</link><pubDate>Tue, 19 Dec 2023 15:33:31 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:45821d1e-9ddb-480d-8e85-a21b0f597bff</guid><dc:creator>eyalasko</dc:creator><description>&lt;p&gt;Thanks for your prompt response.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;If going for NRFX drivers as you advised, should I remove all references to this UARTE from the devicetree as well (or would it suffice just not to use it in the Zephyr way?)&lt;/p&gt;
&lt;p&gt;What *.h files should be included&amp;nbsp; (I tried to #include &amp;lt;nrf_gpio.h&amp;gt; but got a build error)&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;btw,&lt;/p&gt;
&lt;p&gt;be advised the &lt;a href="https://developer.nordicsemi.com/nRF_Connect_SDK/doc/latest/nrfx/drivers/uarte/driver.html#c.nrfx_uarte_config_t"&gt;NRFX UARTE doumentation&lt;/a&gt; mentions tx_cache/rx_cache which are not available in nrfx_uarte.h...&lt;/p&gt;
&lt;div id="simple-translate" class="simple-translate-light-theme"&gt;
&lt;div&gt;
&lt;div class="simple-translate-button isShow" style="height:22px;left:61px;top:162px;width:22px;"&gt;&lt;/div&gt;
&lt;div class="simple-translate-panel " style="font-size:13px;height:200px;left:0px;top:0px;width:300px;"&gt;
&lt;div class="simple-translate-result-wrapper" style="overflow:hidden;"&gt;
&lt;div class="simple-translate-move"&gt;&lt;/div&gt;
&lt;div class="simple-translate-result-contents"&gt;
&lt;p class="simple-translate-result" dir="auto"&gt;&lt;/p&gt;
&lt;p class="simple-translate-candidate" dir="auto"&gt;&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: NCS/Zephyr - Dynamically modifying pin's function at runtime</title><link>https://devzone.nordicsemi.com/thread/461105?ContentTypeID=1</link><pubDate>Tue, 19 Dec 2023 14:43:45 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:4e61b0c8-138d-4360-867c-e04b43c35b13</guid><dc:creator>Maria Gilje</dc:creator><description>&lt;p&gt;Hello,&lt;/p&gt;
&lt;p&gt;Zephyr offers &lt;a href="https://docs.zephyrproject.org/latest/hardware/pinctrl/index.html#dynamic-pin-control"&gt;Dynamic pin control&lt;/a&gt; now, but it is only meant to be used for uninitialized devices. The recommendation is to use only in early boot stages. From your description it seems the Dynamic pin control is not a good match, but I wanted to include it for completeness.&lt;/p&gt;
&lt;p&gt;A possibility is to use nrfx drivers instead of Zephyr drivers. There is an nrfx &lt;a href="https://developer.nordicsemi.com/nRF_Connect_SDK/doc/2.5.0/nrfx/drivers/uart/driver.html"&gt;driver&lt;/a&gt; and &lt;a href="https://developer.nordicsemi.com/nRF_Connect_SDK/doc/2.5.0/nrfx/drivers/uart/hal.html"&gt;HAL&lt;/a&gt; for UART and &lt;a href="https://developer.nordicsemi.com/nRF_Connect_SDK/doc/2.5.0/nrfx/drivers/gpio/hal.html"&gt;HAL&lt;/a&gt; for GPIO. Note that when assigning pins with nrfx you can&amp;#39;t use them with Zephyr. This option requires that you have full control over what you are doing, though.&lt;/p&gt;
&lt;p&gt;Some examples using the nrfx drivers and HAL is the &lt;a href="https://developer.nordicsemi.com/nRF_Connect_SDK/doc/latest/zephyr/samples/boards/nrf/nrfx_prs/README.html"&gt;nrfx peripheral resource sharing example&lt;/a&gt; and &lt;a href="https://developer.nordicsemi.com/nRF_Connect_SDK/doc/latest/zephyr/samples/boards/nrf/nrfx/README.html"&gt;nrfx use example&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Maria&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>