<?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>Formatting a SD-Card with the nRF52840</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/67945/formatting-a-sd-card-with-the-nrf52840</link><description>Hi DevZone, 
 
 Does anyone have any experience with performing a SD-Card format with the nRF52840 . This is to avoid removing the SD-Card from the hardware when a format is required. I have been looking through the FatFS example from the Nordic SDK version</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Thu, 12 Nov 2020 14:14:54 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/67945/formatting-a-sd-card-with-the-nrf52840" /><item><title>RE: Formatting a SD-Card with the nRF52840</title><link>https://devzone.nordicsemi.com/thread/279758?ContentTypeID=1</link><pubDate>Thu, 12 Nov 2020 14:14:54 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:490ae15e-738c-4158-bed8-fd8c04b5d9b1</guid><dc:creator>Simonr</dc:creator><description>&lt;p&gt;Glad you were able to find a working solution Casper. If you think this case is resolved, please verify an answer that helped you in this case so that it will be easier for future users with the same or similar problems to resolve it quicker.&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: Formatting a SD-Card with the nRF52840</title><link>https://devzone.nordicsemi.com/thread/279748?ContentTypeID=1</link><pubDate>Thu, 12 Nov 2020 13:44:38 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:23a19522-3854-4810-be64-b3f095088b87</guid><dc:creator>Casper Kronborg Pedersen</dc:creator><description>&lt;p&gt;Hi Simonr,&lt;/p&gt;
