<?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>Can&amp;#39;t seem to get SPI pinctrl to work (SDK 1.8.0)</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/115603/can-t-seem-to-get-spi-pinctrl-to-work-sdk-1-8-0</link><description>This might be a simple one to answer but I&amp;#39;m struggling to find documentation on what to do here since we&amp;#39;re still using an ancient SDK on 9160. 
 I have a working board file with SPI2 in use: 
 I have a problem that appears after my first spi_write </description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Wed, 23 Oct 2024 13:35:47 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/115603/can-t-seem-to-get-spi-pinctrl-to-work-sdk-1-8-0" /><item><title>RE: Can't seem to get SPI pinctrl to work (SDK 1.8.0)</title><link>https://devzone.nordicsemi.com/thread/507608?ContentTypeID=1</link><pubDate>Wed, 23 Oct 2024 13:35:47 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:2151cb9d-887e-4c23-ad0d-b8915b4f4cf4</guid><dc:creator>Jake</dc:creator><description>&lt;p&gt;Hi Edvin,&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Good question, I haven&amp;#39;t tried interacting with the pin before doing SPI, but I do know that it is low until the first transaction.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;We&amp;#39;ve discovered a hack that we&amp;#39;re going to use until we can get our SDK upgraded: the MOSI pin remains low if the final bit of the last SPI transaction is 0. This didn&amp;#39;t work when I tried it previously because we had both CPHA and CPOL set, without those the hack works. We&amp;#39;re sending a byte 0 with no CS when we want MOSI to go low now.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Many thanks&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Can't seem to get SPI pinctrl to work (SDK 1.8.0)</title><link>https://devzone.nordicsemi.com/thread/507383?ContentTypeID=1</link><pubDate>Tue, 22 Oct 2024 13:34:18 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:098cbb25-2cb2-4e01-95f7-93993e310758</guid><dc:creator>Edvin</dc:creator><description>&lt;p&gt;Are you able to control the pin if you don&amp;#39;t use it for SPI first? If so, is it possible to upload your current application, then I can have a look. (Or a strip down version of the application, that replicates the issue).&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Edvin&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Can't seem to get SPI pinctrl to work (SDK 1.8.0)</title><link>https://devzone.nordicsemi.com/thread/507196?ContentTypeID=1</link><pubDate>Mon, 21 Oct 2024 16:37:51 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:3769381b-1569-43ea-9336-89eb8c3a76bf</guid><dc:creator>Jake</dc:creator><description>&lt;p&gt;Re:pm, I admit I didn&amp;#39;t check for errors from&amp;nbsp;&lt;span&gt;pm_device_state_set&lt;/span&gt;, but the pin wasn&amp;#39;t released for me to use as GPIO. It may have silently complained about no sleep configuration being available.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Yes, we have tried precisely&amp;nbsp;&lt;code&gt;gpio_pin_configure&lt;/code&gt; as DISCONNECT, INPUT as you suggest, or even OUTPUT followed by being set to 0. None of the options take control of the pin, it remains under control of the SPI driver.&lt;/p&gt;
&lt;p&gt;There is an &lt;code&gt;spi_release&lt;/code&gt; function which sounds like it might&amp;#39;ve helped, but the description in the definition makes clear that it&amp;#39;s related to something else. We tried it anyway in comination with the 3 options above, none worked.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;We just cannot find a way of getting SPI to let go of the pins so we can use simple GPIO!&lt;/p&gt;
&lt;p&gt;Any more ideas?&lt;/p&gt;
&lt;p&gt;Many thanks&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Can't seem to get SPI pinctrl to work (SDK 1.8.0)</title><link>https://devzone.nordicsemi.com/thread/507168?ContentTypeID=1</link><pubDate>Mon, 21 Oct 2024 13:38:38 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:72399aa4-fe8a-4a5e-899f-0c7bfb62b260</guid><dc:creator>Edvin</dc:creator><description>[quote user="qTelec"]I&amp;#39;ve tried using pm but it seems to have no effect without pinctrl in place,[/quote]
&lt;p&gt;Does that mean you managed to disable the SPI? Or did it print some error to the log?&lt;/p&gt;
&lt;p&gt;When you have done this, how did you try to control the pin? (I am sorry for not providing you a step by step guide, but I didn&amp;#39;t start working with NCS much before 2.0.0, so I am not quite sure. I would say that instead of putting it to output low, you should set the pin as a disconnected input pin, which is the default pin state on the chip before it is initialized to do something.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;You could try:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt; gpio_pin_configure(led, LED0_GPIO_PIN, LED0_GPIO_FLAGS);&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;(fetched from the ncs\bootloader\mcuboot\zephyr\main.c)&lt;/p&gt;
&lt;p&gt;but obviously change the pin number and LED0_GPIO_FLAGS. Try either setting it to:&amp;nbsp;GPIO_DISCONNECTED or&amp;nbsp;GPIO_INPUT.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Edvin&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Can't seem to get SPI pinctrl to work (SDK 1.8.0)</title><link>https://devzone.nordicsemi.com/thread/507092?ContentTypeID=1</link><pubDate>Mon, 21 Oct 2024 09:20:25 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:d55be31a-17de-49f1-9f50-b5c4a4ea4324</guid><dc:creator>Jake</dc:creator><description>&lt;p&gt;Thanks for confirming.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Yes, we&amp;#39;re powering down our peripheral by completely removing the power, so the MOSI line being high means that it&amp;#39;s indicentally half-powering the chip and causing a significant current leak. We would like all pins to be low.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;How do I disable SPI to release these pins like you mention? I&amp;#39;ve tried using pm but it seems to have no effect without pinctrl in place, and there seems to be no way of uninitialising the SPI driver before I force the pin low with GPIO (it has no effect). I&amp;#39;ve tried a few other things but cannot seem to override this pin state at all.&lt;/p&gt;
&lt;p&gt;The pins are in a good state after boot until the first SPI transaction happens. Is there a known working way of undoing what my first spi_write is doing to the SPI pins?&lt;/p&gt;
&lt;p&gt;Many thanks&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Can't seem to get SPI pinctrl to work (SDK 1.8.0)</title><link>https://devzone.nordicsemi.com/thread/506990?ContentTypeID=1</link><pubDate>Fri, 18 Oct 2024 21:20:00 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:8c9d4a8a-9dd8-4b83-8241-eee1656549c9</guid><dc:creator>Edvin</dc:creator><description>&lt;p&gt;Hello,&lt;/p&gt;
&lt;p&gt;The pinctrl is not working in NCS v1.8.0. Only from v2.0.0 and onwards, so that is why you have a hard time to get it working.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Is the state of the MOSI pin between transactions actually causing any issues? It shouldn&amp;#39;t really matter.&lt;/p&gt;
&lt;p&gt;If you do, however want to control this pin, you need to disable the SPI, and then control the pin &amp;quot;normally&amp;quot; when it is no longer being controlled by the SPI.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Edvin&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>