Can't read Card Specific Data from SD Card (rtems-4.9.0)

Robert S. Grimes rsg at alum.mit.edu
Wed Oct 8 23:34:30 UTC 2008


I've firmed up my hardware, and things seem much better. I seem to be 
able to reliably set SPI mode, initialize the card, and read the CID 
information. However, I cannot get the card to send its CSD. In order to 
attempt some progress, I've intentionally ignored errors when sending 
the SD_CARD_CMD_SEND_CSD command, and attempt to interpret the 
information that is returned, but it is all nonsense. This is the 
results from the aforementioned command:

sd_card_send_command: Error: Response: ff:ff 49:ff 00:ff 00:ff 00:ff 
00:ff 95:82
ff:[7f] ff:ff ff:ff ff:ff ff:ff ff:ff ff:ff ff:ff ff:ff ff:ff ff:ff

I don't understand the 82 and 7f that it seems to find in the response 
data; shouldn't I see something like {ff} 01 {ff} fe <CSD bytes>?
By the way, it seems I need to set both clock_inv and clock_phs true in 
the rtems_libi2c_tfr_mode_t structure used to set the transfer mode. 
This surprised me a bit, but then again, the other three combinations 
didn't work - I brute-forced it and tried all four, because I couldn't 
find documentation specifying which to use, and because nothing was 
working at the time ;-). Anyway, does that sound right?

Any ideas? Thanks,
-Bob

