<?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>Using NRFX SPIS in nRF Connect SDK</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/115516/using-nrfx-spis-in-nrf-connect-sdk</link><description>Hello, 
 I&amp;#39;m trying to use a SPIS peripheral from the NRFX library in a nRF Connect SDK 2.7.0 project. The reason for using the NRFX library is to clear a GPIO pin in the SPI ISR when the transfer is finished. 
 The prj.conf contains the following options</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Thu, 17 Oct 2024 13:28:26 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/115516/using-nrfx-spis-in-nrf-connect-sdk" /><item><title>RE: Using NRFX SPIS in nRF Connect SDK</title><link>https://devzone.nordicsemi.com/thread/506734?ContentTypeID=1</link><pubDate>Thu, 17 Oct 2024 13:28:26 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:e1b6431c-ae09-48d3-9db8-0c07cc0df9f7</guid><dc:creator>Anthony</dc:creator><description>&lt;p&gt;Than you very much for you answers.&lt;/p&gt;
&lt;p&gt;My bad, I was calling IRQ_CONNECT() outside of any function, thinking it operated at compile time.&lt;/p&gt;
&lt;p&gt;The test project with NRFX SPIS works now with the following configuration:&lt;/p&gt;
&lt;p&gt;nrf52840dk_nrf52840.overlay :&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;&amp;amp;spi1 {
    // Keep the compatible property otherwise a compile error (&amp;#39;NRFX_SPIS1_INST_IDX&amp;#39; undeclared here) occurs.
    // https://devzone.nordicsemi.com/f/nordic-q-a/93675/nrfx-spi-migration-from-ncs-1-9-to-ncs-2-0
    // https://github.com/nrfconnect/sdk-zephyr/commit/451a6ed6abbf35262bbcf0f926e7941f6c74c632
    compatible = &amp;quot;nordic,nrf-spis&amp;quot;;
    status = &amp;quot;disabled&amp;quot;;
};&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;prj.conf :&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;CONFIG_NRFX_SPIS1=y
&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;With the C code based on modules/hal/nordic/nrfx/samples/src/nrfx_spim_spis/advanced_non_blocking/main.c.&lt;/p&gt;
&lt;p&gt;Regarding Turbo&amp;#39;s interrogation, the reason for using (or evaluating the usage of) the nrfx library is to have more flexibility compared to the standard Zephyr way of configuring peripherals (although Zephyr also offers some flexibility: &lt;a href="https://github.com/nrfconnect/sdk-zephyr/blob/v3.0.99-ncs1/samples/boards/nrf/dynamic_pinctrl/src/remap.c#L61"&gt;https://github.com/nrfconnect/sdk-zephyr/blob/v3.0.99-ncs1/samples/boards/nrf/dynamic_pinctrl/src/remap.c#L61&lt;/a&gt; ) . For example, we are evaluating the feasibility of detecting the activation of the SPIS CSN pin without linking it physically to another GPIO, enabling/disabling peripherals at runtime, or changing their configuration dynamically, etc.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Using NRFX SPIS in nRF Connect SDK</title><link>https://devzone.nordicsemi.com/thread/506469?ContentTypeID=1</link><pubDate>Wed, 16 Oct 2024 10:25:50 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:477a8712-e487-44f4-ae2e-2e76bbf4e89a</guid><dc:creator>H&amp;#229;kon Alseth</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;If you want to not initialize the zephyr SPI driver, but only use the nrfx driver, you need to:&lt;/p&gt;
&lt;p&gt;1. enable the node in DT&lt;/p&gt;
&lt;p&gt;2. disable the zephyr driver component, in this case: CONFIG_SPI=n&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Now the subsys will not enable nrfx_spis during boot-up, which is the root-cause of this behavior:&lt;/p&gt;
[quote user="Anthony Groccia"]If I remove the IRQ_CONNECT line, the project compiles but nrfx_spis_init() returns NRFX_ERROR_ALREADY.[/quote]
&lt;p&gt;&amp;nbsp;&amp;nbsp;&lt;/p&gt;
[quote user="Anthony Groccia"]where the IRQ_CONNECT line is as follows :[/quote]
&lt;p&gt;It seems that you are&amp;nbsp;defining SPI&lt;span style="text-decoration:underline;"&gt;&lt;strong&gt;M&lt;/strong&gt;&lt;/span&gt;_INST_IDX, and not SPIS_INST_IDX. Could you check if this is the problem?&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Kind regards,&lt;/p&gt;
&lt;p&gt;Håkon&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Using NRFX SPIS in nRF Connect SDK</title><link>https://devzone.nordicsemi.com/thread/506457?ContentTypeID=1</link><pubDate>Wed, 16 Oct 2024 09:53:03 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:7f4293ed-31ce-4c43-bbc4-181fdcf625ac</guid><dc:creator>Turbo J</dc:creator><description>&lt;p&gt;Any reason why you try to code yourself instead of just using the existing driver in zephyr/drivers/spi/spi_nrfx_spis.c source file? It would get enabled via correct DT automagically.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Using NRFX SPIS in nRF Connect SDK</title><link>https://devzone.nordicsemi.com/thread/506452?ContentTypeID=1</link><pubDate>Wed, 16 Oct 2024 09:25:35 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:2cf592eb-0706-4fa7-8e91-ee5665dff55a</guid><dc:creator>Anthony</dc:creator><description>&lt;p&gt;Thank you for you answer.&lt;/p&gt;
&lt;p&gt;I tried to set the `status` field of the SPIS1 peripheral to &amp;quot;okay&amp;quot; in the device tree.&lt;br /&gt;When I put the line with IRQ_CONNECT(...), the following compile error occurs:&lt;br /&gt;&lt;br /&gt;&lt;pre class="ui-code" data-mode="text"&gt;C:/ncs/v2.7.0/zephyr/include/zephyr/arch/arm/irq.h:117:1: error: expected identifier or &amp;#39;(&amp;#39; before &amp;#39;{&amp;#39; token
  117 | { \
      | ^
C:/ncs/v2.7.0/zephyr/include/zephyr/irq.h:49:9: note: in expansion of macro &amp;#39;ARCH_IRQ_CONNECT&amp;#39;
   49 |         ARCH_IRQ_CONNECT(irq_p, priority_p, isr_p, isr_param_p, flags_p)
   
&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;where the IRQ_CONNECT line is as follows :&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;#define SPIM_INST_IDX 1

IRQ_CONNECT(NRFX_IRQ_NUMBER_GET(NRF_SPIS_INST_GET(SPIS_INST_IDX)), IRQ_PRIO_LOWEST, NRFX_SPIS_INST_HANDLER_GET(SPIS_INST_IDX), 0, 0);
&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;If I remove the IRQ_CONNECT line, the project compiles but nrfx_spis_init() returns NRFX_ERROR_ALREADY.&lt;/p&gt;
&lt;p&gt;I tried several other combinations. I also tried to define the SPI pin numbers in the device tree, but that didn&amp;#39;t solve the problem :&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;&amp;amp;pinctrl {
    spis_default: spis_default {
        group1 {
            psels = &amp;lt;NRF_PSEL(SPIS_SCK, 1, 04)&amp;gt;,
                &amp;lt;NRF_PSEL(SPIS_MISO, 1, 06)&amp;gt;,
                &amp;lt;NRF_PSEL(SPIS_MOSI, 1, 05)&amp;gt;;
        };
    };
};
&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;This is how the spis1 peripheral appears in the combined device tree in build/zephyr/zephyr.dts :&lt;br /&gt;&lt;pre class="ui-code" data-mode="text"&gt;		spi1: spi@40004000 {
			compatible = &amp;quot;nordic,nrf-spis&amp;quot;;
			#address-cells = &amp;lt; 0x1 &amp;gt;;
			#size-cells = &amp;lt; 0x0 &amp;gt;;
			reg = &amp;lt; 0x40004000 0x1000 &amp;gt;;
			interrupts = &amp;lt; 0x4 0x1 &amp;gt;;
			max-frequency = &amp;lt; 0x7a1200 &amp;gt;;
			easydma-maxcnt-bits = &amp;lt; 0x10 &amp;gt;;
			status = &amp;quot;okay&amp;quot;;
			pinctrl-0 = &amp;lt; &amp;amp;spis_default &amp;gt;;
			pinctrl-1 = &amp;lt; &amp;amp;spi1_sleep &amp;gt;;
			pinctrl-names = &amp;quot;default&amp;quot;, &amp;quot;sleep&amp;quot;;
			def-char = &amp;lt; 0xff &amp;gt;;
		};&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;I also tried to compile the example in&amp;nbsp;modules/hal/nordic/nrfx/samples/src/nrfx_spim_spis/advanced_non_blocking/ using `west build -b nrf52840dk_nrf52840`, but the compilation fails (CMake Error at CMakeLists.txt:11 GET_DEVICE_CONFIG_FILES Macro invoked with incorrect arguments).&lt;/p&gt;
&lt;p&gt;Would you have other ideas that I can try ? I can upload the succinct source file of my project if needed.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Using NRFX SPIS in nRF Connect SDK</title><link>https://devzone.nordicsemi.com/thread/506303?ContentTypeID=1</link><pubDate>Tue, 15 Oct 2024 12:16:30 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:8ffdc443-166e-4eff-b787-eb89518f022b</guid><dc:creator>Turbo J</dc:creator><description>&lt;p&gt;The status property must be set to &amp;quot;okay&amp;quot;. Might fix the IRQ_CONNECT() problem.&lt;/p&gt;
&lt;p&gt;Not sure if you needed more changes in the device tree - look at the combined tree files in the build/zephyr directory.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>