<?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>Delay UART initialization in Zephyr</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/111597/delay-uart-initialization-in-zephyr</link><description>For my application I need the UART TX/RX pins pulled low until I am ready to turn on the UART. Is there a method in Zephyr to do this? Currently when Zephyr starts it reads the device tree configuration and initializes the UART driver before main, which</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Tue, 04 Jun 2024 06:18:11 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/111597/delay-uart-initialization-in-zephyr" /><item><title>RE: Delay UART initialization in Zephyr</title><link>https://devzone.nordicsemi.com/thread/487205?ContentTypeID=1</link><pubDate>Tue, 04 Jun 2024 06:18:11 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:355779ee-b364-47f2-8be2-fe274e8673a2</guid><dc:creator>AHaug</dc:creator><description>[quote user="trampas"]Unless I misunderstand the suggestion there will be a period of time after the UART is initialized by Zephyr where the pins are high, before the&amp;nbsp; call to&amp;nbsp;&lt;a href="https://developer.nordicsemi.com/nRF_Connect_SDK/doc/latest/zephyr/hardware/peripherals/gpio.html#c.gpio_pin_configure_dt"&gt;gpio_pin_configure_dt&lt;/a&gt;&lt;span&gt;().&lt;/span&gt;[/quote]
&lt;p&gt;They should be sett do pull-down when being initialized when setting this up in the overlay. But this is exactly what we would need to verify by monitoring the relevant GPIOs. Do you have a Power Profiling Kit or any other tool to measure the current available?&lt;/p&gt;
&lt;p&gt;Kind regards,&lt;br /&gt;Andreas&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Delay UART initialization in Zephyr</title><link>https://devzone.nordicsemi.com/thread/487145?ContentTypeID=1</link><pubDate>Mon, 03 Jun 2024 13:35:59 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:1a1b8ace-9781-45bd-864c-2bcc86963d6a</guid><dc:creator>trampas</dc:creator><description>&lt;p&gt;Unless I misunderstand the suggestion there will be a period of time after the UART is initialized by Zephyr where the pins are high, before the&amp;nbsp; call to&amp;nbsp;&lt;a href="https://developer.nordicsemi.com/nRF_Connect_SDK/doc/latest/zephyr/hardware/peripherals/gpio.html#c.gpio_pin_configure_dt"&gt;gpio_pin_configure_dt&lt;/a&gt;&lt;span&gt;().&amp;nbsp; Can you please explain how this solution works around this issue?&amp;nbsp;&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Delay UART initialization in Zephyr</title><link>https://devzone.nordicsemi.com/thread/487131?ContentTypeID=1</link><pubDate>Mon, 03 Jun 2024 12:55:49 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:6ae04db3-59fc-4c9a-b3f3-6ed1899b873f</guid><dc:creator>AHaug</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;I&amp;#39;ve discussed this topic some more with my colleagues and I&amp;#39;ve concluded that I&amp;#39;m gonna loop back to my first suggestion, i.e to use the overlay or dts to modify the UART instance to have pull-down until you need to configure it differently using&amp;nbsp;&lt;a href="https://developer.nordicsemi.com/nRF_Connect_SDK/doc/latest/zephyr/hardware/peripherals/gpio.html#c.gpio_pin_configure_dt"&gt;gpio_pin_configure_dt&lt;/a&gt;&lt;span&gt;().&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;a href="https://developer.nordicsemi.com/nRF_Connect_SDK/doc/latest/nrf/config_and_build/configuring_app/hardware/pin_control.html#pin-control-in-nrf"&gt;https://developer.nordicsemi.com/nRF_Connect_SDK/doc/latest/nrf/config_and_build/configuring_app/hardware/pin_control.html#pin-control-in-nrf&lt;/a&gt;&amp;nbsp;suggests this option atleast, i.e to use different groups for different modes. Create one pinctrl node with pullup and one with bias-disable and then change between these.&lt;/p&gt;
&lt;p&gt;I&amp;#39;ve not tested this with hardware and verified that it will comply with the spec you&amp;#39;re describing, but it&amp;#39;s another suggestion that you can investigate if you wish.&lt;/p&gt;
&lt;p&gt;Kind regards,&lt;br /&gt;Andreas&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Delay UART initialization in Zephyr</title><link>https://devzone.nordicsemi.com/thread/486875?ContentTypeID=1</link><pubDate>Fri, 31 May 2024 11:11:24 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:e1004e1d-8202-4bb1-97af-929d2db3cd52</guid><dc:creator>trampas</dc:creator><description>&lt;p&gt;A second idea is to have a config option which removes all the initialization calls.&amp;nbsp; Then have a means for me to call all the initialization first thing in&amp;nbsp;main.&amp;nbsp; &amp;nbsp;Then I can not initialize the UART driver.&amp;nbsp;&lt;br /&gt;&lt;br /&gt;The basic idea would be to make the&amp;nbsp;&lt;/p&gt;
&lt;div&gt;
&lt;div&gt;&lt;span&gt;z_sys_init_run_level&lt;/span&gt;&lt;span&gt;(&lt;/span&gt;&lt;span&gt;enum&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;init_level&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;level&lt;/span&gt;&lt;span&gt;)&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span&gt;a weak function.&amp;nbsp; Then in my project source code I could redefine this function and control everything.&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Delay UART initialization in Zephyr</title><link>https://devzone.nordicsemi.com/thread/486824?ContentTypeID=1</link><pubDate>Fri, 31 May 2024 09:05:01 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:a9d3f8b6-b1a3-4a5f-ae42-f7a554648a68</guid><dc:creator>AHaug</dc:creator><description>[quote user="trampas"]The best solution I can come up with at the moment is making an out of tree driver by copying nordic&amp;#39;s uarte driver from zephyr and then renaming to something like &amp;#39;myuarte&amp;#39;[/quote]
&lt;p&gt;This is within what I have thought as well. I were playing around with trying to use an overlay to modify the existing UART device binding, i.e setting it up but not initializing before I call the initialization of the device but I can&amp;#39;t quite get it to do this. Maybe the missing ingredient is to do what you say, i.e copy the existing device and creating your own custom variant of the UART that allows for this.&lt;/p&gt;
&lt;p&gt;Even though it&amp;#39;s a bit clunky it is also one of the good features with Zephyr i.e allowing for relatively standardized customization of devices and nodes.&lt;/p&gt;
&lt;p&gt;I won&amp;#39;t be able to look further into creating a sample for this for a while, but I am fairly confident that your suggestion will work&lt;/p&gt;
&lt;p&gt;Kind regards,&lt;br /&gt;Andreas&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Delay UART initialization in Zephyr</title><link>https://devzone.nordicsemi.com/thread/486751?ContentTypeID=1</link><pubDate>Thu, 30 May 2024 21:24:22 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:e0a40cc3-ec78-4f7f-acf2-d96635fd9fd7</guid><dc:creator>trampas</dc:creator><description>&lt;p&gt;Zephyr might be tasty when it work, however what are the recovery options when it fails?&lt;br /&gt;&lt;br /&gt;I have thought about this UART issue, an went through several ideas discussing with anyone who will listen, not many by the way.&amp;nbsp; The best solution I can come up with at the moment is making an out of tree driver by copying nordic&amp;#39;s uarte driver from zephyr and then renaming to something like &amp;#39;myuarte&amp;#39;.&amp;nbsp; Then in this custom driver make it work the way I need it to and add to my project.&amp;nbsp;&lt;br /&gt;&lt;br /&gt;This is not the best option but might be good enough to move forward, while we wait for&amp;nbsp; Zephyr to grow up and mature.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Delay UART initialization in Zephyr</title><link>https://devzone.nordicsemi.com/thread/486719?ContentTypeID=1</link><pubDate>Thu, 30 May 2024 15:35:38 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:7154384f-df61-4bbe-a0d6-2b8df6c64525</guid><dc:creator>trampas</dc:creator><description>&lt;p&gt;Here is the thread on discord.&amp;nbsp;&lt;a id="" href="https://discordapp.com/channels/720317445772017664/733037557218279515/1245049020242595922"&gt;https://discordapp.com/channels/720317445772017664/733037557218279515/1245049020242595922&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;As far as the Macro foo.&amp;nbsp; A trick that Devicetrees could use is to define structures in macros.&amp;nbsp; For example on bare metal system (ATSAM) I use macros for pins.&amp;nbsp;&lt;br /&gt;&lt;br /&gt;&lt;/p&gt;
&lt;div style="background-color:#ffffff;padding:0px 0px 0px 2px;"&gt;
&lt;div style="background-color:#ffffff;color:#000000;font-family:&amp;#39;Consolas&amp;#39;;font-size:11pt;white-space:pre;"&gt;
&lt;div style="background-color:#ffffff;padding:0px 0px 0px 2px;"&gt;
&lt;div style="background-color:#ffffff;color:#000000;font-family:&amp;#39;Consolas&amp;#39;;font-size:11pt;white-space:pre;"&gt;
&lt;p style="margin:0;"&gt;&lt;span style="color:#7f0055;"&gt;typedef&lt;/span&gt;&lt;span style="color:#000000;"&gt; &lt;/span&gt;&lt;span style="color:#7f0055;"&gt;struct&lt;/span&gt;&lt;span style="color:#000000;"&gt; {&lt;/span&gt;&lt;/p&gt;
&lt;p style="margin:0;"&gt;&lt;span style="color:#000000;"&gt; &lt;/span&gt;&lt;span style="color:#005032;"&gt;uint32_t&lt;/span&gt;&lt;span style="color:#000000;"&gt; &lt;/span&gt;&lt;span style="color:#0000c0;"&gt;pinNum&lt;/span&gt;&lt;span style="color:#000000;font-weight:bold;"&gt;;&lt;/span&gt;&lt;span style="color:#000000;"&gt; &lt;/span&gt;&lt;span style="color:#3f7f5f;"&gt;//this is a pin number, upper 16bits is port, lower is pin number&lt;/span&gt;&lt;/p&gt;
&lt;p style="margin:0;"&gt;&lt;span style="color:#000000;"&gt; &lt;/span&gt;&lt;span style="color:#7f0055;"&gt;void&lt;/span&gt;&lt;span style="color:#000000;"&gt; &lt;/span&gt;&lt;span style="color:#000000;font-weight:bold;"&gt;*&lt;/span&gt;&lt;span style="background-color:#d4d4d4;color:#0000c0;"&gt;ptrPerherial&lt;/span&gt;&lt;span style="color:#000000;font-weight:bold;"&gt;;&lt;/span&gt;&lt;span style="color:#000000;"&gt; &lt;/span&gt;&lt;span style="color:#3f7f5f;"&gt;//if using a peripheral, set this pointer to peripheral&lt;/span&gt;&lt;/p&gt;
&lt;p style="margin:0;"&gt;&lt;span style="color:#000000;"&gt; &lt;/span&gt;&lt;span style="color:#005032;"&gt;pinMuxType_t&lt;/span&gt;&lt;span style="color:#000000;"&gt; &lt;/span&gt;&lt;span style="color:#0000c0;"&gt;type&lt;/span&gt;&lt;span style="color:#000000;font-weight:bold;"&gt;;&lt;/span&gt;&lt;span style="color:#000000;"&gt; &lt;/span&gt;&lt;span style="color:#3f7f5f;"&gt;//which pin &lt;/span&gt;&lt;span style="color:#3f7f5f;text-decoration:underline;"&gt;mux&lt;/span&gt;&lt;span style="color:#3f7f5f;"&gt; is needed for peripheral&lt;/span&gt;&lt;/p&gt;
&lt;p style="margin:0;"&gt;&lt;span style="color:#000000;"&gt; &lt;/span&gt;&lt;span style="color:#005032;"&gt;uint32_t&lt;/span&gt;&lt;span style="color:#000000;"&gt; &lt;/span&gt;&lt;span style="color:#0000c0;"&gt;id&lt;/span&gt;&lt;span style="color:#000000;font-weight:bold;"&gt;;&lt;/span&gt;&lt;span style="color:#000000;"&gt; &lt;/span&gt;&lt;span style="color:#3f7f5f;"&gt;//pad, pin, waveform, &lt;/span&gt;&lt;span style="color:#3f7f5f;text-decoration:underline;"&gt;adc&lt;/span&gt;&lt;span style="color:#3f7f5f;"&gt; channel, etc&lt;/span&gt;&lt;/p&gt;
&lt;p style="margin:0;"&gt;&lt;span style="color:#000000;"&gt; &lt;/span&gt;&lt;span style="color:#005032;"&gt;pinMuxType_t&lt;/span&gt;&lt;span style="color:#000000;"&gt; &lt;/span&gt;&lt;span style="color:#0000c0;"&gt;sleepType&lt;/span&gt;&lt;span style="color:#000000;font-weight:bold;"&gt;;&lt;/span&gt;&lt;span style="color:#000000;"&gt; &lt;/span&gt;&lt;span style="color:#3f7f5f;"&gt;//what to do with pin when you sleep&lt;/span&gt;&lt;/p&gt;
&lt;p style="margin:0;"&gt;&lt;span style="color:#000000;"&gt;}&lt;/span&gt;&lt;span style="color:#005032;"&gt;pin_t&lt;/span&gt;&lt;span style="color:#000000;font-weight:bold;"&gt;;&lt;/span&gt;&lt;/p&gt;
&lt;p style="margin:0;"&gt;&lt;span style="color:#000000;font-weight:bold;"&gt;&lt;/span&gt;&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p style="margin:0;"&gt;Then I define a pin like:&lt;/p&gt;
&lt;p style="margin:0;"&gt;&lt;/p&gt;
&lt;p style="margin:0;"&gt;&lt;/p&gt;
&lt;p style="margin:0;"&gt;&lt;span style="background-color:#ffffff;padding:0px 0px 0px 2px;"&gt;&lt;span style="background-color:#ffffff;color:#000000;font-family:&amp;#39;Consolas&amp;#39;;font-size:11pt;white-space:pre;"&gt;&lt;span style="color:#7f0055;font-weight:bold;"&gt;#define&lt;/span&gt;&lt;span style="color:#000000;"&gt; DAIG_LED_PIN (&lt;/span&gt;&lt;span style="color:#7f0055;"&gt;const&lt;/span&gt;&lt;span style="color:#000000;"&gt; pin_t){PIN_PA15, &lt;/span&gt;&lt;span style="color:#7f0055;"&gt;nullptr&lt;/span&gt;&lt;span style="color:#000000;"&gt;, PERPIHERAL_GPIO_OUTPUT_LOW, 0, PERPIHERAL_GPIO_OUTPUT_LOW}&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p style="margin:0;"&gt;&lt;span style="background-color:#ffffff;padding:0px 0px 0px 2px;"&gt;&lt;br /&gt;Now a function like setting pin low is: &lt;/span&gt;&lt;/p&gt;
&lt;p style="margin:0;"&gt;&lt;span style="background-color:#ffffff;padding:0px 0px 0px 2px;"&gt;&lt;/span&gt;&lt;/p&gt;
&lt;div style="background-color:#ffffff;padding:0px 0px 0px 2px;"&gt;
&lt;div style="background-color:#ffffff;color:#000000;font-family:&amp;#39;Consolas&amp;#39;;font-size:11pt;white-space:pre;"&gt;
&lt;p style="margin:0;"&gt;&lt;span style="color:#7f0055;"&gt;static&lt;/span&gt;&lt;span style="color:#000000;"&gt; &lt;/span&gt;&lt;span style="color:#7f0055;"&gt;inline&lt;/span&gt;&lt;span style="color:#000000;"&gt; &lt;/span&gt;&lt;span style="color:#7f0055;"&gt;void&lt;/span&gt;&lt;span style="color:#000000;"&gt; &lt;/span&gt;&lt;span style="color:#000000;font-weight:bold;"&gt;PinLow&lt;/span&gt;&lt;span style="color:#000000;"&gt; (&lt;/span&gt;&lt;span style="color:#7f0055;"&gt;const&lt;/span&gt;&lt;span style="color:#000000;"&gt; &lt;/span&gt;&lt;span style="color:#005032;"&gt;pin_t&lt;/span&gt;&lt;span style="color:#000000;"&gt; pin) &lt;/span&gt;&lt;span style="color:#7f0055;"&gt;__attribute__&lt;/span&gt;&lt;span style="color:#000000;"&gt;((always_inline))&lt;/span&gt;&lt;span style="color:#000000;font-weight:bold;"&gt;;&lt;/span&gt;&lt;/p&gt;
&lt;p style="margin:0;"&gt;&lt;span style="color:#7f0055;"&gt;static&lt;/span&gt;&lt;span style="color:#000000;"&gt; &lt;/span&gt;&lt;span style="color:#7f0055;"&gt;inline&lt;/span&gt;&lt;span style="color:#000000;"&gt; &lt;/span&gt;&lt;span style="color:#7f0055;"&gt;void&lt;/span&gt;&lt;span style="color:#000000;"&gt; &lt;/span&gt;&lt;span style="color:#000000;font-weight:bold;"&gt;PinLow&lt;/span&gt;&lt;span style="color:#000000;"&gt; (&lt;/span&gt;&lt;span style="color:#7f0055;"&gt;const&lt;/span&gt;&lt;span style="color:#000000;"&gt; &lt;/span&gt;&lt;span style="color:#005032;"&gt;pin_t&lt;/span&gt;&lt;span style="color:#000000;"&gt; pin)&lt;/span&gt;&lt;/p&gt;
&lt;p style="margin:0;"&gt;&lt;span style="color:#000000;"&gt;{&lt;/span&gt;&lt;/p&gt;
&lt;p style="margin:0;"&gt;&lt;span style="color:#000000;"&gt; &lt;/span&gt;&lt;span style="color:#ff8000;font-weight:bold;"&gt;PORT&lt;/span&gt;&lt;span style="color:#000000;font-weight:bold;"&gt;-&amp;gt;&lt;/span&gt;&lt;span style="color:#0000c0;"&gt;Group&lt;/span&gt;&lt;span style="color:#000000;"&gt;[&lt;/span&gt;&lt;span style="background-color:#d4d4d4;color:#ff8000;font-weight:bold;"&gt;PIN_GET_PORT&lt;/span&gt;&lt;span style="color:#000000;"&gt;(pin&lt;/span&gt;&lt;span style="color:#000000;font-weight:bold;"&gt;.&lt;/span&gt;&lt;span style="color:#0000c0;"&gt;pinNum&lt;/span&gt;&lt;span style="color:#000000;"&gt;)]&lt;/span&gt;&lt;span style="color:#000000;font-weight:bold;"&gt;.&lt;/span&gt;&lt;span style="color:#0000c0;"&gt;OUTCLR&lt;/span&gt;&lt;span style="color:#000000;font-weight:bold;"&gt;.&lt;/span&gt;&lt;span style="color:#0000c0;"&gt;reg&lt;/span&gt;&lt;span style="color:#000000;font-weight:bold;"&gt;=&lt;/span&gt;&lt;span style="color:#000000;"&gt;(1&lt;/span&gt;&lt;span style="color:#000000;font-weight:bold;"&gt;&amp;lt;&amp;lt;&lt;/span&gt;&lt;span style="color:#ff8000;font-weight:bold;"&gt;PIN_GET_PIN&lt;/span&gt;&lt;span style="color:#000000;"&gt;(pin&lt;/span&gt;&lt;span style="color:#000000;font-weight:bold;"&gt;.&lt;/span&gt;&lt;span style="color:#0000c0;"&gt;pinNum&lt;/span&gt;&lt;span style="color:#000000;"&gt;))&lt;/span&gt;&lt;span style="color:#000000;font-weight:bold;"&gt;;&lt;/span&gt;&lt;/p&gt;
&lt;p style="margin:0;"&gt;&lt;span style="color:#000000;"&gt;}&lt;/span&gt;&lt;/p&gt;
&lt;p style="margin:0;"&gt;&lt;span style="color:#000000;"&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p style="margin:0;"&gt;&lt;span style="color:#000000;"&gt;so in the code if you have &lt;/span&gt;&lt;/p&gt;
&lt;p style="margin:0;"&gt;&lt;span style="color:#000000;"&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p style="margin:0;"&gt;&lt;strong&gt;&lt;span style="color:#000000;"&gt;PinLow(DAIG_LED_PIN);&lt;/span&gt;&lt;/strong&gt;&lt;/p&gt;
&lt;p style="margin:0;"&gt;&lt;span style="color:#000000;"&gt;&lt;span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p style="margin:0;"&gt;&lt;span style="color:#000000;"&gt;&lt;span&gt;The function parameter is a constant, the function is inline&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p style="margin:0;"&gt;&lt;span style="color:#000000;"&gt;&lt;span&gt;so the preprocessor/compiler can optimize it. Now the whole&lt;br /&gt;function call is optimized at compile time to the fewest assembly instructions as possible.&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p style="margin:0;"&gt;&lt;span style="color:#000000;"&gt;&lt;span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p style="margin:0;"&gt;&lt;span style="color:#000000;"&gt;&lt;span&gt;This #define of a const struct trick works great as the structure is&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p style="margin:0;"&gt;&lt;span style="color:#000000;"&gt;&lt;span&gt;not put in flash or RAM and can be optimized by compiler for no memory &lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p style="margin:0;"&gt;&lt;span style="color:#000000;"&gt;&lt;span&gt;or run time performance hits. &lt;br /&gt;&lt;br /&gt;So I think much of the devicetree system could use a similar method to&lt;br /&gt;make the macros more readable. Then if the initialization of drivers&lt;br /&gt;was done with a static inline function before main, us mortals could read &lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p style="margin:0;"&gt;&lt;span style="color:#000000;"&gt;&lt;span&gt;The code and understand. Maybe even work around issues (if we can disable&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p style="margin:0;"&gt;&lt;span style="color:#000000;"&gt;&lt;span&gt;regen of the devicetree macros). &lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p style="margin:0;"&gt;&lt;span style="color:#000000;"&gt;&lt;span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p style="margin:0;"&gt;&lt;span style="color:#000000;"&gt;&lt;span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p style="margin:0;"&gt;&lt;span style="color:#000000;"&gt;&lt;span&gt; &lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p style="margin:0;"&gt;&lt;span style="color:#000000;"&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p style="margin:0;"&gt;&lt;span style="background-color:#ffffff;padding:0px 0px 0px 2px;"&gt;&lt;/span&gt;&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Delay UART initialization in Zephyr</title><link>https://devzone.nordicsemi.com/thread/486705?ContentTypeID=1</link><pubDate>Thu, 30 May 2024 13:48:25 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:89c6e8de-0af6-44b4-aa7c-5734fca31649</guid><dc:creator>AHaug</dc:creator><description>[quote user="trampas"]That will not work as that on power up the TX pin goes high which is not allowed.&amp;nbsp; &amp;nbsp;The TX pin must stay low (or tristated) until we are ready, for personnel safety reasons.&amp;nbsp; &amp;nbsp;&amp;nbsp;[/quote]
&lt;p&gt;Ah, if this is not an option then the suggestion I made is&amp;nbsp;not too helpful.&lt;/p&gt;
[quote user="trampas"]I have posted on the Zephyr forum and this delayed initialization with devicetrees is a feature in the bleeding edge of Zephyr but not in the version we have.&amp;nbsp;&lt;br /&gt;Other suggestions I have received is to add hardware to make sure pins are disconnected.&amp;nbsp; This would work but adding hardware to work around Zephyr is a bit insane and costly.&amp;nbsp;&amp;nbsp;[/quote]
&lt;p&gt;If you don&amp;#39;t mind, could you share that discussion here for reference? The suggestion is interesting, but as you mention it&amp;#39;s costly for something that&amp;nbsp;&lt;em&gt;should&lt;/em&gt; be possible to do in software.&lt;/p&gt;
[quote user="trampas"]I have been trying to figure out if the driver can be setup and initialized outside of the devicetree.&amp;nbsp; I personally do not like devicetrees as they are too complex and rigid and the macro foo is insane.&amp;nbsp; Thus I would greatly prefer a solution which removes device trees and gives the developers back control over the initialization process.&amp;nbsp; &amp;nbsp;Yes I do know that devicetrees is part of the koolaid that you drink when you join the Zephyr cult, and I will have to adapt or change careers.&amp;nbsp;[/quote]
&lt;p&gt;I see where you&amp;#39;re coming from w.r.t this. There are both upsides and downsides to the Macro based Zephyr&amp;nbsp;&lt;span style="text-decoration:line-through;"&gt;cult&lt;/span&gt; environment, but hey atleast the coolaid is tasty when it works. The feedback is something we&amp;#39;re aware of, specially w.r.t&amp;nbsp;&lt;em&gt;relatively&lt;/em&gt; basic applications using more classical peripherals rather than controlling 2-3 wireless stacks/standards with more.&amp;nbsp; Hopefully you will find the frustration less and less present with time&lt;/p&gt;
&lt;p&gt;I&amp;#39;ll bring the question to the Nordic developers and raise a feature request for this and if it&amp;#39;s not already started from the Zephyr side I will share a PR if it gets picked up by them.&lt;/p&gt;
&lt;p&gt;Kind regards,&lt;br /&gt;Andreas&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Delay UART initialization in Zephyr</title><link>https://devzone.nordicsemi.com/thread/486399?ContentTypeID=1</link><pubDate>Wed, 29 May 2024 11:19:25 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:f51c9d54-fa47-4cc8-86fc-a01f797b5726</guid><dc:creator>trampas</dc:creator><description>&lt;p&gt;That will not work as that on power up the TX pin goes high which is not allowed.&amp;nbsp; &amp;nbsp;The TX pin must stay low (or tristated) until we are ready, for personnel safety reasons.&amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;If we try to turn pin over to GPIO in main() then what happens is on power up TX goes high, main then drives low.&amp;nbsp; Additionally in the datasheet it says the UART must be disabled before you change pins to GPIO.&amp;nbsp;&lt;br /&gt;&lt;br /&gt;I did try using the pinctrl and power manager to disable the UART and then set a pinctrl state for sleep with TX/RX pulled low.&amp;nbsp; When I put the peripheral in the sleep mode the RX pin does go low, but the TX remains high.&amp;nbsp; I did not go and debug the UARTE driver to figure out what is wrong, but it did not work as expected.&amp;nbsp; Also this still has issue of the TX pin going high before main() where we would sleep peripheral.&amp;nbsp;&amp;nbsp;&lt;br /&gt;&lt;br /&gt;I have posted on the Zephyr forum and this delayed initialization with devicetrees is a feature in the bleeding edge of Zephyr but not in the version we have.&amp;nbsp;&lt;br /&gt;Other suggestions I have received is to add hardware to make sure pins are disconnected.&amp;nbsp; This would work but adding hardware to work around Zephyr is a bit insane and costly.&amp;nbsp;&amp;nbsp;&lt;br /&gt;&lt;br /&gt;I have been trying to figure out if the driver can be setup and initialized outside of the devicetree.&amp;nbsp; I personally do not like devicetrees as they are too complex and rigid and the macro foo is insane.&amp;nbsp; Thus I would greatly prefer a solution which removes device trees and gives the developers back control over the initialization process.&amp;nbsp; &amp;nbsp;Yes I do know that devicetrees is part of the koolaid that you drink when you join the Zephyr cult, and I will have to adapt or change careers.&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Delay UART initialization in Zephyr</title><link>https://devzone.nordicsemi.com/thread/486341?ContentTypeID=1</link><pubDate>Wed, 29 May 2024 08:59:49 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:8f214a2a-2fb8-47af-847d-4dc199fc6b34</guid><dc:creator>AHaug</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;You could always use&amp;nbsp;&lt;a href="https://developer.nordicsemi.com/nRF_Connect_SDK/doc/latest/zephyr/hardware/peripherals/gpio.html#c.gpio_pin_configure_dt"&gt;gpio_pin_configure_dt&lt;/a&gt;() to configure GPIOs during runtime when the time is right, or any other uart-specific functions from the &lt;a href="https://developer.nordicsemi.com/nRF_Connect_SDK/doc/latest/zephyr/hardware/peripherals/uart.html"&gt;UART API &lt;/a&gt;that suits your applications needs.&lt;/p&gt;
&lt;p&gt;Is this sufficient for you or do you want to do the full initialization when you see fit?&lt;/p&gt;
&lt;p&gt;Kind regards,&lt;br /&gt;Andreas&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>