Skip to main content
sunny
Associate III
June 22, 2016
Question

[STM32L4] Configure STM32L4 as USB Device Mass Storage

  • June 22, 2016
  • 1 reply
  • 853 views
Posted on June 22, 2016 at 12:51

Hi,

I have STM32L4 based board having USB OTG Connector.

I have microSD Card interfaced on SDIO (4-bit) and am using the FatFS by Chen from CubeMX.

I have used the code from CubeMX to configure the STM32L4 as USBD MSC.

I am able to get the USB enumerated on the PC when I connect the USB cable.

But I observed that if any write/open calls to Filesystem are ongoing when this enumeration of USB is happening, then the Filesystem operations are stuck.

After debugging, I found that when the USBD_Connect() is called, and the USB cable is already connected to the PC, the HAL_PCD_IRQHandler() is called multiple times.

It takes around ~2.914 seconds after which this HAL_PCD_IRQHandler() is not called and the USB is detected on the PC as Mass Storage.

So if I put a delay of 3 seconds after the USBD_Connect() call, then all the Filesystem related operations work fine.

So is there any other way by which I can avoid to put this delay of 3 seconds ?

Thanks,

Sunny

#stm32l4 #usbd #msc
This topic has been closed for replies.

1 reply

sunny
sunnyAuthor
Associate III
June 23, 2016
Posted on June 23, 2016 at 05:58

Hi,

Can anybody please confirm the same and give a possible solution ?

Thanks,

Sunny