<?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>fatfs sd card file system check and format</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/83356/fatfs-sd-card-file-system-check-and-format</link><description>Dear , 
 With nRF connect SDK, is there a way to check if the SD card is formatted with the correct file system, i.e. FATFS? If it&amp;#39;s not in FATFS, how can we format it via the program (NOT from PC via USB)? I can see relevant posts using nRF52 SDK but</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Fri, 21 Jan 2022 14:40:43 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/83356/fatfs-sd-card-file-system-check-and-format" /><item><title>RE: fatfs sd card file system check and format</title><link>https://devzone.nordicsemi.com/thread/348975?ContentTypeID=1</link><pubDate>Fri, 21 Jan 2022 14:40:43 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:e301e3b1-19a4-41a2-b42e-e39dbbe0831c</guid><dc:creator>Stian R&amp;#248;ed Hafskjold</dc:creator><description>&lt;p&gt;Hi, sorry for the late reply. What I meant in my first answer is that the use case you are describing is already implemented when mounting the card through fs_mount. fs_mount checks if the specified file system is present, and if not it reformats the card. If you want to do this in two steps; first check if it&amp;#39;s a FAT filesystem, and then make the decision if you want to format or not, you can use fs_mount with the FS_MOUNT_FLAG_NO_FORMAT first (it will return an error if the file system is not present), then run fs_mount again without the flag (it will reformat the drive and hopefully not return any error).&lt;/p&gt;
&lt;p&gt;Let me know if I misunderstood, or the proposed solution doesn&amp;#39;t work for you.&lt;/p&gt;
&lt;p&gt;Best regards,&lt;br /&gt;Stian&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: fatfs sd card file system check and format</title><link>https://devzone.nordicsemi.com/thread/346776?ContentTypeID=1</link><pubDate>Sat, 08 Jan 2022 04:39:15 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:0e34a353-48ea-4ba5-91fe-a7800e354b49</guid><dc:creator>pigno5e</dc:creator><description>&lt;p&gt;Dear Stian,&lt;/p&gt;
&lt;p&gt;I am planning to use an SD card with a capacity of 4-8 Gbyte. I was able to complete the sample with a few configurations modified.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;But I just want to confirm that&amp;nbsp;if the SD card is not initially formatted in the FAT file system, instead of reformatting the SD card via a PC, can this reformatting process be achieved by the program itself, e.g. by calling fs_mount or other relevant functions?&lt;/p&gt;
&lt;p&gt;As to my application, the device will be collecting data and storing to the file on the SD card. Once it&amp;#39;s done, the data file can be accessed by directly connecting the device to a PC via a USB port.&lt;/p&gt;
&lt;p&gt;However, there is a risk that the user accidentally formats the device to any other file system rather than FAT when they are accessing the data using a PC, which could cause issues for its later use.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;So when disconnected from the USB and power-up again, what is the function I could use to check if it&amp;#39;s a FAT file system; and if it&amp;#39;s not, which functions I can call to reformat the SD card?&lt;/p&gt;
&lt;p&gt;I found a few posts and tutorials showing&amp;nbsp;how it can be achieved in nRF52 SDK, but can&amp;#39;t see similar examples using nRF connected SDK.&lt;/p&gt;
&lt;p&gt;Would you mind kindly advising?&lt;/p&gt;
&lt;p&gt;Thanks again.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Kind regards, Kevin&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: fatfs sd card file system check and format</title><link>https://devzone.nordicsemi.com/thread/346714?ContentTypeID=1</link><pubDate>Fri, 07 Jan 2022 13:32:21 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:324af11e-a051-438b-8f8d-9bdb9d632d70</guid><dc:creator>Stian R&amp;#248;ed Hafskjold</dc:creator><description>&lt;p&gt;Hi, this is default behavior unless the &lt;a href="http://developer.nordicsemi.com/nRF_Connect_SDK/doc/latest/zephyr/reference/file_system/index.html#c.FS_MOUNT_FLAG_NO_FORMAT"&gt;FS_MOUNT_FLAG_NO_FORMAT &lt;/a&gt;or FS_MOUNT_FLAG_READ_ONLY flags are set. The SD card will be formatted with FAT if the filesystem is not recognized, and the two flags are not set. If fs_mount is not able to mount the existing file system or format a new file system -ENODEV will be returned.&lt;/p&gt;
&lt;p&gt;What is the size of the SD card you are using? Maybe &lt;a href="http://developer.nordicsemi.com/nRF_Connect_SDK/doc/latest/kconfig/CONFIG_FS_FATFS_EXFAT.html"&gt;CONFIG_FS_FATFS_EXFAT &lt;/a&gt;needs to be set?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>