Skip to content

Commit

Permalink
disk: sdhc: Set LSB of command to 1 as end bit
Browse files Browse the repository at this point in the history
The SD Card Physical Layer specification states in Table 7-1
(in section 7.3.1.1) that the LSB of the 48 bit command must
be set to 1 to act as an 'end bit'.

Fixes #33479

Signed-off-by: Rich Barlow <[email protected]>
  • Loading branch information
Rich Barlow authored and MaureenHelm committed Mar 19, 2021
1 parent 5ebb421 commit 795d057
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion subsys/disk/disk_access_spi_sdhc.c
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,9 @@ static int sdhc_spi_tx_cmd(struct sdhc_spi_data *data, uint8_t cmd, uint32_t pay
/* Encode the command */
buf[0] = SDHC_TX | (cmd & ~SDHC_START);
sys_put_be32(payload, &buf[1]);
buf[SDHC_CMD_BODY_SIZE] = crc7_be(0, buf, SDHC_CMD_BODY_SIZE);

/* Add CRC and set LSB as 'end bit' */
buf[SDHC_CMD_BODY_SIZE] = crc7_be(0, buf, SDHC_CMD_BODY_SIZE) | 0x01;

return sdhc_spi_tx(data, buf, sizeof(buf));
}
Expand Down

0 comments on commit 795d057

Please sign in to comment.