<?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>Fixes of the SD card driver</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/87999/fixes-of-the-sd-card-driver</link><description>I am using the SD card driver from nRF5 SDK v17.0.2. Device nrf52840, IDE Segger, Custom PCB. nRF52 DK as progremmer. 
 There are problems when deinitializing the SD card. 
 If initialization failed, the deinitialization procedure is called in the interrupt</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Sat, 10 Sep 2022 02:05:05 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/87999/fixes-of-the-sd-card-driver" /><item><title>RE: Fixes of the SD card driver</title><link>https://devzone.nordicsemi.com/thread/385580?ContentTypeID=1</link><pubDate>Sat, 10 Sep 2022 02:05:05 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:92a5a8d4-c949-4c20-ac41-7103c4bf639b</guid><dc:creator>Keith Wakeham</dc:creator><description>&lt;p&gt;I don&amp;#39;t know if this might help, but I was recently looking to solve the problem of someone removing the SD card while mounted. Unmounting then Re-mounting wouldn&amp;#39;t work for some unknown reason. What I suspected is that the SPI bus was not uniniting and so the app_sd drivers were skipping the 80 clock cycles to get it back to spi mode. I solved it by adding a&amp;nbsp;&lt;span&gt;app_sdc_uninit&lt;/span&gt;&lt;span&gt;(); after the following&lt;/span&gt;&lt;/p&gt;
&lt;div&gt;
&lt;div&gt;&lt;span&gt;ff_result&lt;/span&gt;&lt;span&gt; = &lt;/span&gt;&lt;span&gt;f_mount&lt;/span&gt;&lt;span&gt;(&lt;/span&gt;&lt;span&gt;NULL&lt;/span&gt;&lt;span&gt;, &lt;/span&gt;&lt;span&gt;&amp;quot;&amp;quot;&lt;/span&gt;&lt;span&gt;, &lt;/span&gt;&lt;span&gt;1&lt;/span&gt;&lt;span&gt;);&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;div&gt;
&lt;div&gt;&lt;span&gt;disk_state&lt;/span&gt;&lt;span&gt; = &lt;/span&gt;&lt;span&gt;disk_uninitialize&lt;/span&gt;&lt;span&gt;(&lt;/span&gt;&lt;span&gt;0&lt;/span&gt;&lt;span&gt;);&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;div&gt;
&lt;div&gt;&lt;span&gt;app_sdc_uninit&lt;/span&gt;&lt;span&gt;();&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span&gt;This is abbreviated as the checks and such are removed, but the app_sdc_uninit() resolved this so that when someone attempts a write now it remounts and initializes.&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;This might just be brute forcing it but seems to work until I can figure out why disk_uninitialize(0) which should be uniniting the SPI bus isn&amp;#39;t.&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>