Backported latest improvements and fixes from the SdFat liibrary to our own version. This includes support for CRC7 validation on commands and also, made sure that even if using software SPI implementations, SD card speed is properly adjusted when transitioning from INITIALIZATION to DATA TRANSFER mode. ALL HALs implement spiInit, even in SW SPI mode, and we NEED this change to improve 25x the transfer speed of the SD card and allow implementations of USB MSD

This commit is contained in:
etagle
2017-12-21 02:29:00 -03:00
parent 7447979110
commit 9aff55ed1f
3 changed files with 168 additions and 75 deletions

View File

@@ -54,12 +54,13 @@ uint8_t const CMD0 = 0x00, // GO_IDLE_STATE - init card in spi mode if CS low
CMD24 = 0x18, // WRITE_BLOCK - write a single data block to the card
CMD25 = 0x19, // WRITE_MULTIPLE_BLOCK - write blocks of data until a STOP_TRANSMISSION
CMD32 = 0x20, // ERASE_WR_BLK_START - sets the address of the first block to be erased
CMD33 = 0x21, // ERASE_WR_BLK_END - sets the address of the last block of the continuous range to be erased*/
CMD38 = 0x26, // ERASE - erase all previously selected blocks */
CMD55 = 0x37, // APP_CMD - escape for application specific command */
CMD58 = 0x3A, // READ_OCR - read the OCR register of a card */
ACMD23 = 0x17, // SET_WR_BLK_ERASE_COUNT - Set the number of write blocks to be pre-erased before writing */
ACMD41 = 0x29; // SD_SEND_OP_COMD - Sends host capacity support information and activates the card's initialization process */
CMD33 = 0x21, // ERASE_WR_BLK_END - sets the address of the last block of the continuous range to be erased
CMD38 = 0x26, // ERASE - erase all previously selected blocks
CMD55 = 0x37, // APP_CMD - escape for application specific command
CMD58 = 0x3A, // READ_OCR - read the OCR register of a card
CMD59 = 0x3B, // CRC_ON_OFF - enable or disable CRC checking
ACMD23 = 0x17, // SET_WR_BLK_ERASE_COUNT - Set the number of write blocks to be pre-erased before writing
ACMD41 = 0x29; // SD_SEND_OP_COMD - Sends host capacity support information and activates the card's initialization process
/** status for card in the ready state */
uint8_t const R1_READY_STATE = 0x00;