<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="https://test-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>MSC exception</title><link>https://test-devzone.nordicsemi.com/f/nordic-q-a/73389/msc-exception</link><description>Hi, 
 Our production uses NRF52840 as the master chip. We encountered a strange problem where two folders have the same name and a file name has illegal characters. 
 The probability of this happening is very low, so we can not find the root cause so</description><dc:language>en-US</dc:language><generator>Telligent Community 13 Non-Production</generator><lastBuildDate>Thu, 16 Jun 2022 06:28:45 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://test-devzone.nordicsemi.com/f/nordic-q-a/73389/msc-exception" /><item><title>RE: MSC exception</title><link>https://test-devzone.nordicsemi.com/thread/372697?ContentTypeID=1</link><pubDate>Thu, 16 Jun 2022 06:28:45 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:aa636b1e-fa25-4a9d-ac0e-bdd2c9ae28bd</guid><dc:creator>user7377</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;Unfortunately not. The team was looking into it, but have not concluded. I will&amp;nbsp;talk to the team and let you know if they have anything to share, but it does not seem like it.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: MSC exception</title><link>https://test-devzone.nordicsemi.com/thread/372458?ContentTypeID=1</link><pubDate>Wed, 15 Jun 2022 01:02:20 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:b27806e6-62ca-45e5-90e9-1fc923a4198d</guid><dc:creator>user85932</dc:creator><description>&lt;p&gt;&lt;span&gt;Hi Einar&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Is there any good news on this issue so far?&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: MSC exception</title><link>https://test-devzone.nordicsemi.com/thread/337339?ContentTypeID=1</link><pubDate>Wed, 03 Nov 2021 16:49:20 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:df4c5aa4-916c-489f-9fa5-742636b0ade2</guid><dc:creator>user7377</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;This has turned out to be a tricky problem. R&amp;amp;D is still looking into it, and it has not been forgotten. Unfortunately I do not have any new information to share yet, though.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: MSC exception</title><link>https://test-devzone.nordicsemi.com/thread/337170?ContentTypeID=1</link><pubDate>Wed, 03 Nov 2021 04:25:59 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:f81a4bba-28eb-4636-95a3-2638d671c2a7</guid><dc:creator>user85932</dc:creator><description>&lt;p&gt;Hi Einar&lt;/p&gt;
