AnsweredAssumed Answered

[STM32F746-DISCOVERY] Weird bug with USB Mass-storage connection

Question asked by Ivan Ivan on Jul 3, 2017

Hello. I'm developing a program on STM32F746-DISCOVERY. The board connects to PC through USB-HS port, and uses microSD card for storage, as "backend" for Mass Storage Class, to be more specific. I have based my code on example found in Firmware package (STM32F7xx_DFP\2.9.0\Projects\STM32746G-Discovery\Applications\USB_Device\MSC_Standalone\MDK-ARM) . The device connects like it should, OS sees it.

The problem is that the computer is not able to find the device once again after the device's power is being turned on after being switched off for a while. Only reprogramming helps.

Here is the scenario of an issue:

0. Write Program to device

1. Connect to PC through USB-HS port using USB cable

2. PC sees device as Mass Storage like it should [OK]

3. Unpower device

4. Plug the power again to device, SD card is detected.

5. Connect to PC through USB-HS port using USB cable

6. PC does not detect device as Mass Storage (no detection at all) [FAIL]


I have a DISCOVERY screen enabled where I write some debug info.


I have modified USB low level callbacks to track down an issue (in usbd_conf.c), so I'm sure that HAL_PCD_SetupStageCallback is not being fired at all.


I had this issue before, changing mSD card eliminated it for a while, but now it persists. Why does this weird issue happen? Maybe someone knows workaround?