You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mynewt.apache.org by je...@apache.org on 2026/07/06 08:57:44 UTC
(mynewt-core) 01/02: drivers/mmc: Read crc for data commands
This is an automated email from the ASF dual-hosted git repository.
kasjer pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/mynewt-core.git
commit 9cdef1e98df68efa79eee3dda2343d1384b6d314
Author: Jerzy Kasenberg <je...@codecoup.pl>
AuthorDate: Fri Jul 3 16:10:21 2026 +0200
drivers/mmc: Read crc for data commands
Code was not reading CRC for commands with
data other then CMD17/CMD18.
It could result in strange behavior for some
cards that send CRC on subsequent clocks
that belong to other requests and synchronization
was lost.
Now CRC is read after data block is received.
Signed-off-by: Jerzy Kasenberg <je...@codecoup.pl>
---
hw/drivers/mmc/src/mmc.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/hw/drivers/mmc/src/mmc.c b/hw/drivers/mmc/src/mmc.c
index 098d93c8c..457702042 100644
--- a/hw/drivers/mmc/src/mmc.c
+++ b/hw/drivers/mmc/src/mmc.c
@@ -360,6 +360,7 @@ mmc_cmd_receive_data(mmc_disk_t *mmc, uint8_t cmd, uint32_t payload,
{
int status;
uint8_t res;
+ uint8_t crc[2];
mmc_spi_set_cs(mmc, 0);
@@ -372,6 +373,8 @@ mmc_cmd_receive_data(mmc_disk_t *mmc, uint8_t cmd, uint32_t payload,
}
}
+ mmc_spi_rx(mmc, crc, 2);
+
mmc_spi_set_cs(mmc, 1);
mmc_send_extra_clocks(mmc);