i am to configure a spartan 3A to interface with a SD card reader in SPI mode using MOSI, MISO, CS and CLK.
i have written code in VHDL to implement this, but cannot verify whether it works until the actual hardware is here (which is still a few weeks away).
i currently have a few simple questions:
lets say i have a txt file in the SD card called abc.txt with the text 'abc' inside. i know that to access a block of data (512 bytes) from a SD card in SPI mode i would have to send CMD 17 (read block) to the SD card. i know that CMD17 requires an address argument to be sent to the SD card, specifying where on the card do i want the data...so how do i find the address of the txt file?
i used winhex and opened a SDcard connected to my computer, i created the abc.txt file with the text 'abc'. from what i can see from winhex, does it mean that the address i have to specify is 0422EE00?
also, would the reply from the SDcard be (plain and simply) 'abc' in binary form? eg: 61h 62h 63h -> 01100001 01100010 01100011
thats all the questions i have for now, would appreciate any help! :grin:
so how do i find the address of the txt file?
you are using a file system. you would need to use its mechanisms for finding and retrieving files.
the sd card is essentially a block device. so you'd get blocks of data back. likewise, you'd need a block address. notice that the file starts on a 512B boundary? the block is then 0x0422EE00 / 0x200 = 0x21177. a read of that block will return 512B. (for sd, more for some of the SDHC formats).