[rtems commit] SPI SD-Card: setup valid CRC-7 for STOP_TRANSMISSION command .

Sebastian Huber sebh at rtems.org
Tue Oct 8 09:10:08 UTC 2013


Module:    rtems
Branch:    4.10
Commit:    df29cfeb0c099d385ba178277f4f0d48b18e0132
Changeset: http://git.rtems.org/rtems/commit/?id=df29cfeb0c099d385ba178277f4f0d48b18e0132

Author:    Pavel Pisa <ppisa at pikron.com>
Date:      Tue Oct  8 10:40:29 2013 +0200

SPI SD-Card: setup valid CRC-7 for STOP_TRANSMISSION command.

STOP_TRANSMISSION command is used to finish READ_MULTIPLE_BLOCK
command and its format is regular command format.
It requires valid CRC-7 to have effect at least on
same cards types else it is ignored and attempt
to issue next READ or WRITE commands results in
illegal command condition (0x04) preceded by strange
(0x3f) for tested card.

Signed-off-by: Pavel Pisa <ppisa at pikron.com>

---

 c/src/libchip/i2c/spi-sd-card.c |    5 +++++
 1 files changed, 5 insertions(+), 0 deletions(-)

diff --git a/c/src/libchip/i2c/spi-sd-card.c b/c/src/libchip/i2c/spi-sd-card.c
index 5a30451..13d5f06 100644
--- a/c/src/libchip/i2c/spi-sd-card.c
+++ b/c/src/libchip/i2c/spi-sd-card.c
@@ -501,8 +501,13 @@ static int sd_card_send_register_command( sd_card_driver_entry *e, uint32_t comm
 static int sd_card_stop_multiple_block_read( sd_card_driver_entry *e)
 {
 	int rv = 0;
+	uint8_t crc7;
 
 	SD_CARD_COMMAND_SET_COMMAND( e->command, SD_CARD_CMD_STOP_TRANSMISSION);
+	SD_CARD_COMMAND_SET_ARGUMENT( e->command, 0);
+	/*crc7 = sd_card_compute_crc7( e->command + 1, 5);*/
+	crc7 = 0x30;	/* Help compiler - command and argument are constants */
+	SD_CARD_COMMAND_SET_CRC7( e->command, crc7);
 	rv = rtems_libi2c_write_bytes( e->bus, e->command, SD_CARD_COMMAND_SIZE);
 	RTEMS_CHECK_RV( rv, "Write stop transfer token");
 




More information about the vc mailing list