Support W-04 firmware 4.0.0.01+

W-04 needs to use  CMD17 instead of CMD48 to retrieve iSDIO register memories.
To supporting both W-03 and W-04 card, I changed the readExt() code to use CMD48 first and use CMD17 if it returned some error.
This method is from the FlashAir developer sample code.
https://flashair-developers.github.io/website/docs/tutorials/arduino/2
This commit is contained in:
odaki 2020-01-11 21:47:16 +09:00
parent f923427dc1
commit 2ca1bc0acb

View file

@ -774,7 +774,7 @@ uint8_t Sd2Card::readExt(uint32_t arg, uint8_t* dst, uint16_t count) {
uint16_t i;
// send command and argument.
if (cardCommand(CMD48, arg)) {
if (cardCommand(CMD48, arg) && cardCommand(CMD17, arg)) { // CMD48 for W-03, CMD17 for W-04
error(SD_CARD_ERROR_CMD48);
goto fail;
}