After unplugging the USB, disk initialization fails in usbd_user_ev_handler function function (case: APP_USBD_EVT_STOPPED). If I connect and disconnect a second time, it works.
After unplugging the USB, disk initialization fails in usbd_user_ev_handler function function (case: APP_USBD_EVT_STOPPED). If I connect and disconnect a second time, it works.
I forgot to mention that by simply plugging the USB in and out, everything works as it should; however, disk initialization fails if I open and close my stored data on the USB drive.
Hi,
I see the exact same behavior. If you simply plug/unplug the USB, everything is fine.
If you open the data, or do anything to the stored content (delete a file), it will fail with error "STA_NOINIT" (err_code = 1)
This looks to come from nrf_block_dev_qspi.c::m_active_qspi_dev not being uninited properly after the drive has been altered. I'll report this internally as a bug.
Kind regards,
Håkon
When the above failure occurs, to remedy the issue (without the user having to physically connect/disconnect the USB), would it be possible to mimic a USB connect/disconnect via software (nrf_usbd_pullup_enable...)?
Without having dug deep into this issue, I suspect the issue is more of a unhandled corner-case between the QSPI and USB handling. For some reason, the qspi_uninit does not successfully execute if you alter the USB drive, which is a good indication that the issue is not purely USB or QSPI, but a combination of the two. Disconnecting the D+/D- pull-resistors is not likely to un-init the QSPI after this has occurred.
Cheers,
Håkon
Thanks