<?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>Reinitialize SD-card</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/121424/reinitialize-sd-card</link><description>Hi 
 I am using nRF52840 with SDK 15.3. 
 I have a project where I uses FatFS to write to a SD-card with SPI interface (SPIM3). This works very well. 
 I am now trying to shut down the power to SD-card between writes, but I am facing some problems reinitializing</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Tue, 20 May 2025 13:15:59 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/121424/reinitialize-sd-card" /><item><title>RE: Reinitialize SD-card</title><link>https://devzone.nordicsemi.com/thread/536229?ContentTypeID=1</link><pubDate>Tue, 20 May 2025 13:15:59 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:2fb2574f-d7f4-4746-a79e-58f66bcf8028</guid><dc:creator>Simonr</dc:creator><description>&lt;p&gt;Hi&lt;/p&gt;
&lt;p&gt;What do you mean with &amp;quot;unregister&amp;quot; the SD card here exactly. You should indeed uninitialize the SD card before reinitializing it to remount an SD card. What&amp;#39;s the difference between the successful &amp;quot;remount&amp;quot; and the failing &amp;quot;f_mount&amp;quot; function you describe here?&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Simon&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Reinitialize SD-card</title><link>https://devzone.nordicsemi.com/thread/535911?ContentTypeID=1</link><pubDate>Mon, 19 May 2025 06:55:31 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:6c8c72ae-eb86-45ea-9b87-db71db195865</guid><dc:creator>mosgaard2000</dc:creator><description>&lt;p&gt;Just some follow up questions regarding correct flow.&lt;/p&gt;
&lt;p&gt;Should this function be called each time I remount the SD-card and is there a way to unregister it?&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;void Init_SDcard_HW(void)&lt;/strong&gt;&lt;br /&gt;&lt;span&gt;{&lt;/span&gt;&lt;br /&gt;&lt;span&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; static diskio_blkdev_t drives[] = {&lt;/span&gt;&lt;br /&gt;&lt;span&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; DISKIO_BLOCKDEV_CONFIG(NRF_BLOCKDEV_BASE_ADDR(m_block_dev_sdc, block_dev), NULL)&lt;/span&gt;&lt;br /&gt;&lt;span&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; };&lt;/span&gt;&lt;br /&gt;&lt;span&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; diskio_blockdev_register(drives, ARRAY_SIZE(drives));&lt;/span&gt;&lt;br /&gt;&lt;span&gt;}&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;and should there be an&amp;nbsp;&amp;nbsp;disk_state = disk_uninitialize(0); call somewhere when disabling the sd-card?&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Reinitialize SD-card</title><link>https://devzone.nordicsemi.com/thread/535269?ContentTypeID=1</link><pubDate>Wed, 14 May 2025 08:13:58 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:98446e3a-caaa-4b1c-812f-c43e1572cd28</guid><dc:creator>mosgaard2000</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;I will try to implement some more logging.&lt;/p&gt;
&lt;p&gt;In the mean time the remount function returns successfull af both init calls. The problem is that the last f_mount fails.&lt;/p&gt;
&lt;p&gt;If I have the memset line active (setting fs to 0) then f_mount just hangs forever. If I remove the memset call then f_mount returns FR_DISK_ERR.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Reinitialize SD-card</title><link>https://devzone.nordicsemi.com/thread/535253?ContentTypeID=1</link><pubDate>Wed, 14 May 2025 07:31:48 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:85cf454e-3905-4623-a8e8-213abfbf85ea</guid><dc:creator>Simonr</dc:creator><description>&lt;p&gt;Hi&lt;/p&gt;
&lt;p&gt;In your _remount() function, it doesn&amp;#39;t seem like you&amp;#39;re checking the status of the SD card before trying to initialize it. Also, you should try adding some logging to debug and see what kind of error messages you&amp;#39;re getting returned when trying to remount the board here, as troubleshooting without logs will be only guesswork from our side I&amp;#39;m afraid.&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Simon&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>