2017-02-10 12:19 AM
Hi All,
I am evaluating the STM32f4 discovery board. I want to implement the USB mass storage functionality.I interfaced the SD card using the SDIO 1-bit mode.But, I want to share SD card's data in the PC use of USB Mass storage option.
Please help to make it happen.
I need some reference code or document for the same.
Please let me know if you need more information from our side,
Thanks,
Parth Modi
#stm32f407vgt6 #usb_otg_fs #stm32f4-discovery #sd-as-usb-mass-storage2017-02-14 05:01 AM
Hi Parth. You have the STM32F4 Discovery but the code examples referenced by Imen are for the STM32F4-EVAL.
However, you should be able to compare the pinout details of how the -EVAL kit is wired and port over to your Discovery board. We followed a similar example and had the project working within a few hours.
Other ideas:
http://moretosprojects.blogspot.ca/2014/12/stm32f4-usb-host-and-device.html
* applied onto the STM32F4 Nucleo board
You could consider to use the mbed platform to wire up your solution.
https://developer.mbed.org/questions/54385/How-to-use-mbed-for-the-STM32F4-DISCOVER/
https://developer.mbed.org/users/langster1980/notebook/sd-card-tutorial-for-the-unitiated/
What is your wiring diagram for the USB ? Wiring for the SD Card ?
Since you have reported the USB working with Clive's code, your USB interface must be ok. You have many options but will have to invest some time to dig through the referenced code and apply onto your Discovery board. The review and use of the -EVAL source code may be the shortest route to take for your project. If the USB interface is not working using the -EVAL code, do review Imen's suggestions on the tweaks and also confirm the USB interface pins used in this source code against your wiring diagram. Often, the STM32F processors have many alternate pin mappings so that may be issue.
update #1
Parth - download the schematics for the -EVAL board and also for your Discovery board to compare:
http://www.st.com/resource/en/schematic_pack/stm324xg-eval_sch.zip
http://www.st.com/resource/en/schematic_pack/stm32f4discovery_sch.zip
USB port pins on both boards
SD Card pins applied with the -EVAL board - use the same port pins for your DISCOVERY
From a quick review, the -EVAL board is using PA11 (D-) & PA12 (D+) for the USB FS interface. Be sure you are doing the same. Fairly confident you are ok here.
A key difference is the high speed clock on each board. From the MB786.PDF schematic (-EVAL board), the crystal X4 is 25 Mhz. On the DISCOVERY board, the crystal X2 is 8 Mhz. The clock (timing) and port relationships must be correct to move forward. Study Clive's code on the working USB engine and refine the non-working code from the -EVAL based project. Focus on only the USB front end at this time using the -EVAL code. Once you resolve the USB interface, you should be a good place for the SD support since the code example already has this part operational.
The CPU package used on the DISCOVERY (TQFP) is not the same as the -EVAL board (BGA) so you will have to review the port pin names
2017-02-14 05:10 AM
Hi
IMEN D,
Thanks for quick response.
I tried your suggestion.But it gives compile time error.I am working on stm32f4- discovery board and this code for the stm32469 discovery board.
I already tried with A:\Parth Modi\Yield_Firmware_project\stm32cubef4\STM32Cube_FW_F4_V1.10.0\Projects\STM324xG_EVAL\Applications\USB_Device\MSC_Standalone code.
This code is successfully compiled and run .But it gives the USB device not recognize notification on my PC.
So, please help me to work this code for me.
Thanks,
Parth Modi
2017-02-14 05:38 AM
Hi
Modi.Parth
,If yourdevice is not enumerated, try to increase heap and stack sizes.
I recommendyou using the last version of STM32CubeF4 v1.0 which contains updates to fix defects and enhancements implementation.
You may refer to the
MSC
applicationand re-use the sections available in the example or get inspired from them.Please keep me informed about your progress on this topic.
Regards
Imen
2017-02-16 02:30 AM
Hi
Bhatia.Kumar
2019-03-04 12:40 AM
And I need a USB Mass Storage device example code for STM32f072. I found for STM32f103, but it does not work ...