<?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>Enable SPI interrupt into GPIOTE handler</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/95191/enable-spi-interrupt-into-gpiote-handler</link><description>Dear Sirs, 
 In an application, an external GPIO Interrupt triggers the control of an SPI device. This means that the application would be running into the GPIO service routine and, at the same time, enabling the management of the SPI interrupts. 
 I</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Wed, 04 Jan 2023 08:31:31 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/95191/enable-spi-interrupt-into-gpiote-handler" /><item><title>RE: Enable SPI interrupt into GPIOTE handler</title><link>https://devzone.nordicsemi.com/thread/403103?ContentTypeID=1</link><pubDate>Wed, 04 Jan 2023 08:31:31 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:92b8fc26-8aac-4625-91bd-4872031cc979</guid><dc:creator>jinvers</dc:creator><description>&lt;p&gt;Hello Vidar,&lt;/p&gt;
&lt;p&gt;Thank you for the confirmation Vidar.&lt;/p&gt;
&lt;p&gt;Regards,&lt;/p&gt;
&lt;p&gt;Joel&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Enable SPI interrupt into GPIOTE handler</title><link>https://devzone.nordicsemi.com/thread/403098?ContentTypeID=1</link><pubDate>Wed, 04 Jan 2023 08:08:49 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:63ed2379-ad53-4fb7-8ea0-d3224e4c2624</guid><dc:creator>Vidar Berg</dc:creator><description>&lt;p&gt;Hello Joel,&lt;/p&gt;
&lt;p&gt;Sorry, I mistook&amp;nbsp;SPI_DEFAULT_CONFIG_IRQ_PRIORITY for&amp;nbsp;NRFX_SPI_DEFAULT_CONFIG_IRQ_PRIORITY. The former is the old configuration symbol which will take precedence.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;As you already pointed out, the SPI_IRQ_PRIORITY symbol is not being applied anywhere.&amp;nbsp;We should have removed&amp;nbsp;it from the&amp;nbsp;sdk_config.h to avoid confusions like these.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Regards,&lt;/p&gt;
&lt;p&gt;Vidar&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Enable SPI interrupt into GPIOTE handler</title><link>https://devzone.nordicsemi.com/thread/403015?ContentTypeID=1</link><pubDate>Tue, 03 Jan 2023 15:22:45 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:21bf609a-bd7a-49c1-85a6-e186b96d3705</guid><dc:creator>jinvers</dc:creator><description>&lt;p&gt;Hello Vidar,&lt;/p&gt;
&lt;p&gt;Thank you for your message.&lt;/p&gt;
&lt;p&gt;What I had in the code was the next:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;#ifndef SPI_IRQ_PRIORITY
#define SPI_IRQ_PRIORITY 2  
#endif

#ifndef SPI_DEFAULT_CONFIG_IRQ_PRIORITY
#define SPI_DEFAULT_CONFIG_IRQ_PRIORITY 6
#endif&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;Considering this, I thought that the SPI_IRQ would have a greater priority that the GPIOTE (2 over 3 respectively). However, this didn&amp;#39;t work until I did the&amp;nbsp; next:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;#ifndef SPI_IRQ_PRIORITY
#define SPI_IRQ_PRIORITY 6
//#define SPI_IRQ_PRIORITY 2
#endif

