SD Host Library
The SD/SDIO MMC card host interface (SDIO) provides an interface between the FT90x MCU and MultiMediaCards (MMCs), SD memory cards, SDIO cards and CE-ATA devices
The SD Host features include the following :
- Supports PIO data transfers.
- Supports configurable SD bus modes: 1-bit mode and 4-bit mode.
- Supports configurable 8-word/16-word register for data FIFO.
- Supports configurable 1K/2K/4K SRAM for data FIFO.
- Supports configurable 1-bit/4-bit SD card bus and 1-bit/4-bit/8-bit MMC card bus.
- Configurable CPRM function for security.
- Built-in generation and check for 7-bit and 16-bit CRC data.
- Card detection (Insertion/Removal).
- Supports Read Wait mechanism for SDIO function.
- Supports Suspend/Resume mechanism for SDIO function.
Important :
For better performance, please set the buffers holding the data to alignment 4.
Library Routines
SDHost_Init
Prototype |
procedure SDHost_Init(clockDiv : word; config : byte);
|
Description |
Initializes the SD Host peripheral according to the specified parameters.
|
Parameters |
clockDiv: specifies the system clock divider used for SD Host Clock Frequency (system clock / clockDiv ).
config : configuration paramerer. Valid values (can be OR-ed to form desired value) :
Value |
Description |
_SDHOST_CFG_1_WIDE_BUS_MODE |
1-bit data width mode. |
_SDHOST_CFG_4_WIDE_BUS_MODE |
4-bit data width mode. |
_SDHOST_CFG_CLOCK_RISING_EDGE |
The CMD and DAT line output at the rising edge of SCLK. |
_SDHOST_CFG_CLOCK_FALING_EDGE |
The CMD and DAT line output at the falling edge of SCLK. |
|
Returns |
Nothing.
|
Requires |
Nothing.
|
Example |
// Initialize SD Host interface
SDHost_Init(128, _SDHOST_CFG_4_WIDE_BUS_MODE or _SDHOST_CFG_CLOCK_RISING_EDGE);
|
Notes |
None.
|
SDHost_CardDetect
Prototype |
function SDHost_CardDetect() : byte;
|
Description |
Function detects if an SD card is detected.
|
Parameters |
None.
|
Returns |
_SDHOST_STATUS_CARD_INSERTED: if an SD card is detected.
_SDHOST_STATUS_CARD_REMOVED: if an SD card is removed.
_SDHOST_STATUS_ERROR: if an error occured.
|
Requires |
Nothing.
|
Example |
// wait until the card is detected
while(SDHost_CardDetect() <> _SDHOST_STATUS_CARD_INSERTED)
...
|
Notes |
None.
|
SDHost_SendCMD
Prototype |
function SDHost_SendCMD(cmdIdx : byte; cmdType : byte; sdioSpecialOp : byte; cmdArg : dword; response : ^dword) : byte;
|
Description |
Function sends a command without data transfer.
|
Parameters |
cmdIdx: command index (0 to 63).
cmdType: command type (bus / application-specific). Valid values :
Value |
Description |
_SDHOST_CMD_TYPE_BUS |
CMD52 for writing Bus Suspend in CCCR. |
_SDHOST_CMD_TYPE_APP_SPECIFIC |
CMD52 for writing Function Select in CCCR. |
sdioSpecialOp: the SDIO special operation for CMD52 (assign _SDHOST_SPECOP_NOT_IN_USE if the operation is not one of the 3 special ones). Valid values :
Value |
Description |
_SDHOST_SPECOP_WRITE_CCCR_BUS_SUSPEND |
CMD52 for writing Bus Suspend in CCCR. |
_SDHOST_SPECOP_WRITE_CCCR_FUNCTION_SELECT |
CMD52 for writing Function Select in CCCR. |
_SDHOST_SPECOP_WRITE_CCCR_IO_ABORT |
CMD12/52 for writing I/O Abort in CCCR. |
_SDHOST_SPECOP_NOT_IN_USE |
Normal commands. |
cmdArg: command argument (32 bits).
response: a pointer to the array (R2) / variable (others) that will hold the response.
|
Returns |
_SDHOST_STATUS_OK: if no errors occured,
_SDHOST_STATUS_ERROR: if an error occured,
_SDHOST_STATUS_CARD_INSERTED: if an SD card is detected,
_SDHOST_STATUS_CARD_REMOVED: if an SD card is removed,
_SDHOST_STATUS_INVALID_RESPONSE_TYPE: if invalid reponse type occured,
_SDHOST_STATUS_CMD_TIMEOUT: if a command timeout has occured,
_SDHOST_STATUS_UNUSABLE_CARD: if an SD card is unusable,
_SDHOST_STATUS_CMD2_FAILED: if the CMD2 command failed,
_SDHOST_STATUS_CMD3_FAILED: if the CMD3 command failed,
_SDHOST_STATUS_CMD8_FAILED: if the CMD8 command failed,
_SDHOST_STATUS_CMD9_FAILED: if the CMD9 command failed,
_SDHOST_STATUS_CMD55_FAILED: if the CMD55 command failed,
_SDHOST_STATUS_ACMD41_FAILED: if the ACMD41 command failed,
_SDHOST_STATUS_CANNOT_ENTER_TRANSFER_STATE: if transfer state cannot be entered,
_SDHOST_STATUS_CANNOT_SET_CARD_BUS_WIDTH: if card bus width cannot be set,
_SDHOST_STATUS_RESPONSE_ERROR: if response is not in valid format,
_SDHOST_STATUS_WRITE_ERROR: if writing error occured,
_SDHOST_STATUS_READ_ERROR: if reading error occured.
|
Requires |
Nothing.
|
Example |
// Send CMD16 to set the card's block length (512)
sdHostStatus := SDHost_SendCMD(16, _SDHOST_CMD_TYPE_BUS, _SDHOST_SPECOP_NOT_IN_USE, 512, @response);
|
Notes |
None.
|
SDHost_TransferData
Prototype |
function SDHost_TransferData(direction : byte; dataBuf : ^byte; numBytes : word; addr : dword) : byte;
|
Description |
Function perfoms a data transfer.
|
Parameters |
direction: data transfer direction. Valid values :
Value |
Description |
_SDHOST_DIR_WRITE |
Write transfer. |
_SDHOST_DIR_READ |
Read transfer. |
dataBuf: buffer containing data for transfer.
numBytes: number of bytes to be transferred.
addr: sector address.
|
Returns |
_SDHOST_STATUS_OK: if no errors occured,
_SDHOST_STATUS_ERROR: if an error occured,
_SDHOST_STATUS_CARD_INSERTED: if an SD card is detected,
_SDHOST_STATUS_CARD_REMOVED: if an SD card is removed,
_SDHOST_STATUS_INVALID_RESPONSE_TYPE: if invalid reponse type occured,
_SDHOST_STATUS_CMD_TIMEOUT: if a command timeout has occured,
_SDHOST_STATUS_UNUSABLE_CARD: if an SD card is unusable,
_SDHOST_STATUS_CMD2_FAILED: if the CMD2 command failed,
_SDHOST_STATUS_CMD3_FAILED: if the CMD3 command failed,
_SDHOST_STATUS_CMD8_FAILED: if the CMD8 command failed,
_SDHOST_STATUS_CMD9_FAILED: if the CMD9 command failed,
_SDHOST_STATUS_CMD55_FAILED: if the CMD55 command failed,
_SDHOST_STATUS_ACMD41_FAILED: if the ACMD41 command failed,
_SDHOST_STATUS_CANNOT_ENTER_TRANSFER_STATE: if transfer state cannot be entered,
_SDHOST_STATUS_CANNOT_SET_CARD_BUS_WIDTH: if card bus width cannot be set,
_SDHOST_STATUS_RESPONSE_ERROR: if response is not in valid format,
_SDHOST_STATUS_WRITE_ERROR: if writing error occured,
_SDHOST_STATUS_READ_ERROR: if reading error occured.
|
Requires |
Nothing.
|
Example |
// Initiates a read transfer starting from sector 0, transfers the 512 bytes of data into the inData buffer
sd_status := SDHost_TransferData(_SDHOST_DIR_READ, @inData, 512, 0);
|
Notes |
None.
|
SDHost_Abort
Prototype |
function SDHost_Abort() : byte;
|
Description |
Function sends Abort Command following the Asynchronous Abort Sequence.
|
Parameters |
None.
|
Returns |
_SDHOST_STATUS_OK: if no errors occured,
_SDHOST_STATUS_ERROR: if an error occured,
_SDHOST_STATUS_CARD_INSERTED: if an SD card is detected,
_SDHOST_STATUS_CARD_REMOVED: if an SD card is removed,
_SDHOST_STATUS_INVALID_RESPONSE_TYPE: if invalid reponse type occured,
_SDHOST_STATUS_CMD_TIMEOUT: if a command timeout has occured,
_SDHOST_STATUS_UNUSABLE_CARD: if an SD card is unusable,
_SDHOST_STATUS_CMD2_FAILED: if the CMD2 command failed,
_SDHOST_STATUS_CMD3_FAILED: if the CMD3 command failed,
_SDHOST_STATUS_CMD8_FAILED: if the CMD8 command failed,
_SDHOST_STATUS_CMD9_FAILED: if the CMD9 command failed,
_SDHOST_STATUS_CMD55_FAILED: if the CMD55 command failed,
_SDHOST_STATUS_ACMD41_FAILED: if the ACMD41 command failed,
_SDHOST_STATUS_CANNOT_ENTER_TRANSFER_STATE: if transfer state cannot be entered,
_SDHOST_STATUS_CANNOT_SET_CARD_BUS_WIDTH: if card bus width cannot be set,
_SDHOST_STATUS_RESPONSE_ERROR: if response is not in valid format,
_SDHOST_STATUS_WRITE_ERROR: if writing error occured,
_SDHOST_STATUS_READ_ERROR: if reading error occured.
|
Requires |
Nothing.
|
Example |
res := SDHost_Abort();
|
Notes |
None.
|
SDHost_CardInit
Prototype |
function SDHost_CardInit() : byte;
|
Description |
Function initializes and identifies the SD card that is detected.
|
Parameters |
None.
|
Returns |
_SDHOST_STATUS_OK: if no errors occured,
_SDHOST_STATUS_ERROR: if an error occured,
_SDHOST_STATUS_CARD_INSERTED: if an SD card is detected,
_SDHOST_STATUS_CARD_REMOVED: if an SD card is removed,
_SDHOST_STATUS_INVALID_RESPONSE_TYPE: if invalid reponse type occured,
_SDHOST_STATUS_CMD_TIMEOUT: if a command timeout has occured,
_SDHOST_STATUS_UNUSABLE_CARD: if an SD card is unusable,
_SDHOST_STATUS_CMD2_FAILED: if the CMD2 command failed,
_SDHOST_STATUS_CMD3_FAILED: if the CMD3 command failed,
_SDHOST_STATUS_CMD8_FAILED: if the CMD8 command failed,
_SDHOST_STATUS_CMD9_FAILED: if the CMD9 command failed,
_SDHOST_STATUS_CMD55_FAILED: if the CMD55 command failed,
_SDHOST_STATUS_ACMD41_FAILED: if the ACMD41 command failed,
_SDHOST_STATUS_CANNOT_ENTER_TRANSFER_STATE: if transfer state cannot be entered,
_SDHOST_STATUS_CANNOT_SET_CARD_BUS_WIDTH: if card bus width cannot be set,
_SDHOST_STATUS_RESPONSE_ERROR: if response is not in valid format,
_SDHOST_STATUS_WRITE_ERROR: if writing error occured,
_SDHOST_STATUS_READ_ERROR: if reading error occured.
|
Requires |
Nothing.
|
Example |
sd_status := SDHost_CardInit();
|
Notes |
None.
|
SDHost_GetCID
Prototype |
procedure SDHost_GetCID(cid : ^byte);
|
Description |
Function returns the information stored in the Card Identification Register (CID).
|
Parameters |
cid: buffer to store data.
|
Returns |
Nothing.
|
Requires |
Nothing.
|
Example |
var dataBuffer : array[16] of byte;
...
SDHost_GetCID(@dataBuffer);
|
Notes |
For better performance, please set the buffers holding the data to alignment 4.
|
SDHost_GetCSD
Prototype |
procedure SDHost_GetCSD(csd : ^byte);
|
Description |
Function returns the information stored in the Card Specific Data Register (CSD).
|
Parameters |
csd: buffer to store data.
|
Returns |
Nothing.
|
Requires |
Nothing.
|
Example |
var dataBuffer : array[16] of byte;
...
SDHost_GetCSD(@dataBuffer);
|
Notes |
For better performance, please set the buffers holding the data to alignment 4.
|
SDHost_ReadSector
Prototype |
function SDHost_ReadSector(dataBuf : ^byte; addr : dword) : byte;
|
Description |
Function reads data stored in a specific sector.
|
Parameters |
dataBuf: buffer containing data read from the sector.
addr: sector address.
|
Returns |
_SDHOST_STATUS_OK: if no errors occured,
_SDHOST_STATUS_ERROR: if an error occured,
_SDHOST_STATUS_CARD_INSERTED: if an SD card is detected,
_SDHOST_STATUS_CARD_REMOVED: if an SD card is removed,
_SDHOST_STATUS_INVALID_RESPONSE_TYPE: if invalid reponse type occured,
_SDHOST_STATUS_CMD_TIMEOUT: if a command timeout has occured,
_SDHOST_STATUS_UNUSABLE_CARD: if an SD card is unusable,
_SDHOST_STATUS_CMD2_FAILED: if the CMD2 command failed,
_SDHOST_STATUS_CMD3_FAILED: if the CMD3 command failed,
_SDHOST_STATUS_CMD8_FAILED: if the CMD8 command failed,
_SDHOST_STATUS_CMD9_FAILED: if the CMD9 command failed,
_SDHOST_STATUS_CMD55_FAILED: if the CMD55 command failed,
_SDHOST_STATUS_ACMD41_FAILED: if the ACMD41 command failed,
_SDHOST_STATUS_CANNOT_ENTER_TRANSFER_STATE: if transfer state cannot be entered,
_SDHOST_STATUS_CANNOT_SET_CARD_BUS_WIDTH: if card bus width cannot be set,
_SDHOST_STATUS_RESPONSE_ERROR: if response is not in valid format,
_SDHOST_STATUS_WRITE_ERROR: if writing error occured,
_SDHOST_STATUS_READ_ERROR: if reading error occured.
|
Requires |
Nothing.
|
Example |
var error : byte;
...
error := SDHost_ReadSector(@buffer, sector_address);
|
Notes |
For better performance, please set the buffers holding the data to alignment 4.
|
SDHost_WriteSector
Prototype |
function SDHost_WriteSector(dataBuf : ^byte; addr : dword) : byte;
|
Description |
Function writes data to a specific sector.
|
Parameters |
dataBuf: buffer containing data to be written.
addr: sector address.
|
Returns |
_SDHOST_STATUS_OK: if no errors occured,
_SDHOST_STATUS_ERROR: if an error occured,
_SDHOST_STATUS_CARD_INSERTED: if an SD card is detected,
_SDHOST_STATUS_CARD_REMOVED: if an SD card is removed,
_SDHOST_STATUS_INVALID_RESPONSE_TYPE: if invalid reponse type occured,
_SDHOST_STATUS_CMD_TIMEOUT: if a command timeout has occured,
_SDHOST_STATUS_UNUSABLE_CARD: if an SD card is unusable,
_SDHOST_STATUS_CMD2_FAILED: if the CMD2 command failed,
_SDHOST_STATUS_CMD3_FAILED: if the CMD3 command failed,
_SDHOST_STATUS_CMD8_FAILED: if the CMD8 command failed,
_SDHOST_STATUS_CMD9_FAILED: if the CMD9 command failed,
_SDHOST_STATUS_CMD55_FAILED: if the CMD55 command failed,
_SDHOST_STATUS_ACMD41_FAILED: if the ACMD41 command failed,
_SDHOST_STATUS_CANNOT_ENTER_TRANSFER_STATE: if transfer state cannot be entered,
_SDHOST_STATUS_CANNOT_SET_CARD_BUS_WIDTH: if card bus width cannot be set,
_SDHOST_STATUS_RESPONSE_ERROR: if response is not in valid format,
_SDHOST_STATUS_WRITE_ERROR: if writing error occured,
_SDHOST_STATUS_READ_ERROR: if reading error occured.
|
Requires |
Nothing.
|
Example |
var error : byte;
...
error := SDHost_WriteSector(@buffer, sector_address);
|
Notes |
For better performance, please set the buffers holding the data to alignment 4.
|
SDHost_MultiReadStart
Prototype |
function SDHost_MultiReadStart(addr : dword) : byte;
|
Description |
Function starts multi read mode, sectors are sequentially read starting from the sector given in the function argument.
|
Parameters |
|
Returns |
_SDHOST_STATUS_OK: if no errors occured,
_SDHOST_STATUS_ERROR: if an error occured,
_SDHOST_STATUS_CARD_INSERTED: if an SD card is detected,
_SDHOST_STATUS_CARD_REMOVED: if an SD card is removed,
_SDHOST_STATUS_INVALID_RESPONSE_TYPE: if invalid reponse type occured,
_SDHOST_STATUS_CMD_TIMEOUT: if a command timeout has occured,
_SDHOST_STATUS_UNUSABLE_CARD: if an SD card is unusable,
_SDHOST_STATUS_CMD2_FAILED: if the CMD2 command failed,
_SDHOST_STATUS_CMD3_FAILED: if the CMD3 command failed,
_SDHOST_STATUS_CMD8_FAILED: if the CMD8 command failed,
_SDHOST_STATUS_CMD9_FAILED: if the CMD9 command failed,
_SDHOST_STATUS_CMD55_FAILED: if the CMD55 command failed,
_SDHOST_STATUS_ACMD41_FAILED: if the ACMD41 command failed,
_SDHOST_STATUS_CANNOT_ENTER_TRANSFER_STATE: if transfer state cannot be entered,
_SDHOST_STATUS_CANNOT_SET_CARD_BUS_WIDTH: if card bus width cannot be set,
_SDHOST_STATUS_RESPONSE_ERROR: if response is not in valid format,
_SDHOST_STATUS_WRITE_ERROR: if writing error occured,
_SDHOST_STATUS_READ_ERROR: if reading error occured.
|
Requires |
Nothing.
|
Example |
var error : byte;
var sector_address : dword;
...
error := SDHost_MultiReadStart(sector_address);
|
Notes |
None.
|
SDHost_MultiReadSector
Prototype |
function SDHost_MultiReadSector(dataBuf : ^byte) : byte;
|
Description |
The procedure reads sectors in multi read mode and places them in the buffer given as the function argument. Next function call reads the subsequent sector. Buffer size should be 512B.
|
Parameters |
dataBuf: buffer for holding the sector data.
|
Returns |
_SDHOST_STATUS_OK: if no errors occured,
_SDHOST_STATUS_ERROR: if an error occured,
_SDHOST_STATUS_CARD_INSERTED: if an SD card is detected,
_SDHOST_STATUS_CARD_REMOVED: if an SD card is removed,
_SDHOST_STATUS_INVALID_RESPONSE_TYPE: if invalid reponse type occured,
_SDHOST_STATUS_CMD_TIMEOUT: if a command timeout has occured,
_SDHOST_STATUS_UNUSABLE_CARD: if an SD card is unusable,
_SDHOST_STATUS_CMD2_FAILED: if the CMD2 command failed,
_SDHOST_STATUS_CMD3_FAILED: if the CMD3 command failed,
_SDHOST_STATUS_CMD8_FAILED: if the CMD8 command failed,
_SDHOST_STATUS_CMD9_FAILED: if the CMD9 command failed,
_SDHOST_STATUS_CMD55_FAILED: if the CMD55 command failed,
_SDHOST_STATUS_ACMD41_FAILED: if the ACMD41 command failed,
_SDHOST_STATUS_CANNOT_ENTER_TRANSFER_STATE: if transfer state cannot be entered,
_SDHOST_STATUS_CANNOT_SET_CARD_BUS_WIDTH: if card bus width cannot be set,
_SDHOST_STATUS_RESPONSE_ERROR: if response is not in valid format,
_SDHOST_STATUS_WRITE_ERROR: if writing error occured,
_SDHOST_STATUS_READ_ERROR: if reading error occured.
|
Requires |
Nothing.
|
Example |
var error : byte;
...
error := SDHost_MultiReadSector(@buffer);
|
Notes |
For better performance, please set the buffers holding the data to alignment 4.
|
SDHost_MultiReadStop
Prototype |
function SDHost_MultiReadStop() : byte;
|
Description |
Function stops multi read mode sequence.
|
Parameters |
None.
|
Returns |
_SDHOST_STATUS_OK: if no errors occured,
_SDHOST_STATUS_ERROR: if an error occured,
_SDHOST_STATUS_CARD_INSERTED: if an SD card is detected,
_SDHOST_STATUS_CARD_REMOVED: if an SD card is removed,
_SDHOST_STATUS_INVALID_RESPONSE_TYPE: if invalid reponse type occured,
_SDHOST_STATUS_CMD_TIMEOUT: if a command timeout has occured,
_SDHOST_STATUS_UNUSABLE_CARD: if an SD card is unusable,
_SDHOST_STATUS_CMD2_FAILED: if the CMD2 command failed,
_SDHOST_STATUS_CMD3_FAILED: if the CMD3 command failed,
_SDHOST_STATUS_CMD8_FAILED: if the CMD8 command failed,
_SDHOST_STATUS_CMD9_FAILED: if the CMD9 command failed,
_SDHOST_STATUS_CMD55_FAILED: if the CMD55 command failed,
_SDHOST_STATUS_ACMD41_FAILED: if the ACMD41 command failed,
_SDHOST_STATUS_CANNOT_ENTER_TRANSFER_STATE: if transfer state cannot be entered,
_SDHOST_STATUS_CANNOT_SET_CARD_BUS_WIDTH: if card bus width cannot be set,
_SDHOST_STATUS_RESPONSE_ERROR: if response is not in valid format,
_SDHOST_STATUS_WRITE_ERROR: if writing error occured,
_SDHOST_STATUS_READ_ERROR: if reading error occured.
|
Requires |
Nothing.
|
Example |
var error : byte;
error := SDHost_MultiReadStop();
|
Notes |
None.
|
SDHost_MultiWriteStart
Prototype |
function SDHost_MultiWriteStart(addr : dword) : byte;
|
Description |
Function starts multi write mode, sectors are sequentially written starting from the sector given in the function argument.
|
Parameters |
|
Returns |
_SDHOST_STATUS_OK: if no errors occured,
_SDHOST_STATUS_ERROR: if an error occured,
_SDHOST_STATUS_CARD_INSERTED: if an SD card is detected,
_SDHOST_STATUS_CARD_REMOVED: if an SD card is removed,
_SDHOST_STATUS_INVALID_RESPONSE_TYPE: if invalid reponse type occured,
_SDHOST_STATUS_CMD_TIMEOUT: if a command timeout has occured,
_SDHOST_STATUS_UNUSABLE_CARD: if an SD card is unusable,
_SDHOST_STATUS_CMD2_FAILED: if the CMD2 command failed,
_SDHOST_STATUS_CMD3_FAILED: if the CMD3 command failed,
_SDHOST_STATUS_CMD8_FAILED: if the CMD8 command failed,
_SDHOST_STATUS_CMD9_FAILED: if the CMD9 command failed,
_SDHOST_STATUS_CMD55_FAILED: if the CMD55 command failed,
_SDHOST_STATUS_ACMD41_FAILED: if the ACMD41 command failed,
_SDHOST_STATUS_CANNOT_ENTER_TRANSFER_STATE: if transfer state cannot be entered,
_SDHOST_STATUS_CANNOT_SET_CARD_BUS_WIDTH: if card bus width cannot be set,
_SDHOST_STATUS_RESPONSE_ERROR: if response is not in valid format,
_SDHOST_STATUS_WRITE_ERROR: if writing error occured,
_SDHOST_STATUS_READ_ERROR: if reading error occured.
|
Requires |
Nothing.
|
Example |
var error : dword;
error := SDHost_MultiWriteStart(sector_address);
|
Notes |
None.
|
SDHost_MultiWriteSector
Prototype |
function SDHost_MultiWriteSector(dataBuf : ^byte) : byte;
|
Description |
The procedure writes sectors in multi write mode. Next function call reads the subsequent sector. Buffer size should be 512B.
|
Parameters |
dataBuf: buffer holding data to be written.
|
Returns |
_SDHOST_STATUS_OK: if no errors occured,
_SDHOST_STATUS_ERROR: if an error occured,
_SDHOST_STATUS_CARD_INSERTED: if an SD card is detected,
_SDHOST_STATUS_CARD_REMOVED: if an SD card is removed,
_SDHOST_STATUS_INVALID_RESPONSE_TYPE: if invalid reponse type occured,
_SDHOST_STATUS_CMD_TIMEOUT: if a command timeout has occured,
_SDHOST_STATUS_UNUSABLE_CARD: if an SD card is unusable,
_SDHOST_STATUS_CMD2_FAILED: if the CMD2 command failed,
_SDHOST_STATUS_CMD3_FAILED: if the CMD3 command failed,
_SDHOST_STATUS_CMD8_FAILED: if the CMD8 command failed,
_SDHOST_STATUS_CMD9_FAILED: if the CMD9 command failed,
_SDHOST_STATUS_CMD55_FAILED: if the CMD55 command failed,
_SDHOST_STATUS_ACMD41_FAILED: if the ACMD41 command failed,
_SDHOST_STATUS_CANNOT_ENTER_TRANSFER_STATE: if transfer state cannot be entered,
_SDHOST_STATUS_CANNOT_SET_CARD_BUS_WIDTH: if card bus width cannot be set,
_SDHOST_STATUS_RESPONSE_ERROR: if response is not in valid format,
_SDHOST_STATUS_WRITE_ERROR: if writing error occured,
_SDHOST_STATUS_READ_ERROR: if reading error occured.
|
Requires |
Nothing.
|
Example |
var error : byte;
error := SDHost_MultiWriteStart(@data_buffer);
|
Notes |
For better performance, please set the buffers holding the data to alignment 4.
|
SDHost_MultiWriteStop
Prototype |
function SDHost_MultiWriteStop() : byte;
|
Description |
Function stops multi write mode sequence.
|
Parameters |
None.
|
Returns |
_SDHOST_STATUS_OK: if no errors occured,
_SDHOST_STATUS_ERROR: if an error occured,
_SDHOST_STATUS_CARD_INSERTED: if an SD card is detected,
_SDHOST_STATUS_CARD_REMOVED: if an SD card is removed,
_SDHOST_STATUS_INVALID_RESPONSE_TYPE: if invalid reponse type occured,
_SDHOST_STATUS_CMD_TIMEOUT: if a command timeout has occured,
_SDHOST_STATUS_UNUSABLE_CARD: if an SD card is unusable,
_SDHOST_STATUS_CMD2_FAILED: if the CMD2 command failed,
_SDHOST_STATUS_CMD3_FAILED: if the CMD3 command failed,
_SDHOST_STATUS_CMD8_FAILED: if the CMD8 command failed,
_SDHOST_STATUS_CMD9_FAILED: if the CMD9 command failed,
_SDHOST_STATUS_CMD55_FAILED: if the CMD55 command failed,
_SDHOST_STATUS_ACMD41_FAILED: if the ACMD41 command failed,
_SDHOST_STATUS_CANNOT_ENTER_TRANSFER_STATE: if transfer state cannot be entered,
_SDHOST_STATUS_CANNOT_SET_CARD_BUS_WIDTH: if card bus width cannot be set,
_SDHOST_STATUS_RESPONSE_ERROR: if response is not in valid format,
_SDHOST_STATUS_WRITE_ERROR: if writing error occured,
_SDHOST_STATUS_READ_ERROR: if reading error occured.
|
Requires |
Nothing.
|
Example |
var error : byte;
error := SDHost_MultiWriteStop();
|
Notes |
None.
|
Copyright (c) 2002-2015 mikroElektronika. All rights reserved.
What do you think about this topic ?
Send us feedback!
Want more examples and libraries?
Find them on