cancel
Showing results for 
Search instead for 
Did you mean: 

STM3240-G USB-MSC Wrong SD Card Size

nattayb
Associate II
Posted on February 12, 2014 at 18:03

I'm using custom code which is somewhat ported from the STM3240-G USBD-MSC example application. I also made modifications to the read/write functions to take blocks as arguments vs. bytes. I've stepped through the code and verified the CSD fields are being correctly convereted to the correct card capacity. However, when plugged into a computer (tried Win7 and XP) the 16GB card shows up as 2.83GB. I also tried with a 2GB and 4GB card and both card capacity's displayed correctly. Is there a fix somehwere I missed? Any help would be greatly appreciated.

4 REPLIES 4
Posted on February 12, 2014 at 18:09

Probably at the SCSI command level, make sure that the ''READ CAPACITY'' command returns the correct size, and the READ10/WRITE10 commands also pass blocks. In usbd_storage_msd.c as I recall.

I've posted a 4GB+ version of the MSC for the STM32F4-DISCO which addresses these issues.
Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
nattayb
Associate II
Posted on February 12, 2014 at 21:21

I had previously discovered your port for the STM32F4-DISCO board (well done by the way) and incorporated the changes into my own project (block addressing). I've checked that the call to the SD card driver is returning the correct value. I also verified that the value is put in the SCSI call ''SCSI_ReadFormatCapacity'' correctly. I also compared the code to the TI CM4 equivalent and found no notable differences. I'd be willing to post my project, however I use Thunderbench so it would need some configuring for Keil.

nattayb
Associate II
Posted on February 13, 2014 at 16:24

I was able to get it working. However, I didn't make any changes beyond what was mentioned above.

nattayb
Associate II
Posted on February 13, 2014 at 21:58

oblem I discovered was that with ST's stock c