#ifndef SPI_DEFAULT_CONFIG_IRQ_PRIORITY
//#define SPI_DEFAULT_CONFIG_IRQ_PRIORITY 6
#define SPI_DEFAULT_CONFIG_IRQ_PRIORITY 2
#endif&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;What I have seen searching into the code of the nrf SPI driver is that the SPI_IRQ_PRIORITY value is not used in any part of the project. It uses the SPI_DEFAULT_CONFIG_IRQ_PRIORITY value. Modifying this last value, then it works.&lt;/p&gt;
&lt;p&gt;Regards,&lt;/p&gt;
&lt;p&gt;Joel&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Enable SPI interrupt into GPIOTE handler</title><link>https://devzone.nordicsemi.com/thread/403007?ContentTypeID=1</link><pubDate>Tue, 03 Jan 2023 14:47:42 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:b076f64e-4c66-422f-bd3f-fcff8445a797</guid><dc:creator>Vidar Berg</dc:creator><description>&lt;p&gt;Hello Joel,&lt;/p&gt;
&lt;p&gt;SPI_IRQ_PRIORITY will override the&amp;nbsp;SPI_DEFAULT_CONFIG_IRQ_PRIORITY if both are defined in your sdk_config.h file because the legacy symbol will take precedence. For more on this, please see nrfx migration guide here&amp;nbsp;&lt;a href="https://infocenter.nordicsemi.com/topic/sdk_nrf5_v17.1.0/nrfx_migration_user_guide.html?cp=8_1_2_7_0#getting_started_replace_nrf_drv_options_keep"&gt;https://infocenter.nordicsemi.com/topic/sdk_nrf5_v17.1.0/nrfx_migration_user_guide.html?cp=8_1_2_7_0#getting_started_replace_nrf_drv_options_keep&lt;/a&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;/span&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Vidar&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Enable SPI interrupt into GPIOTE handler</title><link>https://devzone.nordicsemi.com/thread/402494?ContentTypeID=1</link><pubDate>Thu, 29 Dec 2022 08:32:20 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:4f2b10ea-05ff-4f29-aee1-9e90c0bedcb7</guid><dc:creator>jinvers</dc:creator><description>&lt;p&gt;Hello Keneth,&lt;/p&gt;
&lt;p&gt;I have checked the change in using SPI_DEFAULT_CONFIG_IRQ_PRIORITY to 2, and it looks it works.&lt;/p&gt;
&lt;p&gt;By the way, what is the utility of the SPI_IRQ_PRIORITY definition?&lt;/p&gt;
&lt;p&gt;Regards,&lt;/p&gt;
&lt;p&gt;Joel&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Enable SPI interrupt into GPIOTE handler</title><link>https://devzone.nordicsemi.com/thread/402418?ContentTypeID=1</link><pubDate>Wed, 28 Dec 2022 10:55:02 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:4c22f423-b53d-47d4-9144-b18d065da9f0</guid><dc:creator>jinvers</dc:creator><description>&lt;p&gt;Hello Keneth,&lt;/p&gt;
&lt;p&gt;Thank you for your message.&lt;/p&gt;
&lt;p&gt;Related to the nrf_drv_gpiote_init() function, there is a call to it like this:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;    if (!nrf_drv_gpiote_is_init())
    {
        err_code = nrf_drv_gpiote_init();
        APP_ERROR_CHECK(err_code);
    }
&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;I see that the nrf_drv_gpiote_init() functions is defined in nrf_drv_gpiote.h file like this:&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;#define nrf_drv_gpiote_init               nrfx_gpiote_init&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;And inside the nrfx_gpiote_init) function is used the definition NRFX_GPIOTE_CONFIG_IRQ_PRIORITY, which I confirm that has the value 3 in the sdk_config.h.&lt;/p&gt;
&lt;p&gt;Related to the nrf_drv_spi_init() function, I follow an example that uses the next code:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;APP_ERROR_CHECK(nrf_drv_spi_init(&amp;amp;spi_sst, &amp;amp;spi_config, spi_sst_event_handler, NULL));&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;Where the spi_config structure is created and defined like this:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;nrf_drv_spi_config_t spi_config[2] = {NRF_DRV_SPI_DEFAULT_CONFIG, NRF_DRV_SPI_DEFAULT_CONFIG};&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;and then I modify specific variables of the structure for defining the pins:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;    spi_config.ss_pin   = SST_SPI_1_SS_PIN;
    spi_config.miso_pin = SST_SPI_1_MISO_PIN;
    spi_config.mosi_pin = SST_SPI_1_MOSI_PIN;
    spi_config.sck_pin  = SST_SPI_1_SCK_PIN;
&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;but I don&amp;rsquo;t change the value of spi_config.irq_priority.&lt;/p&gt;
&lt;p&gt;The NRF_DRV_SPI_DEFAULT_CONFIG structure is defined in the nrf_drv_spi.h file with the value:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;.irq_priority = SPI_DEFAULT_CONFIG_IRQ_PRIORITY,&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;Which has a default value of 6 in the sdk_config.h. I have not changed this because I misunderstood that the definition to be changed was SPI_IRQ_PRIORITY to value 2. So, I understand that I should also change SPI_DEFAULT_CONFIG_IRQ_PRIORITY to 2.&amp;nbsp; I Will check it.&lt;/p&gt;
&lt;p&gt;By the way, what is the utility of the SPI_IRQ_PRIORITY definition?&lt;/p&gt;
&lt;p&gt;Regards,&lt;/p&gt;
&lt;p&gt;Joel&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Enable SPI interrupt into GPIOTE handler</title><link>https://devzone.nordicsemi.com/thread/402403?ContentTypeID=1</link><pubDate>Wed, 28 Dec 2022 10:07:05 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:5eb793a9-14ef-4645-af7c-cae864d74947</guid><dc:creator>Kenneth</dc:creator><description>&lt;p&gt;Hello,&lt;/p&gt;
&lt;p&gt;Assuming this work when calling&amp;nbsp;&lt;span&gt;nrf_drv_spi_transfer() and&amp;nbsp;wait_end_xfer_accel() from main. Then the most likely issue is that the interrupt priorities for SPI and GPIOTE is not setup correctly, maybe double check the spi_config.irq_priority passed to nrf_drv_spi_init() is indeed 2, do the same with nrf_drv_gpiote_init() to check it&amp;#39;s indeed 3.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Kenneth&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>