&lt;p&gt;Is there any progress on this issue?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: MSC exception</title><link>https://test-devzone.nordicsemi.com/thread/323465?ContentTypeID=1</link><pubDate>Thu, 05 Aug 2021 08:42:52 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:ee944362-0922-4961-8194-17e65dce2cc6</guid><dc:creator>user7377</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
[quote user="greyorbit"]Yes, it seems so[/quote]
&lt;p&gt;Good. Then we see the same.&lt;/p&gt;
[quote user="greyorbit"]Do you mean&amp;nbsp;&lt;span&gt;ejecting the drive like the below picture? if yes, I am not sure, because we always unplug the USB directly.&lt;/span&gt;[/quote]
&lt;p&gt;Yes, that is what I mean.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: MSC exception</title><link>https://test-devzone.nordicsemi.com/thread/323444?ContentTypeID=1</link><pubDate>Thu, 05 Aug 2021 07:27:24 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:50703dd9-d624-4daa-9506-51f52bb2ee38</guid><dc:creator>user85932</dc:creator><description>[quote userid="7377" url="~/f/nordic-q-a/73389/msc-exception/323439#323439"]Corruption only seems to happen after writing to the USB drive from the PC?[/quote]
&lt;p&gt;Yes, it seems so, and it also may happen after formating the mass storage via the f_mkfs function(It seems to make it more likely to happen &lt;span&gt;after formating&lt;/span&gt;).&lt;/p&gt;
[quote userid="7377" url="~/f/nordic-q-a/73389/msc-exception/323439#323439"]Corruption never seems to happen if properly ejecting the drive before disconnecting it?[/quote]
&lt;p&gt;Do you mean&amp;nbsp;&lt;span&gt;ejecting the drive like the below picture? if yes, I am not sure, because we always unplug the USB directly.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;img alt=" " src="https://test-devzone.nordicsemi.com/resized-image/__size/320x240/__key/communityserver-discussions-components-files/4/pastedimage1628147864904v1.png" /&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: MSC exception</title><link>https://test-devzone.nordicsemi.com/thread/323439?ContentTypeID=1</link><pubDate>Thu, 05 Aug 2021 06:50:18 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:242f22c6-51a2-46f8-b8da-62fca83788df</guid><dc:creator>user7377</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
[quote user="greyorbit"]I still can reproduce this issue with the patch using the below method.[/quote]
&lt;p&gt;I was probably just unlucky when I tested, then. And in any case I did get complaints from Windows, so I agree there is corruption there.&lt;/p&gt;
[quote user="greyorbit"]So there is still an unexpected write operation from the PC, whether we can see the&amp;nbsp;&lt;span&gt;corruption depends on&amp;nbsp;&lt;/span&gt;if there is data in the address of the&amp;nbsp;&lt;span&gt;unexpected write.&lt;/span&gt;[/quote]
&lt;p&gt;Yes, that makes sense.&lt;/p&gt;
&lt;p&gt;Just to be clear on a few things: Do you also see that:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Corruption only seems to happen after writing to the USB drive from the PC?&lt;/li&gt;
&lt;li&gt;Corruption never seems to happen if properly ejecting the drive before disconnecting it?&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;(The above findings come after several thousand iterations on an automated test setup)&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: MSC exception</title><link>https://test-devzone.nordicsemi.com/thread/323428?ContentTypeID=1</link><pubDate>Thu, 05 Aug 2021 04:25:33 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:f12eed96-11df-4577-b3d1-6ffca8c20f77</guid><dc:creator>user85932</dc:creator><description>&lt;p&gt;Hi Einar,&lt;/p&gt;
[quote userid="7377" url="~/f/nordic-q-a/73389/msc-exception/323045#323045"]but no corruption was seen and no issues logged. (with your patched file I got a lot of &amp;quot;Cannot uninit because QSPI is busy&amp;quot; and &amp;quot;Cannot init because QSPI is busy&amp;quot;, but this is addressed by the diff below (see line 438-445).[/quote]
&lt;p&gt;Actually, we have applied this patch in our product code, please see below.&lt;/p&gt;
[quote userid="85932" url="~/f/nordic-q-a/73389/msc-exception"]&lt;p&gt;There are two major modifications.&lt;/p&gt;
&lt;p&gt;1.the issue was reported in this link&amp;nbsp;&lt;a href="https://test-devzone.nordicsemi.com/f/nordic-q-a/36654/usbd_msd-disk-initialization-fails-in-usb-unplug-with-sdk15-0"&gt;https://devzone.nordicsemi.com/f/nordic-q-a/36654/usbd_msd-disk-initialization-fails-in-usb-unplug-with-sdk15-0&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;the difference was I added a timeout for the&amp;nbsp;wait_for_idle()&amp;nbsp; function because I found it would hang on this function sometimes.&lt;/p&gt;[/quote]
&lt;p&gt;I still can reproduce this issue with the patch using the below method.&lt;/p&gt;
[quote userid="85932" url="~/f/nordic-q-a/73389/msc-exception/320156#320156"]I have found a way to reproduce this issue, I tested it on the below project that I attached before.[/quote]
&lt;p&gt;But need to modify the main.c&amp;nbsp; file, create more folders in the root directory.&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="diff"&gt;--- D:/Project/Nordic SDK/nRF5_SDK_17.0.2_d674dde/examples/peripheral/usbd_msc/main.c
+++ D:/Project/Nordic SDK/nRF5_SDK_17.0.2_d674dde/examples/peripheral/usbd_msc/main.c
@@ -505 +505 @@ const char *dir_list[] = {
-    &amp;quot;Activi&amp;quot;, &amp;quot;Totals&amp;quot;, /*&amp;quot;Tracks&amp;quot;, &amp;quot;Workout&amp;quot;,*/
+    &amp;quot;Activi&amp;quot;, &amp;quot;Totals&amp;quot;, &amp;quot;Tracks&amp;quot;, &amp;quot;Work&amp;quot;, &amp;quot;Sport&amp;quot;, &amp;quot;sys&amp;quot;&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;So there is still an unexpected write operation from the PC, whether we can see the&amp;nbsp;&lt;span&gt;corruption depends on&amp;nbsp;&lt;/span&gt;if there is data in the address of the&amp;nbsp;&lt;span&gt;unexpected write.&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: MSC exception</title><link>https://test-devzone.nordicsemi.com/thread/323045?ContentTypeID=1</link><pubDate>Tue, 03 Aug 2021 10:09:48 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:9142c7e9-64de-439e-be20-5edb3c88ccd9</guid><dc:creator>user7377</dc:creator><description>&lt;p&gt;Hi Jason,&lt;/p&gt;
&lt;p&gt;I am sorry for the late reply. I have been OoO.&lt;/p&gt;
&lt;p&gt;I see the same as you. I have only been able to reproduce when following these instructions exactly, writing and &lt;em&gt;not&lt;/em&gt; ejecting before removing the USB cable. If I eject first no error happens. Also, I did not do extensive testing today, but I did not see corruptions with the attached&amp;nbsp;patch for&amp;nbsp;nrf_block_dev_qspi.c instead of using yours. There were still errors from Windows though, so apparently there was an issue, but no corruption was seen and no issues logged. (with your patched file I got a lot of &amp;quot;Cannot uninit because QSPI is busy&amp;quot; and &amp;quot;Cannot init because QSPI is busy&amp;quot;, but this is addressed by the diff below (see line 438-445).&lt;/p&gt;
&lt;p&gt;&lt;a href="https://test-devzone.nordicsemi.com/cfs-file/__key/communityserver-discussions-components-files/4/nrf_5F00_block_5F00_dev_5F00_qspi.c.diff"&gt;test-devzone.nordicsemi.com/.../nrf_5F00_block_5F00_dev_5F00_qspi.c.diff&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;I did extensive testing before the summer with several thousands of write cycles, where the computer wrote a file, ejected, disconnected USB, reconnected and verified, etc. This did not fail using the&amp;nbsp;nrf_block_dev_qspi.c from the diff in this post. So it seem to me like the only way this can be reproduced after applying currently known fixes is by writing from a computer and not ejecting before removing the drive.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: MSC exception</title><link>https://test-devzone.nordicsemi.com/thread/320156?ContentTypeID=1</link><pubDate>Thu, 15 Jul 2021 07:11:40 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:1c9b4771-65a0-42e4-b48e-774800880f02</guid><dc:creator>user85932</dc:creator><description>&lt;p&gt;Hi Einar,&lt;/p&gt;
&lt;p&gt;I have found a way to reproduce this issue, I tested it on the below project that I attached before.&lt;/p&gt;
[quote userid="85932" url="~/f/nordic-q-a/73389/msc-exception/306456#306456"]&lt;p&gt;Please replace the nrf_block_dev_qspi.c of the SDK, I use RTT for &lt;span&gt;logging &lt;/span&gt;output and&amp;nbsp; test on the nRF5_SDK_17.0.2.&lt;/p&gt;
&lt;p&gt;&lt;a href="https://test-devzone.nordicsemi.com/cfs-file/__key/communityserver-discussions-components-files/4/2626.Project.zip"&gt;2626.Project.zip&lt;/a&gt;&lt;/p&gt;[/quote]
&lt;p&gt;1. press button 3 to format the mass storage&amp;nbsp;&lt;/p&gt;
&lt;p&gt;2. press button 1 to create an&amp;nbsp;ACTIVI folder and TOTALS folder&lt;/p&gt;
&lt;p&gt;3. connect the USB to the PC, and create a new file as below&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;img alt=" " src="https://test-devzone.nordicsemi.com/resized-image/__size/320x240/__key/communityserver-discussions-components-files/4/pastedimage1626332135433v1.png" /&gt;&lt;/p&gt;
&lt;p&gt;3.disconnect the USB&lt;/p&gt;
&lt;p&gt;4.connect the USB to the PC again, and then the MS-Windows&amp;nbsp; will popup a message as below&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;img alt=" " src="https://test-devzone.nordicsemi.com/resized-image/__size/320x240/__key/communityserver-discussions-components-files/4/pastedimage1626332291618v2.png" /&gt;&lt;/p&gt;
&lt;p&gt;5.click this window and then popup another window as below&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;img alt=" " src="https://test-devzone.nordicsemi.com/resized-image/__size/320x240/__key/communityserver-discussions-components-files/4/pastedimage1626332386667v3.png" /&gt;&lt;/p&gt;
&lt;p&gt;6.click &amp;quot;Scan and fix&amp;quot;, popup the next window&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;img alt=" " src="https://test-devzone.nordicsemi.com/resized-image/__size/320x240/__key/communityserver-discussions-components-files/4/pastedimage1626332434469v4.png" /&gt;&lt;/p&gt;
&lt;p&gt;7.click &amp;quot;Repair drive&amp;quot;, and wait for repairs completely.&lt;/p&gt;
&lt;p&gt;&lt;img alt=" " src="https://test-devzone.nordicsemi.com/resized-image/__size/320x240/__key/communityserver-discussions-components-files/4/pastedimage1626332480186v5.png" /&gt;&lt;/p&gt;
&lt;p&gt;8.create a new file again and then repeat step 3 through step 8&lt;/p&gt;
&lt;p&gt;&lt;img alt=" " src="https://test-devzone.nordicsemi.com/resized-image/__size/320x240/__key/communityserver-discussions-components-files/4/pastedimage1626332603018v6.png" /&gt;&lt;/p&gt;
&lt;p&gt;9.R&lt;span&gt;epeat it&amp;nbsp;&lt;/span&gt;one or several times, you will find the file system was corrupted. The Totals folder change to a file.&lt;/p&gt;
&lt;p&gt;&lt;img alt=" " src="https://test-devzone.nordicsemi.com/resized-image/__size/320x240/__key/communityserver-discussions-components-files/4/pastedimage1626332933233v8.png" /&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: MSC exception</title><link>https://test-devzone.nordicsemi.com/thread/318677?ContentTypeID=1</link><pubDate>Mon, 05 Jul 2021 15:23:31 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:03fa9c74-6a9f-4db5-93d1-d06acb8f23e8</guid><dc:creator>user7377</dc:creator><description>&lt;p&gt;That is good, thank you. That will be very useful input for the team looking into this.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: MSC exception</title><link>https://test-devzone.nordicsemi.com/thread/318538?ContentTypeID=1</link><pubDate>Mon, 05 Jul 2021 05:41:30 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:c92f6c17-2b62-4e76-982b-5a6b4f3a7123</guid><dc:creator>user85932</dc:creator><description>[quote userid="7377" url="~/f/nordic-q-a/73389/msc-exception/318403#318403"]&lt;p&gt;We are wondering if it is possible to rule out the MSC class as responsible for the issue or not. In your test, where you sometimes manage to get the corrupt data, we wonder if you can do some adjustments in order to narrow it down:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;prepare/modify a FW that reproduces the issue&lt;/li&gt;
&lt;li&gt;connect the DK to the PC via the JLink USB port&lt;/li&gt;
&lt;li&gt;flash the FW&lt;/li&gt;
&lt;li&gt;let the FW run until the issue occurs - so basically FW needs to have some way of validation when the corruption happens. Never connect the nRF52840 USBD port to the PC so MSC class never drives the block_dev.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Is that possible?&lt;/p&gt;[/quote]
&lt;p&gt;Yes, that is possible.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: MSC exception</title><link>https://test-devzone.nordicsemi.com/thread/318403?ContentTypeID=1</link><pubDate>Fri, 02 Jul 2021 10:40:47 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:78426d27-6d49-47ac-919a-74edae4831ea</guid><dc:creator>user7377</dc:creator><description>&lt;p&gt;We are wondering if it is possible to rule out the MSC class as responsible for the issue or not. In your test, where you sometimes manage to get the corrupt data, we wonder if you can do some adjustments in order to narrow it down:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;prepare/modify a FW that reproduces the issue&lt;/li&gt;
&lt;li&gt;connect the DK to the PC via the JLink USB port&lt;/li&gt;
&lt;li&gt;flash the FW&lt;/li&gt;
&lt;li&gt;let the FW run until the issue occurs - so basically FW needs to have some way of validation when the corruption happens. Never connect the nRF52840 USBD port to the PC so MSC class never drives the block_dev.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Is that possible?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: MSC exception</title><link>https://test-devzone.nordicsemi.com/thread/317696?ContentTypeID=1</link><pubDate>Tue, 29 Jun 2021 12:05:34 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:214b8ef1-2af9-4655-978a-42139b86f54f</guid><dc:creator>user7377</dc:creator><description>&lt;p&gt;I see. The team is continuously looking into this and we have some ideas. I will update this thread when we have something worth sharing.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: MSC exception</title><link>https://test-devzone.nordicsemi.com/thread/317623?ContentTypeID=1</link><pubDate>Tue, 29 Jun 2021 08:25:51 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:e3f494fd-ef15-4a82-8208-133d47c88bc8</guid><dc:creator>user85932</dc:creator><description>&lt;p&gt;Hi Einar,&lt;/p&gt;
[quote userid="7377" url="~/f/nordic-q-a/73389/msc-exception/314629#314629"]We have not got to the bottom of this yet, but we have a fix that may be relevant. This is a change in&amp;nbsp;app_usbd_msc.c:[/quote]
&lt;p&gt;Unfortunately, I have applied the patch, but it could still happen.&lt;/p&gt;
&lt;p&gt;&lt;img src="https://test-devzone.nordicsemi.com/resized-image/__size/320x240/__key/communityserver-discussions-components-files/4/pastedimage1624954573559v1.png" alt=" " /&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: MSC exception</title><link>https://test-devzone.nordicsemi.com/thread/314717?ContentTypeID=1</link><pubDate>Thu, 10 Jun 2021 13:17:52 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:b30c74a2-8a86-4e77-9546-b703dda35dfd</guid><dc:creator>user7377</dc:creator><description>&lt;p&gt;I do not immediately see that it would be needed, but it should not hurt either provided the timeout is not too short.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: MSC exception</title><link>https://test-devzone.nordicsemi.com/thread/314652?ContentTypeID=1</link><pubDate>Thu, 10 Jun 2021 10:04:39 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:86ceb77d-5ef6-4556-b8ec-6ae9fb01e41d</guid><dc:creator>user85932</dc:creator><description>&lt;p&gt;Hi Einar,&lt;/p&gt;
&lt;p&gt;Thanks for the update.&lt;/p&gt;
&lt;p&gt;Do I need to add a timeout for the while loop?&lt;/p&gt;
&lt;p&gt;I have encountered many times that the device hangs in the while loop of the USB module.&lt;/p&gt;
&lt;p&gt;In my current code, I added a timeout for the while loop.&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;--- nrf_block_dev_qspi.c-rev7574.svn001.tmp.c	 
+++ nrf_block_dev_qspi.c-rev7575.svn001.tmp.c
@@ -289,2 +289,2 @@ static void qspi_handler(nrf_drv_qspi_evt_t event,
-
-static void wait_for_idle(nrf_block_dev_qspi_t const * p_qspi_dev)
+#include &amp;quot;rtc.h&amp;quot;
+static ret_code_t wait_for_idle(nrf_block_dev_qspi_t const * p_qspi_dev)
@@ -291,0 +292,2 @@ static void qspi_handler(nrf_drv_qspi_evt_t event,
+	time_t startTick, currentTick;
+	startTick =  RTC_getTimeTick();
@@ -294,0 +297 @@ static void qspi_handler(nrf_drv_qspi_evt_t event,
+		/*The watchdog timer stop in WFI mode, it will be wakeup by any interrupt*/
@@ -295,0 +299,6 @@ static void qspi_handler(nrf_drv_qspi_evt_t event,
+		currentTick =  RTC_getTimeTick();
+		/*wait for 3 seconds*/
+		if(currentTick &amp;gt; (startTick + 3))
+		{
+			return NRF_ERROR_TIMEOUT;
+		}
@@ -296,0 +306 @@ static void qspi_handler(nrf_drv_qspi_evt_t event,
+	return NRF_SUCCESS;&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;--- diskio_blkdev.c-rev7578.svn001.tmp.c	
+++ diskio_blkdev.c-rev7579.svn001.tmp.c	
@@ -43 +43,4 @@
-
+#define DISKIO_MSC_LOG
+#ifdef DISKIO_MSC_LOG
+#include &amp;quot;log.h&amp;quot;
+#endif
@@ -82 +85,2 @@ static void block_dev_handler(struct nrf_block_dev
-static void default_wait_func(void)
+#include &amp;quot;rtc.h&amp;quot;
+static INT default_wait_func(BYTE drv)
@@ -84 +88,14 @@ static void block_dev_handler(struct nrf_block_dev
-    __WFE();
+	time_t startTick, currentTick;
+	startTick =  RTC_getTimeTick();
+    while (m_drives[drv].busy)
+    {
+		/*The watchdog timer stop in WFI mode, it will be wakeup by any interrupt*/
+        __WFI();
+		currentTick =  RTC_getTimeTick();
+		/*wait for 5 seconds*/
+		if(currentTick &amp;gt; (startTick + 5))
+		{
+			return 1;
+		}
+    }
+	return 0;&lt;/pre&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: MSC exception</title><link>https://test-devzone.nordicsemi.com/thread/314629?ContentTypeID=1</link><pubDate>Thu, 10 Jun 2021 08:39:55 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:21d155b1-5e2d-4f61-b2e7-044a595c3915</guid><dc:creator>user7377</dc:creator><description>&lt;p&gt;Hi Jason,&lt;/p&gt;
&lt;p&gt;We have not got to the bottom of this yet, but we have a fix that may be relevant. This is a change in&amp;nbsp;app_usbd_msc.c:&lt;/p&gt;
&lt;p&gt;&lt;a href="https://test-devzone.nordicsemi.com/cfs-file/__key/communityserver-discussions-components-files/4/app_5F00_usbd_5F00_msc.c.diff"&gt;test-devzone.nordicsemi.com/.../app_5F00_usbd_5F00_msc.c.diff&lt;/a&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: MSC exception</title><link>https://test-devzone.nordicsemi.com/thread/312026?ContentTypeID=1</link><pubDate>Thu, 27 May 2021 10:14:23 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:896843be-f57b-44bb-aed1-e1e1c9dd6c47</guid><dc:creator>user85932</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
[quote userid="7377" url="~/f/nordic-q-a/73389/msc-exception/312018#312018"]I was not able to reproduce the issue with warnings on Windows on my side[/quote]
&lt;p&gt;I test on the Windows 10 Pro. I can also reproduce this problem in another product that is not developed by us, and it also uses NRF52840.&lt;/p&gt;
&lt;p&gt;&lt;img src="https://test-devzone.nordicsemi.com/resized-image/__size/320x240/__key/communityserver-discussions-components-files/4/pastedimage1622109985555v1.png" alt=" " /&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: MSC exception</title><link>https://test-devzone.nordicsemi.com/thread/312018?ContentTypeID=1</link><pubDate>Thu, 27 May 2021 09:48:56 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:07f35647-a2cd-4631-9688-8d3a10bfa53f</guid><dc:creator>user7377</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
[quote user="greyorbit"]What I understand so far, this issue likely occurs while connecting to the PC and copying files to the MSC from the PC side. Our products can be upgraded by copying the firmware to MSC. I have asked our test team to check the MSC before and after the upgrade, it&amp;#39;s still being tested.[/quote]
&lt;p&gt;It will be interesting to learn the result of that test.&lt;/p&gt;
[quote user="greyorbit"]Have you fixed these problems? They can be reproduced on the Nordic DK. I think if these are fixed, this issue will probably be fixed.[/quote]
&lt;p&gt;I was not able to reproduce the issue with warnings on Windows on my side, but I managed once to get a corrupt file while coping new files, disconnect, reconnect, copy new file, etc. I agree it seems reasonable that the same root cause can be the cause of all this though we cannot say for sure at this point.&lt;/p&gt;
&lt;p&gt;I will let you know when the team investigating this have any progress, if they have any questions and when they have some code we would like you to test.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: MSC exception</title><link>https://test-devzone.nordicsemi.com/thread/311673?ContentTypeID=1</link><pubDate>Wed, 26 May 2021 08:15:16 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:09562fb6-4e68-4836-914d-971a5fb50712</guid><dc:creator>user85932</dc:creator><description>&lt;p&gt;Hi Einar,&lt;/p&gt;
&lt;p&gt;Thanks for the update.&lt;/p&gt;
[quote userid="7377" url="~/f/nordic-q-a/73389/msc-exception/311649#311649"]Have you had any progress on this issue on your side?[/quote]
&lt;p&gt;No，we haven&amp;#39;t made any progress.&lt;/p&gt;
[quote userid="7377" url="~/f/nordic-q-a/73389/msc-exception/311649#311649"]I had a meeting with the R&amp;amp;D team responsible for this yesterday, and the current state is that after a thorough inspection of the code we cannot see an issue with the blockdevice code that would result in the observed corruption. In other words, we cannot see by analysis, a code path that would result in this. This does not mean that we have ruled out that there is an issue.[/quote]
&lt;p&gt;What I understand so far, this issue likely occurs while connecting to the PC and copying files to the MSC from the PC side. Our products can be upgraded by copying the firmware to MSC. I have asked our test team to check the MSC before and after the upgrade, it&amp;#39;s still being tested.&lt;/p&gt;
[quote userid="85932" url="~/f/nordic-q-a/73389/msc-exception/306456#306456"]After the patch was applied, although this issue couldn&amp;#39;t be reproduced, I found some unexpected write operation while connect to the PC.&amp;nbsp;&amp;nbsp;[/quote][quote userid="85932" url="~/f/nordic-q-a/73389/msc-exception/307176#307176"]&lt;p&gt;One more finding.&lt;/p&gt;
&lt;p&gt;1.Plug the USB into the PC and create a new file from the PC&lt;/p&gt;[/quote]
&lt;p&gt;Have you fixed these problems? They can be reproduced on the Nordic DK. I think if these are fixed, this issue will probably be fixed.&lt;/p&gt;
[quote userid="7377" url="~/f/nordic-q-a/73389/msc-exception/311649#311649"]As we are not able to reproduce the corruption itself, we suggest that we provide you with a modified library that has instrumentation to detect some unexpected changes/states/behaviors. Would you be willing to use that in our testing to help narrow down the issue?[/quote]
&lt;p&gt;Yes, of course.&amp;nbsp;&lt;/p&gt;
[quote userid="7377" url="~/f/nordic-q-a/73389/msc-exception/311649#311649"]Another hypothesis that came up was that there could be a reentrancy issue where you call from multiple interrupt contexts (into the blockdevice code. Could that be the case?[/quote]
&lt;p&gt;I don&amp;#39;t think so.&amp;nbsp;We do not use any RTOS, nor do we do any file operations in the interrupt service.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: MSC exception</title><link>https://test-devzone.nordicsemi.com/thread/311649?ContentTypeID=1</link><pubDate>Wed, 26 May 2021 07:11:51 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:5418d9de-de2d-4ea6-80d8-c71f860acd6b</guid><dc:creator>user7377</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;Have you had any progress on this issue on your side?&lt;/p&gt;
&lt;p&gt;I had a meeting with the R&amp;amp;D team responsible for this yesterday, and the current state is that after a thorough inspection of the code we cannot see an issue with the blockdevice code that would result in the observed corruption. In other words, we cannot see by analysis, a code path that would result in this. This does not mean that we have ruled out that there is an issue.&lt;/p&gt;
&lt;p&gt;As we are not able to reproduce the corruption itself, we suggest that we provide you with a modified library that has instrumentation to detect some unexpected changes/states/behaviors. Would you be willing to use that in our testing to help narrow down the issue?&lt;/p&gt;
&lt;p&gt;Another hypothesis that came up was that there could be a reentrancy issue where you call from multiple interrupt contexts (into the blockdevice code. Could that be the case?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: MSC exception</title><link>https://test-devzone.nordicsemi.com/thread/307429?ContentTypeID=1</link><pubDate>Thu, 29 Apr 2021 10:58:48 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:4326a05d-0469-4a21-b095-520545afc293</guid><dc:creator>user7377</dc:creator><description>&lt;p&gt;Thanks for the update. I do not have any news from my side atm.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: MSC exception</title><link>https://test-devzone.nordicsemi.com/thread/307176?ContentTypeID=1</link><pubDate>Wed, 28 Apr 2021 09:06:27 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:bd3ac198-f8ec-4215-be5e-a88b4100c9cb</guid><dc:creator>user85932</dc:creator><description>&lt;p&gt;Hi Einar,&amp;nbsp;&lt;/p&gt;
&lt;p&gt;One more finding.&lt;/p&gt;
&lt;p&gt;1.Plug the USB into the PC and create a new file from the PC&lt;/p&gt;
&lt;p&gt;&lt;img src="https://test-devzone.nordicsemi.com/resized-image/__size/320x240/__key/communityserver-discussions-components-files/4/pastedimage1619599960337v1.png" alt=" " /&gt;&lt;/p&gt;
&lt;p&gt;2. Disconnect the USB, and&amp;nbsp;&lt;span&gt;plug the USB into the PC again, the PC pops up the following message.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;img src="https://test-devzone.nordicsemi.com/resized-image/__size/320x240/__key/communityserver-discussions-components-files/4/pastedimage1619600463725v2.png" alt=" " /&gt;&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: MSC exception</title><link>https://test-devzone.nordicsemi.com/thread/306534?ContentTypeID=1</link><pubDate>Fri, 23 Apr 2021 12:04:50 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:00e4eb88-d111-4e1f-90e0-a095843fa0e8</guid><dc:creator>user7377</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;I have asked the maintainers to review the logs and provide input. I will let you know when we have something.&lt;/p&gt;
&lt;p&gt;Einar&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>