<?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>How to use the nrfx_spim on Zephyr 3.1?</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/89272/how-to-use-the-nrfx_spim-on-zephyr-3-1</link><description>On Zephyr `2.7` I have following code to setup a SPIM on a custom board: Device tree: 
 main.c: 
 
 Now this no longer works on Zephyr `3.1`. I temporarily tried it with `CONFIG_PINCTRL=n` but simply do not see any data on the bus. The correct way would</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Thu, 30 Jun 2022 14:30:03 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/89272/how-to-use-the-nrfx_spim-on-zephyr-3-1" /><item><title>RE: How to use the nrfx_spim on Zephyr 3.1?</title><link>https://devzone.nordicsemi.com/thread/374947?ContentTypeID=1</link><pubDate>Thu, 30 Jun 2022 14:30:03 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:3deb5f26-7aa6-4703-ba95-66da6fa2313e</guid><dc:creator>Simon</dc:creator><description>&lt;p&gt;Hello, sorry for misleading you and providing you with a not working method.&amp;nbsp;Test the approach provided by Tristen instead:&amp;nbsp;&amp;nbsp;&lt;a href="https://devzone.nordicsemi.com/f/nordic-q-a/89246/which-macro-to-get-sck-mosi-and-miso-pin-on-spi-master/374615"&gt;RE: Which macro to get sck, mosi and miso pin on spi master&lt;/a&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Simon&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to use the nrfx_spim on Zephyr 3.1?</title><link>https://devzone.nordicsemi.com/thread/374604?ContentTypeID=1</link><pubDate>Tue, 28 Jun 2022 17:01:57 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:f868957a-7b9c-4eb5-af6a-097714552ce2</guid><dc:creator>Simon</dc:creator><description>&lt;p&gt;I&amp;#39;ll look into this tomorrow.&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Simon&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to use the nrfx_spim on Zephyr 3.1?</title><link>https://devzone.nordicsemi.com/thread/374386?ContentTypeID=1</link><pubDate>Mon, 27 Jun 2022 15:36:32 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:148129f8-48c2-4730-8006-2ccdc070d12a</guid><dc:creator>CacO3</dc:creator><description>&lt;p&gt;Hi Simon&lt;/p&gt;
&lt;p&gt;Thanks for your paciente!&lt;/p&gt;
&lt;p&gt;I tried your suggestions, how ever I get following error:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;zephyr/include/generated/devicetree_unfixed.h:8615:37: 
  error: &amp;#39;DT_N_S_soc_S_spi_4002f000_P_mosi_pin&amp;#39; undeclared (first use in this function); 
  did you mean &amp;#39;DT_N_S_soc_S_spi_4002f000_P_status&amp;#39;?&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;on using it as following:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;
#define MOSI_PIN DT_PROP(DT_NODELABEL(spi3), mosi_pin)

    spi_config.mosi_pin = NRF_GPIO_PIN_MAP(0,MOSI_PIN);&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;So something seems to be missing but I can&amp;#39;t figure out what&amp;nbsp;&lt;span class="emoticon" data-url="https://devzone.nordicsemi.com/cfs-file/__key/system/emoji/1f61e.svg" title="Disappointed"&gt;&amp;#x1f61e;&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to use the nrfx_spim on Zephyr 3.1?</title><link>https://devzone.nordicsemi.com/thread/374376?ContentTypeID=1</link><pubDate>Mon, 27 Jun 2022 15:04:33 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:f233efa4-67ac-442a-b57f-806f385a30aa</guid><dc:creator>Simon</dc:creator><description>&lt;p&gt;&lt;strong&gt;Update 30.6.2022: Added strikethrough to incorrect statements&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="text-decoration:line-through;"&gt;As I mentioned in&amp;nbsp;&amp;nbsp;&lt;a href="https://devzone.nordicsemi.com/f/nordic-q-a/89246/which-macro-to-get-sck-mosi-and-miso-pin-on-spi-master"&gt;Which macro to get sck, mosi and miso pin on spi master&lt;/a&gt;,&amp;nbsp;use&amp;nbsp;DT_PROP_OR&amp;nbsp;or&amp;nbsp;DT_PROP&amp;nbsp;to fetch the pins from the device tree.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="text-decoration:line-through;"&gt;For example, to fetch the miso pin from spi3, you can do the following:&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;#define MISO_PIN DT_PROP(DT_NODELABEL(spi3), mosi_pin)
