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.
Hi.
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.
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).
I add this code at the beggining of block_dev_qspi_uninit:
if ((p_work->state != NRF_BLOCK_DEV_QSPI_STATE_IDLE))
{
wait_for_idle(p_qspi_dev);
}
It fixed the problem.
Best regards
Artur
Hi.
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.
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).
I add this code at the beggining of block_dev_qspi_uninit:
if ((p_work->state != NRF_BLOCK_DEV_QSPI_STATE_IDLE))
{
wait_for_idle(p_qspi_dev);
}
It fixed the problem.
Best regards
Artur
Artur,
Many thanks; it seems to do the trick.
Thanks for reporting this, Artur. I will forward your proposed fix to the devs.
Kind regards,
Håkon