cancel
Showing results for 
Search instead for 
Did you mean: 

STM32F103 SDIO + USB FS Mass Storage, where to start ?

neoirto
Associate II
Posted on August 16, 2013 at 14:50

Hi all,

I'm looking for the best starting place (with ST examples, existing library...) to start the development of the following functions on STM32F103RC :

- USB Mass Storage at Full Speed,

- with an SD Card support (FAT16 could be enough, and faster ?), with SDIO+DMA driver for the best performance (SPI is too slow and needs too much RAM).

So I found a lot of community contributions that can be good starting places for me, and now I'd greatly appreciate your feedback and suggestions about my project !

EXISTING CODE FOUND :

/public/STe2ecommunities/mcu/Lists/cortex_mx_stm32/DispForm.aspx?ID=23167&RootFolder=/public/STe2ecommunities/mcu/Lists/cortex_mx_stm32/Where%20is%20the%20UsbMassStorage%20Examples%20%20Supt%20for%20stm32f4xx&Source=https://my.st.com/public/STe2ecommunities/mcu/Lists/cortex_mx_stm32/Flat.aspx?RootFolder%3D%252Fpublic%252FSTe2ecommunities%252Fmcu%252FLists%252Fcortex%255Fmx%255Fstm32%252FWhere%2520is%2520the%2520UsbMassStorage%2520Examples%2520%2520Supt%2520for%2520stm32f4xx%26FolderCTID%3D0x01200200770978C69A1141439FE559EB459D7580009C4E14902C3CDE46A77F0FFD06506F5B%26currentviews%3D1853

Is it ported for STM32F103 ? Is there any equivalent ?

-

http://nemuisan.blog.bai.ne.jp/?eid=192848

. Did anybody test that code already ?

-

/public/STe2ecommunities/mcu/Lists/cortex_mx_stm32/DispForm.aspx?ID=18579

, but with SPI mode for the SD card.

This last feature (SD card bootloader) is great, and I'd like to implement it too, but my first priority would be on the USB Mass Storage + SDIO driver...

Thanks a lot for your answers 😉

#bootloader #bootloader #bootloader #iap #usb-msc-+-sdio
15 REPLIES 15
Posted on August 16, 2013 at 19:14

STM3210E-EVAL_FW_V2.0.0\Project\Demo\src\sdcard.c

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
neoirto
Associate II
Posted on August 16, 2013 at 19:55

Tx Clive, it looks to be a perfect starting place for SDIO + USB MSC for STM32F103. I'll have a deep look at it.

About the SD card BOOTLOADER, does any of you ever try this kind of feature on this MCU ? Is it a safe practice, or not recommended ?

Thanks again 😉
Posted on August 16, 2013 at 20:24

I've written loaders that have done this on several micros, it's even more useful when you want to payload several MB or GB onto blank NAND devices.

I've booted WinCE and Linux in this fashion.

Doing it with binary, hex files, or object files is quite common.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
neoirto
Associate II
Posted on August 16, 2013 at 22:36

Well, it's another good news so...

The STM32F103 will perfectly match my needs if this is possible.

Could you please advise me some links about this task, and if possible another starting place for the best integration to the USB MSC + SDIO code you advised me above (about hex, bin... What compiler to choose) ??

I believe I will be soon STM32 addict...

Many thanks Clive

Posted on August 17, 2013 at 22:37

Development environments depend to be driven be personal preferences, or business drivers. You should evaluation them against your own preferences. I like Keil and Rowley, but have worked with many others. I use other editors and source management tools.

In terms of porting the EVAL board code, it should be a sufficiently good starting point. Get the read/write functions working on your board, and validate the functionality. Integrate these working routines with FatFs (diskio.c). The MSC code would be a matter to integrating the read/write routines, and capacity routines, in a similar manner to the F4 implementation.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
neoirto
Associate II
Posted on August 18, 2013 at 19:12

Ok Clive, so I understand there is mainly proprietary bootloaders, distributed by Keil and others ? There is no ST example code for bootloaders ?

Perhaps I could try from the

https://my.st.com/public/STe2ecommunities/mcu/Lists/cortex_mx_stm32/DispForm.aspx?ID=18579

code ?

Tx again

Posted on August 18, 2013 at 20:26

You asked a question about compilers, I was addressing that.

ST has some IAP examples, they would be worth a review.
Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
neoirto
Associate II
Posted on August 19, 2013 at 12:06

Sorry about misconfusion Clive : my point is mainly about bootloader (IAP was a good keyword). But it is still a mystery for me what is the exact procedure for bootloader usage under IDE (I'm using CoIDE).

With your help (good keywords), I found ST AN about 

http://www.st.com/web/en/resource/technical/document/application_note/CD00161640.pdf

. According to this AN, there is no limitation on the source (USART on the ST example, but it could be any other data protocol as USB).

About the IDE usage (p14 of the AN): for this USART example, I understood you need logicaly 2 projects :

- 1 for the bootloader, with a start address at 0x8000000 and a size of 0x0002FFF (or 0x0003000 ?), that you can upload with JTAG on your chip...

- 1 for the USER_program, with a start address at 0x8003000 and a size depending on the ''Top flash memory address'' depending on the Flash capacity of your chip.

Is that correct ? Is there any other configurations, property to add to your project to compile both program (perhaps modifying directly system_stm32f10x.c)?

Additionaly, I found now an

https://code.google.com/p/stm32bootloader/source/browse/trunk/+stm32bootloader+--username+weiweijeff/?r=2#%20stm32bootloader%20--username%20weiweijeff%253Fstate%253Dclosed

, with 0.8 FatFS version, but without low level SDIO driver.

It's probably a good starting place too, but it's GNU GPL license, and it needs 2 USB declarations and an additional USB driver on the desktop side to speak with the bootloader : more complexity if you need to be portable on Windows / Linux / Mac ?

My first tought is it is perhaps easier to develop the ''put the firmware.bin'' on SD card solution as a bootloader ?

Last question : is there a particular latency at startup you have to deal with using a bootloader ? What will be the typical delay before the first evaluation in the bootloader section (pushing the button on ST example), and the jump to the USER_program ?

I understand there is no ''software RESET'' during the jump ? If it's true, you can do a GPIO config at the beginning of the bootloader section, that will be set even after the jump to USER_program ?

All of this question are probably a bit ''noob's questions'', sorry about that 😉
umitguleer
Associate II
Posted on November 12, 2015 at 21:56

Hi clive;

I wanna use usb example and found a example in keil examples. I wanna use STM32F103 and my example is not clear. ı dont know, how I write usb. If you have a nice example, can you share with me??

thank you..