cancel
Showing results for 
Search instead for 
Did you mean: 

STM32F2xx HS USB MSD fault on cards over 4GB

dcurran2
Associate II
Posted on April 09, 2014 at 14:49

I have taken the code from the stm3220G - eval board and change the HSE setting to match my hardware. I have also configured the HS port to us the embedded phy. the storage media is a SD card driven via the SDIO

This works well on 2GB SD cards, but I have recently been given 8GB cards to test the system to work with

The host PC enumerates the USB and then reports the SD card as not being formatted yet if I take the SD card out of the HArdware and directly connect it to the PC is sees the card and that it is formatted.

I have a PC tool called disk explorer that allows you to see the file system data eg partition, boot, fats , root etc and from this I see there is a differance in the SD card Cylinder,Head,Sector sizes eg connected directly to the PC C,H,S= 1006*255*63  yet taken through the ST USB code the C,H,S = 488*255*6

Has anyone else come across this and if so what did you need to do to fix it ? Do I have to did through the code to find out whey the SD_GetCardInfo()  seems to give the wrong answers

 

 
5 REPLIES 5
Posted on April 09, 2014 at 15:43

ST over the years has posted broken code that supports cards smaller than 4GB (2**32), some of the newer F4 series code uses 64-bit variables to deal with this, and I've posted several fixed versions using 32-bit BLOCK ADDRESSING versions to replace the BYTE ADDRESSING methods ST used.

Basically the READ CAPACITY, READ and WRITE commands must be adjusted to function properly in the MSC/USBSTOR implementation on the STM32

My most recent STM32F4-DISCO + STM32F4-DIS-BB implementation is

https://drive.google.com/file/d/0B7OY5pub_GfIRUJPSUVxNTV3TEk/edit?usp=sharing

.

I've used cards from 128MB to 64GB
Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
dcurran2
Associate II
Posted on April 09, 2014 at 16:51

Thanks Clive

just what I needed 

dcurran2
Associate II
Posted on April 09, 2014 at 18:47

Clive 

thanks for your help - it was a bit of a rush job for me as the product was based around a project started in 2011 ( bootloader) 

I use the Keil tool chain but at the time the RL ARM usb code didnt support the HS port not using the embedded so used the ST code. Was ambushed by production with a 8GB card instead of the previously used 2GB and having problems in testing so needed to understand what was wrong

Does anyone have experience of the Keil packs in v5 and performance compared to the ST code ? ( USB SDIO) 

 

Posted on April 09, 2014 at 18:56

Using uv4 here, uv5 seems to induce more headaches for others, so don't plan to upgrade yet.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
dcurran2
Associate II
Posted on April 10, 2014 at 11:03

My biggest problem with the packs seems to be the way the run time components are implemented.

If your hardware is not based on the Keil dev boards ( e.g. different HSE clocks ) you end up chasing settings (e.g changing  HSE in stm32fxxx.h that in a Keil  folder) or trying to get bits added you need ( touch screen controller etc) 

Trying now to get the HS USB device with SDIO sorted now. So far haven't been able to get it to enumerate.