Error reading from SDHC (init OK)

03 Nov 2010

Gentlemen,

just trying to use SDHCFileSystem class with Kingston 4GB MicroSDHC card. The card seems to be initialized properly:

FATFileSystem(sd)
Mounting [sd] on ffs drive [0]
Init
open(myfile.txt) on filesystem [sd], drv [0]
disk_initialize on drv [0]

Init: SDCARD_V2

CSD_STRUCT = 0

SDCard
c_size: 0003
capacity: 8192
sectors: 16

When trying to open a file for writing, the card refuses reading (CMD17) from the very first sector and returns error code 4 (illegal command). Accordig to the spec, the CMD17 should be mandatory, I've tried CMD18 (CONT_READ), with the same error.

disk_read(sector 0, count 1) on drv [0]
 disk_read(sector 0)
Reading block 0, cdv 512
Error 0x4

Finally, the FAT FS reports the card as unformatted (FR_NO_FILESYSTEM). The behaviour is fairly stable, so I don't expect a hardware problem (?). I am using the Sparkfun-like wiring (no pull-ups). The card is labeled SDHC, but recognized as standard SD card (cdv=512), however this should not prevent reading from address 0 IMO. May be improperly initialized because of that?

Have some of you experienced a similar problem?

Thanks in advance, Jaroslav

11 Feb 2011

On a slightly different topic, I have been able to use the SDHCFileSystem ok using a 2G Sandisk micro SD. However, if I remove mbed power, remove the SD drive and power up again, the mbed hangs at the first access to SD. Is this a known problem? Thanks all, ...kevin