<?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>USB MSC example in interrupt mode</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/50053/usb-msc-example-in-interrupt-mode</link><description>I&amp;#39;m experimenting with the USB MSC example (SDK 15.3) on my nRF52840 DK. It seems to work well in the polling mode as delivered. However, when I try to run in interrupt mode it no longer functions properly. The first time I connect the USB cable, Windows</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Sat, 28 Dec 2019 06:49:06 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/50053/usb-msc-example-in-interrupt-mode" /><item><title>RE: USB MSC example in interrupt mode</title><link>https://devzone.nordicsemi.com/thread/226983?ContentTypeID=1</link><pubDate>Sat, 28 Dec 2019 06:49:06 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:7c8da1e3-cf9a-4f45-94fb-8fc0390c0a6f</guid><dc:creator>Duy</dc:creator><description>&lt;p&gt;Hello,&lt;/p&gt;
&lt;p&gt;I got the same issue and I made it run by the following lines of code. I have no idea why. I am using SDK 15.3 also.&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;/**@brief Function for initializing the usbd. */
static void usbd_init(void)
{
    static const app_usbd_config_t usbd_config = 
    {
        .ev_state_proc = usbd_user_ev_handler
    };

    app_usbd_serial_num_generate();
       
    ret_code_t err_code = app_usbd_init(&amp;amp;usbd_config);
    APP_ERROR_CHECK(err_code);    
}


static void usbd_start()
{
    ret_code_t err_code;

    app_usbd_class_inst_t const * class_cdc_acm = app_usbd_cdc_acm_class_inst_get(&amp;amp;m_app_cdc_acm);
    err_code = app_usbd_class_append(class_cdc_acm);
    APP_ERROR_CHECK(err_code);

    if (USBD_POWER_DETECTION)
    {
        err_code = app_usbd_power_events_enable();
        APP_ERROR_CHECK(err_code);
    }
    else
    {
        NRF_LOG_INFO(&amp;quot;[USB]No USB power detection enabled\r\nStarting USB now&amp;quot;);

        app_usbd_enable();
        app_usbd_start();
    }
}


int main(void)
{
    ret_code_t err_code;

    // Initialize.
    log_init();
    clock_init();
    timers_init();
    uart_init();
    buttons_leds_init();
    usbd_init();
    // It does not work if the function usbd_start() is here.
    //usbd_start();

    db_discovery_init();
    power_management_init();
    ble_stack_init();
    gatt_init();
    nus_c_init();
    scan_init();

    // Start execution.
    // It works if the function usbd_start() is here
    usbd_start();
    // Do manythings here
    
        printf(&amp;quot;BLE UART central example started.\r\n&amp;quot;);
    NRF_LOG_INFO(&amp;quot;BLE UART central example started.&amp;quot;);
    scan_start();

    // Enter main loop.
    for (;;)
    {
//        while (app_usbd_event_queue_process())
//        {
//            /* Nothing to do */
//        }

    }
    
}&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;Duy&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: USB MSC example in interrupt mode</title><link>https://devzone.nordicsemi.com/thread/200114?ContentTypeID=1</link><pubDate>Tue, 23 Jul 2019 14:18:13 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:9bb062b2-0826-4cfb-a26a-e869d7a34f11</guid><dc:creator>ebray</dc:creator><description>&lt;p&gt;No, because the QSPI flash is the only &amp;quot;drive&amp;quot; that is configured to work with FatFS. Also, it works fine in polling mode.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: USB MSC example in interrupt mode</title><link>https://devzone.nordicsemi.com/thread/200108?ContentTypeID=1</link><pubDate>Tue, 23 Jul 2019 14:04:14 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:bf1c2a3b-7e6c-4e87-a4b8-46b8b9e47e17</guid><dc:creator>Edvin</dc:creator><description>[quote user="ebray"]Odd. The link still works fine for me. If you search for the text below in the forum you can find the post that way.[/quote]
&lt;p&gt;&amp;nbsp;Sorry. I meant that they didn&amp;#39;t find the cause of the issue.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
[quote user="ebray"]It seems to get hung up waiting for the QPSI to become not busy but that never occurs.[/quote]
&lt;p&gt;&amp;nbsp;Have you tested the example without the QSPI part? Or you can try to&amp;nbsp;turn off and on the power register on the QSPI like described in the workaround &lt;a href="https://infocenter.nordicsemi.com/index.jsp?topic=%2Ferrata_nRF52840_Rev2%2FERR%2FnRF52840%2FRev2%2Flatest%2Fanomaly_840_122.html&amp;amp;cp=3_0_1_0_1_7" rel="noopener noreferrer" target="_blank"&gt;here&lt;/a&gt;.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: USB MSC example in interrupt mode</title><link>https://devzone.nordicsemi.com/thread/200067?ContentTypeID=1</link><pubDate>Tue, 23 Jul 2019 13:06:44 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:59abb04b-e0ea-4ea9-9dd2-50da287b187e</guid><dc:creator>ebray</dc:creator><description>&lt;p&gt;It appears that the real issue is that when the USB is disconnected the fatfs_init call never returns. It seems to get hung up waiting for the QSPI flash to become not busy but that never occurs.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: USB MSC example in interrupt mode</title><link>https://devzone.nordicsemi.com/thread/200057?ContentTypeID=1</link><pubDate>Tue, 23 Jul 2019 12:30:39 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:7f41371a-924a-4fed-8236-a467739df5b4</guid><dc:creator>ebray</dc:creator><description>&lt;p&gt;Odd. The link still works fine for me. If you search for the text below in the forum you can find the post that way.&lt;/p&gt;
&lt;p&gt;&lt;a href="https://devzone.nordicsemi.com/f/nordic-q-a/34933/usb-cdc-acm-example-is-not-working-in-interrupt-mode"&gt;usb-cdc-acm-example-is-not-working-in-interrupt-mode&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Thank you for testing and verifying the behavior on the MSC example. Since it works properly for the CDC example I&amp;#39;m assuming it&amp;#39;s either a bug or a configuration issue as I wouldn&amp;#39;t think there should be any difference in the USBD user events generated.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: USB MSC example in interrupt mode</title><link>https://devzone.nordicsemi.com/thread/199973?ContentTypeID=1</link><pubDate>Tue, 23 Jul 2019 09:26:52 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:387c53ba-0b04-41c3-ab12-e44afa6c4e5e</guid><dc:creator>Edvin</dc:creator><description>&lt;p&gt;Hello,&lt;/p&gt;
&lt;p&gt;I see that the thread that you link to died. I have tested, and I see the same behavior as you, but I am not certain that the interrupt handler handles all the events correctly, as it does when you use the event queue. I have asked our SDK team if they can take a look at what you would need to do to use this mode. I will let you know as soon as I know something.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Edvin&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>