Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

SD card USB mass storage device for stm32F103

Status
Not open for further replies.

akshada

Member level 3
Joined
Jun 29, 2010
Messages
67
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,286
Location
india
Activity points
1,746
Hello all,
I am working in a project where I need to detect the SD card on SPI with STM32F103ZF needs to be detected as a mass storage device when connected to PC. I've the library for USB but don't know how the SD card can be detected as a mass storage device in PC. As I am new to USB, so I am a bit confused about the implementation.

Thanks in advance.
 

Well, I have this code I'm working on, made with Keil's (ARM) uVision. It was ported from STM's USB-FS library examples and Domen Puncer's SD/SDHC SPI fat implementation.
So far I managed to make a 1GB SD card, then a 16GB SDHC appear as a USB Mass Storage Devices through a STM32F103RBT6.
I'm still working on it, so it's far from optimized. But it works well on Windows 7 x64.
The code will want to address an ILI9325 lcd controller too. You may want to remove all references to "ili9325.h" and stripe the project off its "ili9325.c" file.
I also modified RealView's "stdint.h" file so it includes more kinds of integers typedefs, mostly Finnish integers notations (u8, u16, s32, an such unambiguous ones STM's engineers & I like to use). Although it implies to modify STM's demo headers from spurious definitions sometimes.

So here's a copy of my project, including my <sdtint.h> file you'll wanna paste into your %KeilDirectory%\ARM\ARMCC\include directory to overwrite the existing one, or simply add it to the project's tree, your choice. It wasn't stripped of any typedefs, 'au contraire' some where added, along with preprocessor conditionals.

Anyway, about the project : don't try to use the FatFS methods implemented there once the device is plugged to a USB port, cuz I didn't work on interleaving theses operations yet.
Also, right now, the card shouldn't be plugged/removed on-the-fly... You need to reset the MCU for the card's CSD copy to be refreshed... I had a precomputed version of the card specific data (CSD) cached upon initialization, since I discovered the STM's media acces layer ask for it quite often. And since my project is supposed to deal with the same SD card for extended periods of time, I had this critical data cached in the MCU's SRAM.

Ah, yes...almost forgot: neither DMA transfers between SPI and USB, nor harware CRC usage for the card's comms... those are things to come, but just not yet.
 
Last edited:

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top