<?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>nrf52840 ble+sd card</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/125830/nrf52840-ble-sd-card</link><description>I’m developing a project on the nRF52840 that uses BLE + RTC + an SD card. It’s based on a previous project that only used BLE + RTC, and I’ve added the ability to store data on the SD card. However, a problem has appeared. In the BLE + RTC + SD card</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Wed, 26 Nov 2025 03:47:48 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/125830/nrf52840-ble-sd-card" /><item><title>RE: nrf52840 ble+sd card</title><link>https://devzone.nordicsemi.com/thread/555437?ContentTypeID=1</link><pubDate>Wed, 26 Nov 2025 03:47:48 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:094d6976-44b5-44a9-a128-364d2311655b</guid><dc:creator>quae</dc:creator><description>&lt;p&gt;hello PjGlasso&amp;nbsp;&lt;br /&gt;&lt;br /&gt;In my project, the SD write function only runs inside the main function. It doesn&amp;rsquo;t run continuously; the RTC handler slowly fills a buffer, and when the data reaches a certain amount, the SD write function is called in main. Also, when I look at the &lt;code data-start="251" data-end="261"&gt;spi_init&lt;/code&gt; function in &lt;code data-start="274" data-end="285"&gt;app_sdc.c&lt;/code&gt;, I see that &lt;code data-start="298" data-end="312"&gt;irq_priority&lt;/code&gt; is set to 6.&lt;br /&gt;&lt;br /&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nrf52840 ble+sd card</title><link>https://devzone.nordicsemi.com/thread/555431?ContentTypeID=1</link><pubDate>Wed, 26 Nov 2025 01:48:29 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:8777bbe2-38d3-43af-abd1-af9222f7dc0a</guid><dc:creator>PjGlasso</dc:creator><description>&lt;p data-start="6458" data-end="6715"&gt;Hi there,&lt;/p&gt;
&lt;p data-start="6458" data-end="6715"&gt;So I get this...When BLE + RTC + SD all run together and your SD writes start hanging waiting for the block_dev interrupt, it usually means the SD interrupt is either never firing or can&amp;rsquo;t preempt the context that&amp;rsquo;s doing the wait. On nRF52840 with BLE, you really need to:&lt;/p&gt;
&lt;ol data-start="6721" data-end="7225"&gt;
&lt;li data-start="6721" data-end="6834"&gt;
&lt;p data-start="6724" data-end="6834"&gt;Make sure all SD writes run from normal thread/main context, never directly from BLE or RTC callbacks or ISRs.&lt;/p&gt;
&lt;/li&gt;
&lt;li data-start="6837" data-end="7019"&gt;
&lt;p data-start="6840" data-end="7019"&gt;Check that the SPIM/SD interrupt priorities are compatible with the SoftDevice/BLE stack &amp;ndash; if they&amp;rsquo;re too high or misconfigured, the interrupt either won&amp;rsquo;t fire or will be masked.&lt;/p&gt;
&lt;/li&gt;
&lt;li data-start="7022" data-end="7102"&gt;
&lt;p data-start="7025" data-end="7102"&gt;Ensure only one &amp;ldquo;owner&amp;rdquo; task is using the SD card to avoid reentrancy issues.&lt;/p&gt;
&lt;/li&gt;
&lt;li data-start="7105" data-end="7222"&gt;
&lt;p data-start="7108" data-end="7222"&gt;Temporarily disable aggressive power-saving / clock gating to rule out HFCLK/SD bus being turned off mid-transfer.&lt;/p&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;p data-start="7228" data-end="7583"&gt;A good next step is to add logging/toggling inside the block_dev ISR and compare your IRQ priority and &lt;code data-start="7331" data-end="7345"&gt;sdk_config.h&lt;/code&gt; / &lt;code data-start="7348" data-end="7358"&gt;prj.conf&lt;/code&gt; against a minimal SD-only project that works reliably. I run BLE + RTC + SD together on the Xiao nRF52840 Dev Expansion board without problems, so the combo is workable &amp;ndash; the bug is most likely in the integration and timing.&lt;/p&gt;
&lt;p data-start="7228" data-end="7583"&gt;Post up the code if you can, We can look and give it a compile.&lt;/p&gt;
&lt;p data-start="7228" data-end="7583"&gt;HTH&lt;/p&gt;
&lt;p data-start="7228" data-end="7583"&gt;GL :-) PJ &lt;span class="emoticon" data-url="https://devzone.nordicsemi.com/cfs-file/__key/system/emoji/270c.svg" title="V"&gt;&amp;#x270c;&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>