<?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>Change pin configuration</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/114222/change-pin-configuration</link><description>Hello, 
 I&amp;#39;m working with the nRF Connect SDK version 1.8, using Zephyr and a CC1101 radio module. The radio communicates via SPI, but at the beginning of the process, I need to perform a hardware reset. This reset requires changing the SPI pins configuration</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Tue, 27 Aug 2024 12:53:49 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/114222/change-pin-configuration" /><item><title>RE: Change pin configuration</title><link>https://devzone.nordicsemi.com/thread/499999?ContentTypeID=1</link><pubDate>Tue, 27 Aug 2024 12:53:49 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:f977791a-bd0a-4437-a45d-8bf4645cf337</guid><dc:creator>Hung Bui</dc:creator><description>&lt;p&gt;I&amp;#39;m afraid it still is. For example you can take a look at this &amp;quot;Dynamic Pin Control &amp;quot; sample.&amp;nbsp;&lt;br /&gt;&lt;a href="https://docs.nordicsemi.com/bundle/ncs-latest/page/zephyr/samples/boards/nrf/dynamic_pinctrl/README.html"&gt;https://docs.nordicsemi.com/bundle/ncs-latest/page/zephyr/samples/boards/nrf/dynamic_pinctrl/README.html&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;The sample only allows you to change the pins at boot stage.&lt;br /&gt;&lt;br /&gt;Our hardware supports reconfiguring pin in runtime.&amp;nbsp;But current Zephyr doesn&amp;#39;t offer that.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;br /&gt;You can try to reconfigure SPI pins instead of reset and continue running. But as I mentioned, it&amp;#39;s a hack and not officially supported.&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Change pin configuration</title><link>https://devzone.nordicsemi.com/thread/499988?ContentTypeID=1</link><pubDate>Tue, 27 Aug 2024 12:41:06 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:8e42466d-d5eb-4ec0-bb8d-aa6c3cd938c4</guid><dc:creator>Bartosz22</dc:creator><description>&lt;p&gt;It doesn&amp;#39;t sound ideal that I can&amp;#39;t change the pin configuration at runtime. Is this still the case with the latest version of Zephyr?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Change pin configuration</title><link>https://devzone.nordicsemi.com/thread/499979?ContentTypeID=1</link><pubDate>Tue, 27 Aug 2024 12:22:54 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:2378d428-90b9-415f-943a-2caca645d315</guid><dc:creator>Hung Bui</dc:creator><description>&lt;p&gt;Correct. As you already known, Zephyr doesn&amp;#39;t allow that. What I suggested was kind of a hack. So it&amp;#39;s not guarantee that if you reconfigure the SPI back it would work normally. So it&amp;#39;s better to trigger a reset instead.&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Change pin configuration</title><link>https://devzone.nordicsemi.com/thread/499975?ContentTypeID=1</link><pubDate>Tue, 27 Aug 2024 12:04:14 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:68b02912-5d10-4c37-9ab1-f0b6fb0d3fb4</guid><dc:creator>Bartosz22</dc:creator><description>&lt;p&gt;Based on what you&amp;#39;ve written, it&amp;#39;s not possible to:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Initialize some GPIOs as input and output pins (these are used for SPI: MOSI, MISO, SCK).&lt;/li&gt;
&lt;li&gt;Perform operations on these pins (write and read).&lt;/li&gt;
&lt;li&gt;Reconfigure them for SPI usage.&lt;/li&gt;
&lt;li&gt;Carry out standard SPI communication.&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;In summary, I can&amp;#39;t perform the steps described above without resetting the MCU in zephyr, correct?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Change pin configuration</title><link>https://devzone.nordicsemi.com/thread/499969?ContentTypeID=1</link><pubDate>Tue, 27 Aug 2024 11:53:14 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:1b67d56f-562e-4d82-95a2-a3789d961074</guid><dc:creator>Hung Bui</dc:creator><description>&lt;p&gt;Hi Bartosz,&amp;nbsp;&lt;br /&gt;As far as I know dynamically change pin configuration is done in build time on older Zephyr version (including v1.8). Even with pinctrl in newer Zephyr version it still requires a reset to change the pin configuration.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;In your case, you mentioned it&amp;#39;s a hardware reset that you want to do ? If it&amp;#39;s the case I think it&amp;#39;s possible to overwrite what Zephyr is configuring and control the pin directly via the chip&amp;#39;s registers. What you need to do is to stop any SPI activity. Then use&amp;nbsp;NRF_GPIO-&amp;gt;PIN_CNF to change the configuration and use NRF_GPIO-&amp;gt;OUTSET to set the GPIO pins. (You can also use nrfx_gpio library, see zephyr\samples\boards\nrf\system_off sample. )&lt;br /&gt;But I don&amp;#39;t think the system would work properly after that. So it&amp;#39;s better to trigger a chip reset after you are done with the GPIO operations.&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>