<?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>Zephyr Fatal Error while using nrfx_spim_xfer with interrupt on nrf52840</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/84430/zephyr-fatal-error-while-using-nrfx_spim_xfer-with-interrupt-on-nrf52840</link><description>Hello everyone, 
 I&amp;#39;m now having a problem while using nrfx_spim_xfer on nrf52840. I want to use nrfx_spim_xfer with a callback when transmitting is done. 
 My setup code is below: 
 
 
 However, it is not working and the system log is below: 
 *** Booting</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Mon, 07 Feb 2022 15:16:58 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/84430/zephyr-fatal-error-while-using-nrfx_spim_xfer-with-interrupt-on-nrf52840" /><item><title>RE: Zephyr Fatal Error while using nrfx_spim_xfer with interrupt on nrf52840</title><link>https://devzone.nordicsemi.com/thread/351599?ContentTypeID=1</link><pubDate>Mon, 07 Feb 2022 15:16:58 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:c1c18b38-7ed4-4701-9e38-f52756441d7b</guid><dc:creator>Vidar Berg</dc:creator><description>&lt;p&gt;Hello,&lt;/p&gt;
&lt;p&gt;When using nrfx drivers directly, you need to use the &lt;a href="https://developer.nordicsemi.com/nRF_Connect_SDK/doc/1.8.0/zephyr/reference/kernel/other/interrupts.html#c.IRQ_CONNECT"&gt;IRQ_CONNECT&lt;/a&gt;() macro to connected the IRQ to the drivers IRQ handler. For SPIM0, that is&amp;nbsp;&lt;strong&gt;&lt;/strong&gt;the &lt;a href="https://github.com/zephyrproject-rtos/hal_nordic/blob/b1db86f188c3c5864985e1bd18a849d53f1c0a2d/nrfx/mdk/nrf52833.h#L89"&gt;SPIM0 IRQ &lt;/a&gt;to the &lt;strong&gt;nrfx_spim_0_irq_handler &lt;/strong&gt;driver handler. Similar to how we do in the nRFx GPIOTE driver sample here: &lt;a href="https://github.com/nrfconnect/sdk-zephyr/blob/d5a653348eeab5a3bd6305e4f1cd2d6dcf56774a/samples/boards/nrf/nrfx/src/main.c#L35"&gt;https://github.com/nrfconnect/sdk-zephyr/blob/d5a653348eeab5a3bd6305e4f1cd2d6dcf56774a/samples/boards/nrf/nrfx/src/main.c#L35&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Vidar&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Edit: &lt;/strong&gt;I put together a sample based on the code you posted above and tested it against the &lt;span class="item"&gt;&lt;a title="SPI Slave Example" href="https://infocenter.nordicsemi.com/topic/sdk_nrf5_v17.1.0/spi_slave_example.html?cp=8_1_4_6_39"&gt;SPI Slave Example&lt;/a&gt;&lt;/span&gt; running on another DK:&lt;/p&gt;
&lt;p&gt;&lt;a href="https://devzone.nordicsemi.com/cfs-file/__key/communityserver-discussions-components-files/4/4353.nrfx_5F00_spim.zip"&gt;devzone.nordicsemi.com/.../4353.nrfx_5F00_spim.zip&lt;/a&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>