<?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>USBD connect/disconnect</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/36835/usbd-connect-disconnect</link><description>Hi, 
 
 Is it possible to fool the system (via software) to perform a USB connect/disconnect as if it was physically connected and disconnected?</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Thu, 26 Jul 2018 10:35:13 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/36835/usbd-connect-disconnect" /><item><title>RE: USBD connect/disconnect</title><link>https://devzone.nordicsemi.com/thread/141498?ContentTypeID=1</link><pubDate>Thu, 26 Jul 2018 10:35:13 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:933b9aa8-6bab-430d-b2f8-8152530c3fb3</guid><dc:creator>Mo</dc:creator><description>&lt;p&gt;I ended up using this suggestion and it solved the issue. Thanks.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Hi.&lt;/p&gt;
&lt;p&gt;&lt;br /&gt;I had the almost the same issue. After any access to the files via the USB, the file system was demolished after internal flash access.&lt;br /&gt;I added additional logs to the SDK in QSPI module and it has shown me, that QSPI uninit function (block_dev_qspi_uninit), called after unplugging the USB, was busy (return with NRF_ERROR_BUSY).&lt;/p&gt;
&lt;p&gt;I add&amp;nbsp;this code at the beggining of block_dev_qspi_uninit:&lt;/p&gt;
&lt;p&gt;&lt;br /&gt;if ((p_work-&amp;gt;state != NRF_BLOCK_DEV_QSPI_STATE_IDLE))&lt;/p&gt;
&lt;p&gt;{&lt;/p&gt;
&lt;p&gt;&amp;nbsp;wait_for_idle(p_qspi_dev);&lt;/p&gt;
&lt;p&gt;}&lt;/p&gt;
&lt;p&gt;&lt;br /&gt;It fixed the problem.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Best regards&lt;br /&gt;Artur&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: USBD connect/disconnect</title><link>https://devzone.nordicsemi.com/thread/141372?ContentTypeID=1</link><pubDate>Wed, 25 Jul 2018 15:03:53 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:12b3398e-0f2b-4653-8e79-641590b27b16</guid><dc:creator>Andre</dc:creator><description>&lt;p&gt;The pullup enable/disable should disconnect the device from the PC&amp;#39;s perspective. Can you verify this happens?&lt;br /&gt; I suppose on the microcontroller, you&amp;#39;ll need to manually generate a disconnect event after disabling the pullup.&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: USBD connect/disconnect</title><link>https://devzone.nordicsemi.com/thread/141355?ContentTypeID=1</link><pubDate>Wed, 25 Jul 2018 14:26:43 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:621635ca-e043-4df4-836d-c4c8ba3c2417</guid><dc:creator>Mo</dc:creator><description>&lt;p&gt;Thanks for your reply, however, it does not seem to do the trick.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;There seems to be an issue with the USBD as follows:&lt;/p&gt;
&lt;p&gt;&amp;nbsp; &amp;nbsp;- Create a file&lt;/p&gt;
&lt;p&gt;&amp;nbsp; &amp;nbsp;- Modify it (write some date to it)&lt;/p&gt;
&lt;p&gt;&amp;nbsp; &amp;nbsp;- Connect the USB&lt;/p&gt;
&lt;p&gt;&amp;nbsp; &amp;nbsp;- I am able to see the file on the USB drive&lt;/p&gt;
&lt;p&gt;&amp;nbsp; &amp;nbsp;- Disconnect the USB&lt;/p&gt;
&lt;p&gt;&amp;nbsp; &amp;nbsp;* at this point everything is file as fatfs_init() works fine and I can log more data to the file&lt;/p&gt;
&lt;p&gt;&amp;nbsp; However:&lt;/p&gt;
&lt;p&gt;&amp;nbsp; &amp;nbsp;- Connect the USB&lt;/p&gt;
&lt;p&gt;&amp;nbsp; &amp;nbsp;- Copy (Drag/Drop) the file from the USB drive&lt;/p&gt;
&lt;p&gt;&amp;nbsp; &amp;nbsp;- Disconnect the USB&lt;/p&gt;
&lt;p&gt;&amp;nbsp; &amp;nbsp;-&amp;nbsp;&lt;span&gt;fatfs_init() fails and I no longer can access the file; unless I physically connect/disconnect the USB again.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;My intention is in failed times to mimic a USB connect/disconnect without the user&amp;#39;s knowledge.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp; &amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: USBD connect/disconnect</title><link>https://devzone.nordicsemi.com/thread/141339?ContentTypeID=1</link><pubDate>Wed, 25 Jul 2018 13:36:48 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:69a5672a-b220-4f00-9928-af8494923d61</guid><dc:creator>Andre</dc:creator><description>&lt;p&gt;Look at the&amp;nbsp;&lt;a class="el" href="http://infocenter.nordicsemi.com/topic/com.nordic.infocenter.sdk5.v15.0.0/group__nrf__usbd__hal.html#gaa9b4f50a52459e7f0df8753ddd4afd63"&gt;nrf_usbd_pullup_disable&lt;/a&gt;&lt;span&gt;&amp;nbsp; and&amp;nbsp;&lt;a class="el" href="http://infocenter.nordicsemi.com/topic/com.nordic.infocenter.sdk5.v15.0.0/group__nrf__usbd__hal.html#ga7b3dfe48979d93f1ae53838f18654df8"&gt;nrf_usbd_pullup_enable&lt;/a&gt;&amp;nbsp; functions. If you disable the pull-up, the host will see this as a disconnect.&amp;nbsp;&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>