cancel
Showing results for 
Search instead for 
Did you mean: 

USB Device MSC SD Card Interface troubleshoot

Farhan Khan
Associate II
Posted on March 26, 2018 at 14:33

Hi,

I have STM32L4 based board NUCLEO-L476RG

I have initialised it USB Device Only Mode with Mass Storage Class IP and a microSD Card interfaced on SDIO (1-bit) and from CubeMX.

I am using MSI RC at 48MHz to clock USB.

STM32Cube_FW_L4_V1.8.1\Projects\STM32L476G_EVAL\Applications\USB_Device\MSC_Standalone.

Based on this example, I have made all the necessary modification in usbd_storage_if.c file.

I am able to get the USB enumerated on the PC when I connect the USB cable, the device appears in Unspecified category.

No new removable drive appears in the system window.

I have checked all the blogs I could and I have gone through the

UM1734 User manual

STM32Cube USB device library 

for more than 2 weeks

I have implemented a mouse before this and as well with the same sd config I have initialised FatFS on SD Card I didn't face any problem so I don't think there's some hardware issue.

Any help ?

How can I debug or if something more needs to be done?

Thanks & regards

Farhan

st.mcu

‌,

ELMHIRI.Syrine

DAHMEN.IMEN

ELMHIRI.Syrine

#sdcard-fatfs #usb #stm32l4 #clive-one #usbmsc
7 REPLIES 7
Posted on March 26, 2018 at 15:09

You'd likely need to instrument the USB interactions, and at the SCSI/ATAPI command processing level. Use the serial port or SWV so as not to interfere with the real-time operation.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
Posted on March 27, 2018 at 08:07

I have an another board stm32f4-discovery, I ported the above code to it and this is what I get

0690X0000060AHzQAM.png0690X0000060AGcQAM.png
Farhan Khan
Associate II
Posted on March 27, 2018 at 13:41

On further looking for information this is what I got

0690X0000060AH1QAM.png0690X0000060AJMQA2.png0690X0000060AH6QAM.png
Farhan Khan
Associate II
Posted on March 30, 2018 at 08:29

Update :

After plugin the usb, and I am powering through USB VBUS I get a popup and I can see the removable drive in file explorer but it's not able to detect or access it

Any suggestions or help?

0690X0000060AL4QAM.png

________________

Attachments :

usbd_storage_if.c.zip : https://st--c.eu10.content.force.com/sfc/dist/version/download/?oid=00Db0000000YtG6&ids=0680X000006Hxr4&d=%2Fa%2F0X0000000b1P%2FK36HgwhzvAJpaqN..0D7BixAuAhWJ3TOCKxo.whRqv8&asPdf=false
James Murray
Senior
Posted on April 04, 2018 at 01:53

The MSC example code I started from was missing some critical code that broke writes. See here:

https://community.st.com/0D70X000006SyvdSAC

 

Perhaps this is the problem you are seeing too?

James

Posted on April 04, 2018 at 06:26

Thanks for your reply.

I was able to resolve it eventually.

SD card was detected I used to get the popup and it used to appear in removable device, but the PC wasn't able to access the SD card.

After completing sd fatfs and usb initialisation.

I again called sd_init and it worked