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 :


  Important :

For better performance, please set the buffers holding the data to alignment 4.

Library Routines

SDHost_Init

Prototype

void SDHost_Init(unsigned int clockDiv, char config);

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 | _SDHOST_CFG_CLOCK_RISING_EDGE | _SDHOST_CFG_STREAM_ENABLE);
Notes

None.

SDHost_CardDetect

Prototype

char SDHost_CardDetect();

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

char SDHost_SendCMD(unsigned char cmdIdx, char cmdType, unsigned char sdioSpecialOp, unsigned long cmdArg, unsigned long *response);

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

char SDHost_TransferData(unsigned char direction, char * dataBuf, unsigned int numBytes, unsigned long addr);

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

char SDHost_Abort();

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

char SDHost_CardInit();

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

void SDHost_GetCID(char *cid);

Description

Function returns the information stored in the Card Identification Register (CID).

Parameters
  • cid: buffer to store data.
Returns

Nothing.

Requires

Nothing.

Example
char dataBuffer[16];
...
SDHost_GetCID(dataBuffer);
Notes

For better performance, please set the buffers holding the data to alignment 4.

SDHost_GetCSD

Prototype

void SDHost_GetCSD(char *csd);

Description

Function returns the information stored in the Card Specific Data Register (CSD).

Parameters
  • csd: buffer to store data.
Returns

Nothing.

Requires

Nothing.

Example
char dataBuffer[16];
...
SDHost_GetCSD(dataBuffer);
Notes

For better performance, please set the buffers holding the data to alignment 4.

SDHost_ReadSector

Prototype

char SDHost_ReadSector(char *dataBuf, unsigned long addr);

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
unsigned char error;
...
error = SDHost_ReadSector(buffer, sector_address);
Notes

For better performance, please set the buffers holding the data to alignment 4.

SDHost_WriteSector

Prototype

char SDHost_WriteSector(char *dataBuf, unsigned long addr);

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
unsigned char error;
...
error = SDHost_WriteSector(buffer, sector_address);
Notes

For better performance, please set the buffers holding the data to alignment 4.

SDHost_MultiReadStart

Prototype

char SDHost_MultiReadStart(unsigned long addr);

Description

Function starts multi read mode, sectors are sequentially read starting from the sector given in the function argument.

Parameters
  • 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
unsigned char error;
char sector;
...
error = SDHost_MultiReadStart(sector_address);
Notes

None.

SDHost_MultiReadSector

Prototype

char SDHost_MultiReadSector(char *dataBuf);

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
unsigned char error;
...
error = SDHost_MultiReadSector(buffer);
Notes

For better performance, please set the buffers holding the data to alignment 4.

SDHost_MultiReadStop

Prototype

char SDHost_MultiReadStop();

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
unsigned char error;

error = SDHost_MultiReadStop();
Notes

None.

SDHost_MultiWriteStart

Prototype

char SDHost_MultiWriteStart(unsigned long addr);

Description

Function starts multi write mode, sectors are sequentially written starting from the sector given in the function argument.

Parameters
  • 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
unsigned char error;
error = SDHost_MultiWriteStart(sector_address);
Notes

None.

SDHost_MultiWriteSector

Prototype

char SDHost_MultiWriteSector(char *dataBuf);

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
unsigned char error;
error = SDHost_MultiWriteStart(data_buffer);
Notes

For better performance, please set the buffers holding the data to alignment 4.

SDHost_MultiWriteStop

Prototype

char SDHost_MultiWriteStop();

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
unsigned char error;
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 LibStock - A place for the code