<?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>SPI event handler not beeing called</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/38519/spi-event-handler-not-beeing-called</link><description>Hi I am currently runnign into a problem that my SPI driver does not fire a spi_event after a while. 
 The code is as follows: 
 
 The thing is, it is working at first. My main function is as follows: 
 
 It works at first, the diosplay is switched on</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Fri, 15 Oct 2021 11:23:41 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/38519/spi-event-handler-not-beeing-called" /><item><title>RE: SPI event handler not beeing called</title><link>https://devzone.nordicsemi.com/thread/334321?ContentTypeID=1</link><pubDate>Fri, 15 Oct 2021 11:23:41 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:8bd7098a-e1e5-48d8-ac83-c12062dcd560</guid><dc:creator>Hugh Wu</dc:creator><description>&lt;p&gt;Hi all,&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Just for sharing.&lt;/p&gt;
&lt;p&gt;I have a similar problem, too. The spi_event_handler function works at first, but after connecting to the BLE central device, and then I want to call the spi_transfer function, and then the spi_event_handler into the infinite loop even I add APP_ERROR_CHECK to check nrf_drv_spi_transfer().&lt;/p&gt;
&lt;p&gt;It&amp;#39;s problem that the SPI has lower interrupt priority than the BLE connect handler. So, I modify my sdk_config.h to modify the SPI IRQ from 6 to 2, and then it works.&lt;/p&gt;
&lt;p&gt;&lt;a href="https://devzone.nordicsemi.com/f/nordic-q-a/26274/spi-handler-callbacks-not-invoked-with-nrf_sdh_dispatch_model_interrupt"&gt;devzone.nordicsemi.com/.../spi-handler-callbacks-not-invoked-with-nrf_sdh_dispatch_model_interrupt&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Also, you can check this link.&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Thanks&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;BRs,&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Hugh&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: SPI event handler not beeing called</title><link>https://devzone.nordicsemi.com/thread/195342?ContentTypeID=1</link><pubDate>Fri, 28 Jun 2019 10:50:17 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:66c0d448-4bb9-49c8-81b9-542bd8304dbb</guid><dc:creator>inghowe83</dc:creator><description>&lt;p&gt;Hi @Bastian, what did you change to fix the deadlock issue?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: SPI event handler not beeing called</title><link>https://devzone.nordicsemi.com/thread/195341?ContentTypeID=1</link><pubDate>Fri, 28 Jun 2019 10:49:29 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:7ef3f3d5-164b-47ce-871e-646d437522f4</guid><dc:creator>inghowe83</dc:creator><description>&lt;p&gt;Hi There. I face similar issue, I not sure what you mean by BSP event handler. How to waiting for SPI out side the BSP handler?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: SPI event handler not beeing called</title><link>https://devzone.nordicsemi.com/thread/148852?ContentTypeID=1</link><pubDate>Fri, 14 Sep 2018 14:54:43 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:fc0ed2d5-8911-4ba9-ba5b-9db60e83b0b1</guid><dc:creator>Bastian</dc:creator><description>&lt;p&gt;thats it, thank you&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: SPI event handler not beeing called</title><link>https://devzone.nordicsemi.com/thread/148849?ContentTypeID=1</link><pubDate>Fri, 14 Sep 2018 14:29:26 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:e75b60a4-c44e-4a18-bb0b-33b35bbb706b</guid><dc:creator>MartinBL</dc:creator><description>&lt;p&gt;It could be an issue with interrupt nesting. It seems like you start the SPI transfer from within the BSP event handler. If the SPI has lower interrupt priority than the BSP handler, then the SPI handler will not be executed before the BSP handler has completed. But since you are effectively waiting for the SPI in the BSP handler you end up in a dead lock.&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: SPI event handler not beeing called</title><link>https://devzone.nordicsemi.com/thread/148842?ContentTypeID=1</link><pubDate>Fri, 14 Sep 2018 13:48:01 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:10d5582b-1e3f-4d6a-8662-3af66eb30ab9</guid><dc:creator>Bastian</dc:creator><description>&lt;p&gt;Hi Martin,&lt;/p&gt;
&lt;p&gt;I put an APP_ERROR_CHECK around nrf_drv_spi_transfer and it did not raise an issue. I stepped throught the function and it seems like it runs as it is supposed to do. Return value of nrf_drv_spi_transfer is SUCCESS.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: SPI event handler not beeing called</title><link>https://devzone.nordicsemi.com/thread/148814?ContentTypeID=1</link><pubDate>Fri, 14 Sep 2018 12:10:21 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:be2d9407-3557-40d5-9698-737fa6141d15</guid><dc:creator>MartinBL</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;You should check the return code of&amp;nbsp;&lt;span&gt;&lt;a href="http://infocenter.nordicsemi.com/topic/com.nordic.infocenter.sdk5.v15.2.0/group__nrf__drv__spi.html#ga8502179e5c7d7a7da5104a4c1febe1e0"&gt;nrf_drv_spi_transfer&lt;/a&gt;().&amp;nbsp;If the function of some reason fails, it will return an error code&amp;nbsp;without starting any SPI transfers. Hence you will never get a call back, and you will be stuck&amp;nbsp;in the while loop.&amp;nbsp;&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: SPI event handler not beeing called</title><link>https://devzone.nordicsemi.com/thread/148800?ContentTypeID=1</link><pubDate>Fri, 14 Sep 2018 11:46:50 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:65f6fb73-a7fe-4600-82bd-a110d8beb1b5</guid><dc:creator>KevinL</dc:creator><description>&lt;p&gt;Hi Bastian,&lt;/p&gt;
&lt;p&gt;I can&amp;#39;t really help you much with your issue as I think I&amp;#39;m having the &lt;a href="https://devzone.nordicsemi.com/f/nordic-q-a/37551/spi-miso-buffer-doesn-t-fill"&gt;same issue&lt;/a&gt;. Do you enter the infinite loop in while(!spi_xfer_done) when you call from the context of a button event handler?&lt;/p&gt;
&lt;p&gt;I have been advised to used the SPIM peripheral (nrfx_spim). Although this has not solved the issue for me yet, it does seem to be the currently advised go-to SPI peripheral.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>