sdcErase fails for high capacity SD card.
from https://chlazza.nfshost.com/sdcardinfo.html, note 10 => 10. SDSC Card (CCS=0) uses byte unit address and SDHC and SDXC Cards (CCS=1) use block unit address (512 bytes unit).
So the test in sdcErase seems inverted
tested with if ((sdcp->cardmode & SDC_MODE_HIGH_CAPACITY) == 0U)
and it works !
when the following patch is applied, sdcErase works for sdhc card.
Code: Select all
diff --git a/os/hal/src/hal_sdc.c b/os/hal/src/hal_sdc.c
index e2c6452f7..7160f255a 100644
--- a/os/hal/src/hal_sdc.c
+++ b/os/hal/src/hal_sdc.c
@@ -967,7 +967,7 @@ bool sdcErase(SDCDriver *sdcp, uint32_t startblk, uint32_t endblk) {
sdcp->state = BLK_WRITING;
/* Handling command differences between HC and normal cards.*/
- if ((sdcp->cardmode & SDC_MODE_HIGH_CAPACITY) != 0U) {
+ if ((sdcp->cardmode & SDC_MODE_HIGH_CAPACITY) == 0U) {
startblk *= MMCSD_BLOCK_SIZE;
endblk *= MMCSD_BLOCK_SIZE;
}
Alexandre