<?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>BLE radio interrupts interfering with SPI</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/127744/ble-radio-interrupts-interfering-with-spi</link><description>I make a BLE/USB MIDI controller that has an NRF52840 receiving sensor data by SPI from an Atmega 32u4 at 2Mhz. The NRF52840 is the SPI master (SPIM3). When I&amp;#39;m using BLE and sending a lot of MIDI messages, an SPI transfer occasionally gets corrupted</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Sat, 11 Apr 2026 18:29:31 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/127744/ble-radio-interrupts-interfering-with-spi" /><item><title>RE: BLE radio interrupts interfering with SPI</title><link>https://devzone.nordicsemi.com/thread/564809?ContentTypeID=1</link><pubDate>Sat, 11 Apr 2026 18:29:31 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:09119876-a0d1-4b41-b6aa-53bf34f5df13</guid><dc:creator>hmolesworth</dc:creator><description>&lt;p&gt;For best performance maybe try SPIM1, since SPIM1 eclipses the RADIO, UART and SAADC:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;// Bus master nRF52840
// =======================
// CPU
// CTRL-AP
// USB
// CRYPTOCELL
// SPIM1/SPIS1/TWIM1/TWIS1  Same priority and mutually exclusive
// RADIO
// CCM/ECB/AAR              Same priority and mutually exclusive
// SAADC
// UARTE0
// SPIM0/SPIS0/TWIM0/TWIS0  Same priority and mutually exclusive
// SPIM2/SPIS2              Same priority and mutually exclusive
// NFCT
// I2S
// PDM
// PWM0
// PWM1
// PWM2
// QSPI
// PWM3
// UARTE1
// SPIM3
&lt;/pre&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: BLE radio interrupts interfering with SPI</title><link>https://devzone.nordicsemi.com/thread/564802?ContentTypeID=1</link><pubDate>Fri, 10 Apr 2026 16:36:03 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:27581659-46f5-43a5-9a79-5392fbd2b9f5</guid><dc:creator>Andrew Mowry</dc:creator><description>&lt;p&gt;After more testing it does seem like SPIM2 is considerably more reliable, so I&amp;#39;m just going to switch to that for now.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: BLE radio interrupts interfering with SPI</title><link>https://devzone.nordicsemi.com/thread/564746?ContentTypeID=1</link><pubDate>Thu, 09 Apr 2026 23:15:40 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:7b4d1108-2a84-4ffb-8823-0f2030a60afd</guid><dc:creator>Andrew Mowry</dc:creator><description>&lt;p&gt;Okay, thanks again. I&amp;#39;ll look into this.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: BLE radio interrupts interfering with SPI</title><link>https://devzone.nordicsemi.com/thread/564745?ContentTypeID=1</link><pubDate>Thu, 09 Apr 2026 22:09:21 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:23a7272c-9aaa-4449-8690-457fbc8f4699</guid><dc:creator>hmolesworth</dc:creator><description>&lt;p&gt;Yes, quite so; this issue affects all nRF52840 peripherals, and when multiple peripheral&amp;#39;s DMA bus Masters are actively competing for a particular AHB RAM bus the peripheral priority order dictates those least affected. SPIM3 happens to be the worst, but BLE Radio DMA and CPU memory access eclipse all the SPIMs. The true test to indicate if this is the problem at hand is to enforce SPIM DMA buffers in isolated RAM sections, easy to do but compiler-dependent syntax. Verify linker success in isolating the DMA buffer memory addresses by examining the linker map before testing.&lt;/p&gt;
&lt;p&gt;One method is to simply reserve an entire RAM block and align on the RAM boundary so nothing other than the CPU can access, preferably between DMA transfers which implies double-buffering if not; doesn&amp;#39;t matter which RAM segment is used:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;uint8_t Spim3BufferTx[8192] __attribute__((section(&amp;quot;.bss&amp;quot;), aligned(0x2000), used));
uint8_t Spim3BufferRx[8192] __attribute__((section(&amp;quot;.bss&amp;quot;), aligned(0x2000), used));
struct spi_buf *pSpiBufferTx = Spim3BufferTx;
&lt;/pre&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: BLE radio interrupts interfering with SPI</title><link>https://devzone.nordicsemi.com/thread/564744?ContentTypeID=1</link><pubDate>Thu, 09 Apr 2026 21:01:09 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:9b510bff-594d-4a2c-9a1b-521469c65c97</guid><dc:creator>Andrew Mowry</dc:creator><description>&lt;p&gt;Thanks for your help. Would the stall occur with SPIM2 as well or this issue only related to SPIM3? In my tests the SPIM2 behavior seems very similar.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: BLE radio interrupts interfering with SPI</title><link>https://devzone.nordicsemi.com/thread/564742?ContentTypeID=1</link><pubDate>Thu, 09 Apr 2026 19:33:45 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:afbd6fb3-b6e0-4a56-8f31-b80a21f58edd</guid><dc:creator>hmolesworth</dc:creator><description>&lt;p&gt;You are likely seeing an AHB bus stall caused by the BLE code/peripherals tying up the AHB bus when the SPIM is looking to transfer data. This can be avoided by placing SPIM buffers in separate Slave AHB areas by reserving RAM segments for those buffers. I wrote some details on how to do this which are applicable on the nRF52840&amp;nbsp;&lt;a href="https://devzone.nordicsemi.com/f/nordic-q-a/74309/stallstat-on-spim3-writes-to-flash-ic/306613"&gt;stallstat-on-spim3&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;The stall is detectable on SPIM3 only, not SPIM0/1/2, though I&amp;#39;m not sure how reliable the detection is; clearing might require writing a &amp;#39;1&amp;#39; to the register, I forget now. Worth incrementing a counter on each occurrence to verify stall detection. The stall mechanism on SPIM3 is supposed to hold the SPIM3 SCK until the bus is available, but I&amp;#39;m not sure if this actually works.&lt;/p&gt;
&lt;p&gt;&lt;em&gt;&amp;quot;6.25.6.13 STALLSTAT Address offset: 0x400&lt;/em&gt;&lt;br /&gt;&lt;em&gt; Stall status for EasyDMA RAM accesses. The fields in this register are set to STALL by hardware whenever a&amp;nbsp;stall occurs and can be cleared (set to NOSTALL) by the CPU.&amp;quot;&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;&lt;em&gt;&lt;/em&gt;Edit: Also note SPIM3 has the lowest bus priority of all, which is not helpful! See&amp;nbsp;&lt;a href="https://devzone.nordicsemi.com/f/nordic-q-a/101279/spim3-peripheral-not-reliable/434005"&gt;spim3-peripheral-not-reliable&lt;/a&gt;&amp;nbsp;and maybe also look at&amp;nbsp;&lt;a href="https://devzone.nordicsemi.com/f/nordic-q-a/105239/adc-infuriating-behaviour-with-multi-channel-scan-using-ppi-to-rtc/454753"&gt;adc-infuriating-behaviour&lt;/a&gt;&amp;nbsp;and&amp;nbsp;&lt;a href="https://devzone.nordicsemi.com/f/nordic-q-a/108184/start-pwms-synchronous/469330"&gt;start-pwms-synchronous&lt;/a&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: BLE radio interrupts interfering with SPI</title><link>https://devzone.nordicsemi.com/thread/564737?ContentTypeID=1</link><pubDate>Thu, 09 Apr 2026 15:45:20 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:c494b253-d096-4290-a889-5c7c1b69305c</guid><dc:creator>Andrew Mowry</dc:creator><description>&lt;p&gt;If it&amp;#39;s helpful, I&amp;#39;m using P0_15 for MOSI, P0_20 for MISO, and P0_13 for SCK, and P1_02 for SS. I believe that MOSI and SCK are set to high drive by the Adafruit NRF board package that I&amp;#39;m using.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>