P.S. Here is the full output as it stands:

    sd_card_driver_init: Ok: Get driver entry
    sd_card_start: Ok: Send start
    virtex_spi_ioctl
    virtex_spi_set_tfr_mode
    virtex_spi_char_mode
    sd_card_start: Ok: Set transfer mode
    sd_card_start: Ok: Send address
    sd_card_driver_init: Ok: Start
    sd_card_driver_init: Ok: Register disk IO driver
    sd_card_wait: Ok: Busy
    sd_card_driver_init: Ok: Wait
    sd_card_driver_init: Ok: Active chip select delay
    sd_card_stop: Ok: Send stop
    sd_card_driver_init: Ok: Stop
    sd_card_driver_init: Ok: Send start
    virtex_spi_ioctl
    virtex_spi_set_tfr_mode
    virtex_spi_char_mode
    sd_card_driver_init: Ok: Set transfer mode
    sd_card_driver_init: Ok: Inactive chip select delay
    sd_card_driver_init: Ok: Send address
    sd_card_stop_multiple_block_write: Ok: Wait
    sd_card_stop_multiple_block_write: Ok: Write stop transfer token
    sd_card_wait: Ok: Busy
    sd_card_send_command: Ok: Wait
    virtex_spi_ioctl
    sd_card_send_command: Ok: Write command and read response
    sd_card_send_command: Token [07]: 0xff
    sd_card_send_command: Token [08]: 0xff
    sd_card_send_command: Token [09]: 0xff
    sd_card_send_command: Token [10]: 0xff
    sd_card_send_command: Token [11]: 0xff
    sd_card_send_command: Token [12]: 0xff
    sd_card_send_command: Token [13]: 0xff
    sd_card_send_command: Token [14]: 0xff
    sd_card_send_command: Token [15]: 0xff
    sd_card_send_command: Token [16]: 0xff
    sd_card_send_command: Token [17]: 0xff
    sd_card_send_command: Error: Timeout
    sd_card_send_command: Error: Response: ff:ff 4d:ff 00:ff 00:ff 00:ff
    00:ff 95:ff
    ff:ff ff:ff ff:ff ff:ff ff:ff ff:ff ff:ff ff:ff ff:ff ff:ff ff:[ff]
    sd_card_stop_multiple_block_read: Ok: Write stop transfer token
    sd_card_send_command: Ok: Wait
    virtex_spi_ioctl
    sd_card_send_command: Ok: Write command and read response
    sd_card_send_command: Token [07]: 0xff
    sd_card_send_command: Token [08]: 0x01
    sd_card_driver_init: Ok: Send: SD_CARD_CMD_GO_IDLE_STATE
    sd_card_send_command: Ok: Wait
    virtex_spi_ioctl
    sd_card_send_command: Ok: Write command and read response
    sd_card_send_command: Token [07]: 0xff
    sd_card_send_command: Token [08]: 0x01
    sd_card_driver_init: Ok: Send: SD_CARD_CMD_APP_CMD
    sd_card_send_command: Ok: Wait
    virtex_spi_ioctl
    sd_card_send_command: Ok: Write command and read response
    sd_card_send_command: Token [07]: 0xff
    sd_card_send_command: Token [08]: 0x01
    sd_card_driver_init: Ok: Send: SD_CARD_ACMD_SD_SEND_OP_COND
    sd_card_send_command: Ok: Wait
    virtex_spi_ioctl
    sd_card_send_command: Ok: Write command and read response
    sd_card_send_command: Token [07]: 0xff
    sd_card_send_command: Token [08]: 0x01
    sd_card_driver_init: Ok: Send: SD_CARD_CMD_APP_CMD
    sd_card_send_command: Ok: Wait
    virtex_spi_ioctl
    sd_card_send_command: Ok: Write command and read response
    sd_card_send_command: Token [07]: 0xff
    sd_card_send_command: Token [08]: 0x01
    sd_card_driver_init: Ok: Send: SD_CARD_ACMD_SD_SEND_OP_COND
    sd_card_send_command: Ok: Wait
    virtex_spi_ioctl
    sd_card_send_command: Ok: Write command and read response
    sd_card_send_command: Token [07]: 0xff
    sd_card_send_command: Token [08]: 0x01
    sd_card_driver_init: Ok: Send: SD_CARD_CMD_APP_CMD
    sd_card_send_command: Ok: Wait
    virtex_spi_ioctl
    sd_card_send_command: Ok: Write command and read response
    sd_card_send_command: Token [07]: 0xff
    sd_card_send_command: Token [08]: 0x00
    sd_card_driver_init: Ok: Send: SD_CARD_ACMD_SD_SEND_OP_COND
    sd_card_send_command: Ok: Wait
    virtex_spi_ioctl
    sd_card_send_command: Ok: Write command and read response
    sd_card_send_command: Token [07]: 0xff
    sd_card_send_command: Token [08]: 0xff
    sd_card_send_command: Token [09]: 0x00
    sd_card_driver_init: Ok: Send: SD_CARD_CMD_SEND_CID
    sd_card_read: Search from 10 to 17
    sd_card_read: Token [10]: 0xff
    sd_card_read: Token [11]: 0xfe
    sd_card_read: Ok: Read data
    sd_card_read: Ok: Read CRC 16
    sd_card_driver_init: Ok: Read: SD_CARD_CMD_SEND_CID
    sd_card_driver_init: *** Card Identification ***
    sd_card_driver_init: Manufacturer ID : 3
    sd_card_driver_init: OEM/Application ID : 21316
    sd_card_driver_init: Product name : SD01G€
    sd_card_driver_init: Product revision : 0
    sd_card_driver_init: Product serial number : 2696421888
    sd_card_driver_init: Manufacturing date : 136
    sd_card_driver_init: 7-bit CRC checksum : 27
    sd_card_send_command: Ok: Wait
    virtex_spi_ioctl
    sd_card_send_command: Ok: Write command and read response
    sd_card_send_command: Token [07]: 0x7f
    sd_card_send_command: Error: Command error [07]: 0x7f
    sd_card_send_command: Error: Response: ff:ff 49:ff 00:ff 00:ff 00:ff
    00:ff 95:82
    ff:[7f] ff:ff ff:ff ff:ff ff:ff ff:ff ff:ff ff:ff ff:ff ff:ff ff:ff
    RSG: rv=-27
    sd_card_driver_init: Ok: Send: SD_CARD_CMD_SEND_CSD
    sd_card_read: Search from 8 to 17
    sd_card_read: Token [08]: 0xff
    sd_card_read: Token [09]: 0xff
    sd_card_read: Token [10]: 0xff
    sd_card_read: Token [11]: 0xff
    sd_card_read: Token [12]: 0xff
    sd_card_read: Token [13]: 0xff
    sd_card_read: Token [14]: 0xff
    sd_card_read: Token [15]: 0xff
    sd_card_read: Token [16]: 0xff
    sd_card_read: Error: Timeout
    RSG: rv=-27
    sd_card_driver_init: Ok: Read: SD_CARD_CMD_SEND_CSD
    sd_card_driver_init: *** Card Specific Data ***
    sd_card_driver_init: CSD structure : 0
    sd_card_driver_init: Spec version : 0
    sd_card_driver_init: Access time [ns] : 4500
    sd_card_driver_init: Max access time [N] : 7053
    sd_card_driver_init: Max read block size [B] : 1
    sd_card_driver_init: Max write block size [B] : 1
    sd_card_driver_init: Block size [B] : 1
    sd_card_driver_init: Block number : 10488
    sd_card_driver_init: Capacity [B] : 10488
    sd_card_driver_init: Max transfer speed [b/s] : 450000000
    sd_card_send_command: Ok: Wait
    virtex_spi_ioctl
    sd_card_send_command: Ok: Write command and read response
    sd_card_send_command: Token [07]: 0xff





More information about the users mailing list