I use Elm Chan's FAT32 library with custom initialisation code for SD managemnt with STM32. I have a bunch of 512Mb-2Gb SD cards that I wanna utilize in hardware. I noticed strange behavior with some of the cards.
According to Elm's code we should issue CMD8 command to check the card's type: 1.0/1.1 or 2.0+
512Mb cards give me
CMD0 OK
sdc_cmd: CMD8
Spi::assert
R: 0xFF
R: 0x5
Which is illegal command + idle - OK
1Gb/2Gb cards give me
CMD0 OK
sdc_cmd: CMD8
Spi::assert
get_response:
R: 0xFF
R: 0x1
CMD8 OK
SDHC detected
SD v2
after standart initiation I issue
sdc_cmd: CMD16
Spi::assert
get_response: expecting 0x1
R: 0xFF
R: 0x1
Block size was set to 512
SD init OK
Spi::highspeed
disk_read: Drive=0, sector=0,
Sdc::read_block, Address=0, BlockSize=1
sdc_cmd: CMD17
Spi::assert
get_response: expecting 0x0
R: 0xFF
R: 0x1
So it does not respond to CMD17 as I expected. In Windows all 2Gb cards works OK and detected as SD, not SDHC.
The question:
1) Why 2Gb card behaves like v2.0? 2) What to do in this case? Where I made mistake in the init process?
The code is here SDC_Error Sdc::initialize(void)