Skip to content

Commit 37c84a3

Browse files
author
Wu Caize
committed
1. add sd card crc to support more sd card
1 parent 1d1ffce commit 37c84a3

File tree

1 file changed

+15
-15
lines changed

1 file changed

+15
-15
lines changed

components/drivers/sd_card/src/sdcard.c

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -218,7 +218,7 @@ static uint8_t sd_get_csdregister(SD_CSD *SD_csd)
218218
{
219219
uint8_t csd_tab[18];
220220
/*!< Send CMD9 (CSD register) or CMD10(CSD register) */
221-
sd_send_cmd(SD_CMD9, 0, 0);
221+
sd_send_cmd(SD_CMD9, 0, 1);
222222
/*!< Wait for response in the R1 format (0x00 is no errors) */
223223
uint8_t resp = sd_get_response();
224224
debug_print("[MaixPy] %s | resp = %x \r\n", __func__, resp);
@@ -322,7 +322,7 @@ static uint8_t sd_get_cidregister(SD_CID *SD_cid)
322322
{
323323
uint8_t cid_tab[18];
324324
/*!< Send CMD10 (CID register) */
325-
sd_send_cmd(SD_CMD10, 0, 0);
325+
sd_send_cmd(SD_CMD10, 0, 1);
326326
/*!< Wait for response in the R1 format (0x00 is no errors) */
327327
if (sd_get_response() != 0x00)
328328
{
@@ -463,15 +463,15 @@ uint8_t sd_init(void)
463463
index = 0xFF;
464464
while (index--)
465465
{
466-
sd_send_cmd(SD_CMD55, 0, 0);
466+
sd_send_cmd(SD_CMD55, 0, 1);
467467
result = sd_get_response();
468468
sd_end_cmd();
469469
if (result != 0x01)
470470
{
471471
debug_print("SD_CMD55 ack %X\r\n", result);
472472
return 0xFF;
473473
}
474-
sd_send_cmd(SD_ACMD41, 0x40000000, 0);
474+
sd_send_cmd(SD_ACMD41, 0x40000000, 1);
475475
result = sd_get_response();
476476
sd_end_cmd();
477477
if (result == 0x00)
@@ -519,7 +519,7 @@ uint8_t sd_init(void)
519519
}
520520
if (1 == sd_version)
521521
{
522-
sd_send_cmd(SD_CMD16, 512, 0);
522+
sd_send_cmd(SD_CMD16, 512, 1);
523523
if (sd_get_response() != 0x00)
524524
{
525525
sd_end_cmd();
@@ -550,12 +550,12 @@ uint8_t sd_read_sector(uint8_t *data_buff, uint32_t sector, uint32_t count)
550550
if (count == 1)
551551
{
552552
flag = 0;
553-
sd_send_cmd(SD_CMD17, sector, 0);
553+
sd_send_cmd(SD_CMD17, sector, 1);
554554
}
555555
else
556556
{
557557
flag = 1;
558-
sd_send_cmd(SD_CMD18, sector, 0);
558+
sd_send_cmd(SD_CMD18, sector, 1);
559559
}
560560
/*!< Check if the SD acknowledged the read block command: R1 response (0x00: no errors) */
561561
if (sd_get_response() != 0x00)
@@ -577,7 +577,7 @@ uint8_t sd_read_sector(uint8_t *data_buff, uint32_t sector, uint32_t count)
577577
sd_end_cmd();
578578
if (flag)
579579
{
580-
sd_send_cmd(SD_CMD12, 0, 0);
580+
sd_send_cmd(SD_CMD12, 0, 1);
581581
sd_get_response();
582582
sd_end_cmd();
583583
sd_end_cmd();
@@ -602,15 +602,15 @@ uint8_t sd_write_sector(uint8_t *data_buff, uint32_t sector, uint32_t count)
602602
if (count == 1)
603603
{
604604
frame[1] = SD_START_DATA_SINGLE_BLOCK_WRITE;
605-
sd_send_cmd(SD_CMD24, sector, 0);
605+
sd_send_cmd(SD_CMD24, sector, 1);
606606
}
607607
else
608608
{
609609
frame[1] = SD_START_DATA_MULTIPLE_BLOCK_WRITE;
610-
sd_send_cmd(SD_ACMD23, count, 0);
610+
sd_send_cmd(SD_ACMD23, count, 1);
611611
sd_get_response();
612612
sd_end_cmd();
613-
sd_send_cmd(SD_CMD25, sector, 0);
613+
sd_send_cmd(SD_CMD25, sector, 1);
614614
}
615615
/*!< Check if the SD acknowledged the write block command: R1 response (0x00: no errors) */
616616
if (sd_get_response() != 0x00)
@@ -649,12 +649,12 @@ uint8_t sd_read_sector_dma(uint8_t *data_buff, uint32_t sector, uint32_t count)
649649
if (count == 1)
650650
{
651651
flag = 0;
652-
sd_send_cmd(SD_CMD17, sector, 0);
652+
sd_send_cmd(SD_CMD17, sector, 1);
653653
}
654654
else
655655
{
656656
flag = 1;
657-
sd_send_cmd(SD_CMD18, sector, 0);
657+
sd_send_cmd(SD_CMD18, sector, 1);
658658
}
659659
/*!< Check if the SD acknowledged the read block command: R1 response (0x00: no errors) */
660660
if (sd_get_response() != 0x00)
@@ -677,7 +677,7 @@ uint8_t sd_read_sector_dma(uint8_t *data_buff, uint32_t sector, uint32_t count)
677677
sd_end_cmd();
678678
if (flag)
679679
{
680-
sd_send_cmd(SD_CMD12, 0, 0);
680+
sd_send_cmd(SD_CMD12, 0, 1);
681681
sd_get_response();
682682
sd_end_cmd();
683683
sd_end_cmd();
@@ -700,7 +700,7 @@ uint8_t sd_write_sector_dma(uint8_t *data_buff, uint32_t sector, uint32_t count)
700700
shift = i << 9;
701701
else
702702
shift = i;
703-
sd_send_cmd(SD_CMD24, sector + shift, 0);
703+
sd_send_cmd(SD_CMD24, sector + shift, 1);
704704
/*!< Check if the SD acknowledged the write block command: R1 response (0x00: no errors) */
705705
if (sd_get_response() != 0x00)
706706
{

0 commit comments

Comments
 (0)