&lt;p&gt;The f_mkfs function works on an SD-Card with normal SPI, even when the card has not been mounted.&lt;/p&gt;
&lt;p&gt;I am using the FAT32 filesystem and I selected that option for the f_mkfs function as well as letting the allocation unit be the default value (input a 0 to the function).&amp;nbsp;&lt;br /&gt;&lt;br /&gt;Thank you for your answers they were very helpful.&lt;/p&gt;
&lt;p&gt;Br. Casper&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Formatting a SD-Card with the nRF52840</title><link>https://devzone.nordicsemi.com/thread/279127?ContentTypeID=1</link><pubDate>Tue, 10 Nov 2020 07:08:48 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:b528b7f7-f638-447d-8b7a-b139eb932d9a</guid><dc:creator>Simonr</dc:creator><description>&lt;p&gt;Hi Casper&lt;/p&gt;
&lt;p&gt;Yes, you should be able to format the SD-card with normal SPI as well!&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: Formatting a SD-Card with the nRF52840</title><link>https://devzone.nordicsemi.com/thread/278928?ContentTypeID=1</link><pubDate>Mon, 09 Nov 2020 08:21:40 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:c46fe703-8f63-4c69-bea8-02903dc051c7</guid><dc:creator>Casper Kronborg Pedersen</dc:creator><description>&lt;p&gt;Hi Simonr,&lt;/p&gt;
&lt;p&gt;The SD-card is connected with normal SPI just like the example in SDK 15.3&lt;br /&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p&gt;Is it possible to format the SD-card regardless of what is in the memory with normal SPI? (MOSI, MISO, CLK, CS)&lt;br /&gt;&lt;br /&gt;I will experiment with the f_mkfs function, thank you :)&lt;/p&gt;
&lt;p&gt;Br. Casper&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Formatting a SD-Card with the nRF52840</title><link>https://devzone.nordicsemi.com/thread/278739?ContentTypeID=1</link><pubDate>Fri, 06 Nov 2020 09:44:09 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:2671fd3b-966f-41a0-b837-dc20eba24aa3</guid><dc:creator>Simonr</dc:creator><description>&lt;p&gt;Updates from a few colleagues:&lt;/p&gt;
&lt;p&gt;When accessing the memory module on the nRF52840DK over QSPI should definitely let you format an SD card, regardless of what&amp;#39;s in the memory.&lt;/p&gt;
&lt;p&gt;You can also use the f_mkfs() function to format the drive. This function&amp;nbsp; is documented &lt;a href="http://elm-chan.org/fsw/ff/doc/mkfs.html"&gt;here&lt;/a&gt;.&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: Formatting a SD-Card with the nRF52840</title><link>https://devzone.nordicsemi.com/thread/278635?ContentTypeID=1</link><pubDate>Thu, 05 Nov 2020 14:26:53 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:acbde8b2-4840-42bb-9201-b74c0677aab4</guid><dc:creator>Casper Kronborg Pedersen</dc:creator><description>&lt;p&gt;Hi Simonr,&lt;/p&gt;
&lt;p&gt;Thank you for getting back to me. I will look into the link you posted.&lt;/p&gt;
&lt;p&gt;Br. Casper&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Formatting a SD-Card with the nRF52840</title><link>https://devzone.nordicsemi.com/thread/278630?ContentTypeID=1</link><pubDate>Thu, 05 Nov 2020 14:22:35 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:54fc95c7-00ef-4496-abc8-b50f83dc5133</guid><dc:creator>Simonr</dc:creator><description>&lt;p&gt;Hi again Casper&lt;/p&gt;
&lt;p&gt;I&amp;#39;m sorry, but these diskio files and functions are very old, and has not been updated in ~4 years, so this is taking some time finding any answers to. I have asked about this internally, but no luck as of yet. In the meantime, might I suggest looking checking out &lt;a href="https://devzone.nordicsemi.com/f/nordic-q-a/39428/usb-msc-corruption/"&gt;this case on USB MSC corruption&lt;/a&gt;, which discusses the Fatfs and formatting in detail while waiting. It doesn&amp;#39;t seem to have the exact answer you&amp;#39;re looking for, but maybe you can get an idea of where to get started from that thread.&lt;/p&gt;
&lt;p&gt;I&amp;#39;ll keep you posted on any updates I get&amp;nbsp;internally. Thank you for your patience!&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: Formatting a SD-Card with the nRF52840</title><link>https://devzone.nordicsemi.com/thread/278472?ContentTypeID=1</link><pubDate>Wed, 04 Nov 2020 14:18:47 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:1d9eba64-54b1-49a0-b6b9-786cb97d75e0</guid><dc:creator>Casper Kronborg Pedersen</dc:creator><description>&lt;p&gt;Hi Simonr,&lt;/p&gt;
&lt;p&gt;Thank you for the reply.&lt;br /&gt;What I am looking for specifically is how to use the nRF52840 to perform the formatting of the SD-Card. I was thinking that it would make sense to be able to perform the formatting without a successful mount on the Fat32 filesystem, and actually as a reaction to a failed mount. The comment attached to the to the CTRL_FORMAT command in the diskio.h file suggests this as well in my opinion:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;/* Generic command (Not used by FatFs) */
#define CTRL_POWER			5	/* Get/Set power status */
#define CTRL_LOCK			6	/* Lock/Unlock media removal */
#define CTRL_EJECT			7	/* Eject media */
#define CTRL_FORMAT			8	/* Create physical format on the media */&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;From what I am finding I need to use the low level &amp;quot;IOCTL&amp;quot; functions on which I can&amp;#39;t find the information I need. Maybe I am wrong and a different approach is needed?&lt;/p&gt;
&lt;p&gt;I was not able to find any information about this using the search function, or by looking into the threads you linked above.&lt;/p&gt;
&lt;p&gt;Br. Casper&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Formatting a SD-Card with the nRF52840</title><link>https://devzone.nordicsemi.com/thread/278449?ContentTypeID=1</link><pubDate>Wed, 04 Nov 2020 13:11:51 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:8f070990-9532-4f9d-85a4-2e05365f5270</guid><dc:creator>Simonr</dc:creator><description>&lt;p&gt;Hi Casper&lt;/p&gt;
&lt;p&gt;There are quite a few tickets here on DevZone on SD card formatting. Please check out the following tickets:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href="https://devzone.nordicsemi.com/f/nordic-q-a/25317/fatfs-example-does-not-working-on-nrf52840-pdk/99771#99771"&gt;FatFS not working in nRF52840&lt;/a&gt;&amp;nbsp;(fixed by formatting).&lt;/li&gt;
&lt;li&gt;&lt;a href="https://devzone.nordicsemi.com/f/nordic-q-a/50308/using-exfat-micro-sd-card"&gt;Using exfat micro SD card&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;&lt;a href="https://devzone.nordicsemi.com/f/nordic-q-a/24334/fatfs-example-sdk14-0-0-not-working#post-id-163682"&gt;The FatFs example not working in SDK v14.0.0&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;You can also check out &lt;a href="https://devzone.nordicsemi.com/search?q=sd%20card%20formatting"&gt;the search function here on DevZone&lt;/a&gt; for more relevant cases. Hopefully, you&amp;#39;ll find your answer in some of these tickets.&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>