<?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>Issue when use external flash(25Q64FVSIG) as the USBD_MSC example&amp;#39;s storage with my custom board nrf52840(sdk17.0.2)</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/73779/issue-when-use-external-flash-25q64fvsig-as-the-usbd_msc-example-s-storage-with-my-custom-board-nrf52840-sdk17-0-2</link><description>Hi, Noddic &amp;amp; all： 
 I meet a problem when use external flash(25Q64FVSIG) as the USBD_MSC example&amp;#39;s storage; 
 that is : &amp;quot;fatfs_init()&amp;quot; return FR_NO_FILESYSTEM; 
 then I go deep to check the definition(fatfs_init() &amp;gt; f_mount(&amp;amp;m_filesystem, &amp;quot;&amp;quot;, 1) &amp;gt; find_volume</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Tue, 13 Apr 2021 03:51:58 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/73779/issue-when-use-external-flash-25q64fvsig-as-the-usbd_msc-example-s-storage-with-my-custom-board-nrf52840-sdk17-0-2" /><item><title>RE: Issue when use external flash(25Q64FVSIG) as the USBD_MSC example's storage with my custom board nrf52840(sdk17.0.2)</title><link>https://devzone.nordicsemi.com/thread/304397?ContentTypeID=1</link><pubDate>Tue, 13 Apr 2021 03:51:58 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:c67bbd42-9cd9-48a8-abc7-3931eafb7809</guid><dc:creator>Chris_</dc:creator><description>&lt;p&gt;Hi, Hung Bui：&lt;/p&gt;
&lt;p&gt;Thanks for your kind suggest.&lt;/p&gt;
&lt;p&gt;&lt;span class="VIiyi" lang="en"&gt;&lt;span class="JLqJ4b ChMk0b"&gt;&lt;span&gt;I am afraid I have no condition to test W25Q64FVSIG on nRF52840 DK；but I&amp;nbsp;solve this problem myself.&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;According to the log remote, It seems that my flash&amp;nbsp;&lt;span&gt;W&lt;/span&gt;&lt;span&gt;25Q64FVSIG is most newly and haven&amp;#39;t be used ever, so I should format it first,&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;And my&amp;nbsp;solution is execute&amp;nbsp;&amp;nbsp;fatfs_mkfs() in&amp;nbsp;fatfs_init() ,just as the follow:&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;static bool fatfs_init(void)
{
    FRESULT ff_result;
    DSTATUS disk_state = STA_NOINIT;

    memset(&amp;amp;m_filesystem, 0, sizeof(FATFS));

    // Initialize FATFS disk I/O interface by providing the block device.
    static diskio_blkdev_t drives[] =
    {
        DISKIO_BLOCKDEV_CONFIG(NRF_BLOCKDEV_BASE_ADDR(m_block_dev_qspi, block_dev), NULL)
    };

    diskio_blockdev_register(drives, ARRAY_SIZE(drives));

    NRF_LOG_INFO(&amp;quot;Initializing disk 0 (QSPI)...&amp;quot;);
    disk_state = disk_initialize(0);
    if (disk_state)
    {
        NRF_LOG_ERROR(&amp;quot;Disk initialization failed.disk_state&amp;lt;%d&amp;gt;&amp;quot;, disk_state);
        return false;
    }
    NRF_LOG_ERROR(&amp;quot;disk_state &amp;lt;%d&amp;gt;&amp;quot;, disk_state);
    NRF_LOG_INFO(&amp;quot;Mounting volume...&amp;quot;);
    ff_result = f_mount(&amp;amp;m_filesystem, &amp;quot;&amp;quot;, 1);
    if (ff_result != FR_OK)
    {
        if (ff_result == FR_NO_FILESYSTEM)
        {
            NRF_LOG_ERROR(&amp;quot;Mount failed. Filesystem not found. Please format device.&amp;quot;);
            fatfs_mkfs();// flash is new, should execute this here once, and then it can be annotated 
        }
        else
        {
            NRF_LOG_ERROR(&amp;quot;Mount failed: %u&amp;quot;, ff_result);
        }
        return false;
    }

    return true;
}&lt;/pre&gt;&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Once format one time , the file system can be created，and&amp;nbsp; Flash can init successfully.&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Issue when use external flash(25Q64FVSIG) as the USBD_MSC example's storage with my custom board nrf52840(sdk17.0.2)</title><link>https://devzone.nordicsemi.com/thread/304033?ContentTypeID=1</link><pubDate>Fri, 09 Apr 2021 13:26:32 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:5143aa32-ccc2-4317-9ece-e54636bbf9b1</guid><dc:creator>Hung Bui</dc:creator><description>&lt;p&gt;Hi Chris,&amp;nbsp;&lt;/p&gt;
&lt;p&gt;The USBD_MSC example demonstrates how you can create a FAT file system (format). If you have a look at the documentation &lt;a href="https://infocenter.nordicsemi.com/topic/sdk_nrf5_v17.0.2/usbd_msc_example.html?cp=7_1_4_6_50_7"&gt;here.&lt;/a&gt;&amp;nbsp;you can find that if you press button 3 it will create the file system. (call fatfs_mkfs() )&lt;/p&gt;
&lt;p&gt;I would suggest to try testing on the onboard QSPI on the nRF52840 DK first before testing on your &lt;span&gt;25Q64FVSIG. And might be you want to verify that it works fine by read or write raw data to flash before you test with the file system.&amp;nbsp;&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>