.
.
.
spi_config.miso_pin = NRF_GPIO_PIN_MAP(0,MISO_PIN);&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;I haven&amp;#39;t tested this, so please let me know if it works or not.&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Siom&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to use the nrfx_spim on Zephyr 3.1?</title><link>https://devzone.nordicsemi.com/thread/374276?ContentTypeID=1</link><pubDate>Mon, 27 Jun 2022 07:59:11 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:129cfeb0-a49c-4615-a647-efc8a0566912</guid><dc:creator>CacO3</dc:creator><description>&lt;p&gt;Dear Simon&lt;/p&gt;
&lt;p&gt;Thank you! That helped me to migrate to pinctrl usage.&lt;/p&gt;
&lt;p&gt;How ever I still haven&amp;#39;t understood how to reference such a pin directly.&lt;/p&gt;
&lt;p&gt;I have now following in my device tree:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;    /* SPI Interface to ADC
     * nCS_ADC:  P0.16 GPIO_4
     * SCLK_ADC: P0.13 GPIO_1
     * DIN_ADC:  P0.14 GPIO_2
     * DOUT_ADC: P0.15 GPIO_3
     */
    spi3_default: spi3_default {
        group1 {
            psels = &amp;lt;NRF_PSEL(SPIM_SCK, 0, 13)&amp;gt;,
                &amp;lt;NRF_PSEL(SPIM_MISO, 0, 15)&amp;gt;,
                &amp;lt;NRF_PSEL(SPIM_MOSI, 0, 14)&amp;gt;;
        };
    };
&amp;amp;pinctrl {
    spi3_sleep: spi3_sleep {
        group1 {
            psels = &amp;lt;NRF_PSEL(SPIM_SCK, 0, 13)&amp;gt;,
                &amp;lt;NRF_PSEL(SPIM_MISO, 0, 15)&amp;gt;,
                &amp;lt;NRF_PSEL(SPIM_MOSI, 0, 14)&amp;gt;;
            low-power-enable;
        };
    };
};


&amp;amp;spi3 {
    compatible= &amp;quot;nordic,nrf-spim&amp;quot;;
    status = &amp;quot;okay&amp;quot;;
    pinctrl-0 = &amp;lt;&amp;amp;spi3_default&amp;gt;;
    pinctrl-1 = &amp;lt;&amp;amp;spi3_sleep&amp;gt;;
    pinctrl-names = &amp;quot;default&amp;quot;, &amp;quot;sleep&amp;quot;;
};&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;And in my code:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;NRF_GPIO_PIN_MAP(0,13)

nrfx_spim_config_t spi_config;
spi_config.miso_pin = NRF_GPIO_PIN_MAP(0,13); // How to fetch from device tree?
[..]&lt;/pre&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to use the nrfx_spim on Zephyr 3.1?</title><link>https://devzone.nordicsemi.com/thread/373988?ContentTypeID=1</link><pubDate>Thu, 23 Jun 2022 14:32:10 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:293d01fd-d482-43ee-a700-983d9d2d6210</guid><dc:creator>Simon</dc:creator><description>&lt;p&gt;I just answered a similar question here:&amp;nbsp;&amp;nbsp;&lt;a href="https://devzone.nordicsemi.com/f/nordic-q-a/89246/which-macro-to-get-sck-mosi-and-miso-pin-on-spi-master"&gt;Which macro to get sck, mosi and miso pin on spi master&lt;/a&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Let me know if that answer is not sufficient&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Simon&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>