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 |
sub procedure SDHost_Init(dim clockDiv as word, dim config as 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 or _SDHOST_CFG_STREAM_ENABLE)
|
Notes |
None.
|
SDHost_CardDetect
Prototype |
sub function SDHost_CardDetect() as byte
|
Description |
Sub 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 |
sub function SDHost_SendCMD(dim cmdIdx as byte, dim cmdType as byte, dim sdioSpecialOp as byte, dim cmdArg as longword, dim response as ^longword) as byte
|
Description |
Sub 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 |
sub function SDHost_TransferData(dim direction as byte, dim dataBuf as ^byte, dim numBytes as word, dim addr as longword) as byte
|
Description |
Sub 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 |
sub function SDHost_Abort() as byte
|
Description |
Sub 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 |
sub function SDHost_CardInit() as byte
|
Description |
Sub 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 |
sub procedure SDHost_GetCID(dim cid as ^byte)
|
Description |
Sub 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 |
sub procedure SDHost_GetCSD(dim csd as ^byte)
|
Description |
Sub function returns the information stored in the Card Specific Data Register (CSD).
|
Parameters |
csd: buffer to store data.
|
Returns |
Nothing.
|
Requires |
Nothing.
|
Example |
dim dataBuffer as byte[16]
...
SDHost_GetCSD(@dataBuffer)
|
Notes |
For better performance, please set the buffers holding the data to alignment 4.
|
SDHost_ReadSector
Prototype |
sub function SDHost_ReadSector(dim dataBuf as ^byte, dim addr as longword) as byte
|
Description |
Sub 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 |
dim error as byte
...
error = SDHost_ReadSector(@buffer, sector_address)
|
Notes |
For better performance, please set the buffers holding the data to alignment 4.
|
SDHost_WriteSector
Prototype |
sub function SDHost_WriteSector(dim dataBuf as ^byte, dim addr as longword) as byte
|
Description |
Sub 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 |
dim error as byte
...
error = SDHost_WriteSector(@buffer, sector_address)
|
Notes |
For better performance, please set the buffers holding the data to alignment 4.
|
SDHost_MultiReadStart
Prototype |
sub function SDHost_MultiReadStart(dim addr as longword) as byte
|
Description |
Sub function starts multi read mode, sectors are sequentially read starting from the sector given in the sub 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 |
dim error as byte
dim sector_address as longword
...
error = SDHost_MultiReadStart(sector_address)
|
Notes |
None.
|
SDHost_MultiReadSector
Prototype |
sub function SDHost_MultiReadSector(dim dataBuf as ^byte) as byte
|
Description |
The sub procedure reads sectors in multi read mode and places them in the buffer given as the sub function argument. Next sub 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 |
dim error as byte
...
error = SDHost_MultiReadSector(@buffer)
|
Notes |
For better performance, please set the buffers holding the data to alignment 4.
|
SDHost_MultiReadStop
Prototype |
sub function SDHost_MultiReadStop() as byte
|
Description |
Sub 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 |
dim error as byte
error = SDHost_MultiReadStop()
|
Notes |
None.
|
SDHost_MultiWriteStart
Prototype |
sub function SDHost_MultiWriteStart(dim addr as longword) as 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 |
dim error as longword
error = SDHost_MultiWriteStart(sector_address)
|
Notes |
None.
|
SDHost_MultiWriteSector
Prototype |
sub function SDHost_MultiWriteSector(dim dataBuf as ^byte) as byte
|
Description |
The sub procedure writes sectors in multi write mode. Next sub 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 |
dim error as byte
error = SDHost_MultiWriteStart(@data_buffer)
|
Notes |
For better performance, please set the buffers holding the data to alignment 4.
|
SDHost_MultiWriteStop
Prototype |
sub function SDHost_MultiWriteStop() as byte
|
Description |
Sub 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 |
dim error as 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