39.8.1 Command - Response Operation
After reset, the HSMCI is disabled and becomes valid after setting the MCIEN bit in the HSMCI_CR.
The PWSEN bit saves power by dividing the HSMCI clock by 2PWSDIV + 1 when the bus is inactive.
The two bits, RDPROOF and WRPROOF in the HSMCI Mode Register (HSMCI_MR) allow stopping the HSMCI clock during read or write access if the internal FIFO is full. This will guarantee data integrity, not bandwidth.
All the timings for High Speed MultiMedia Card are defined in the High Speed MultiMedia Card System Specification.
The two bus modes (open drain and push/pull) needed to process all the operations are defined in the HSMCI Command Register (HSMCI_CMDR). The HSMCI_CMDR allows a command to be carried out.
For example, to perform an ALL_SEND_CID command:
Host Command | NID Cycles | Response | High Impedance State | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
CMD | S | T | Content | CRC | E | Z | ****** | Z | S | T | CID Content | Z | Z | Z |
The command ALL_SEND_CID and the fields and values for the HSMCI_CMDR are described in the following two tables.
CMD Index | Type | Argument | Response | Abbreviation | Command Description |
---|---|---|---|---|---|
CMD2 | bcr(1) | [31:0] stuff bits | R2 | ALL_SEND_CID | Asks all cards to send their CID numbers on the CMD line |
Note: 1. bcr means broadcast command with response.
Field | Value |
---|---|
CMDNB (command number) | 2 (CMD2) |
RSPTYP (response type) | 2 (R2: 136 bits response) |
SPCMD (special command) | 0 (not a special command) |
OPCMD (open drain command) | 1 |
MAXLAT (max latency for command to response) | 0 (NID cycles ==> 5 cycles) |
TRCMD (transfer command) | 0 (No transfer) |
TRDIR (transfer direction) | X (available only in transfer command) |
TRTYP (transfer type) | X (available only in transfer command) |
IOSPCMD (SDIO special command) | 0 (not a special command) |
The HSMCI_ARGR contains the argument field of the command.
To send a command, the user must perform the following steps:
- Fill the argument register (HSMCI_ARGR) with the command argument.
- Set the command register (HSMCI_CMDR).
The command is sent immediately after writing the command register.
While the card maintains a busy indication (at the end of a STOP_TRANSMISSION command CMD12, for example), a new command shall not be sent. The NOTBUSY flag in the Status Register (HSMCI_SR) is asserted when the card releases the busy indication.
If the command requires a response, it can be read in the HSMCI Response Register (HSMCI_RSPR). The response size can be from 48 bits up to 136 bits depending on the command. The HSMCI embeds an error detection to prevent any corrupted data during the transfer.
The following flowchart shows how to send a command to the card and read the response if needed. In this example, the status register bits are polled but setting the appropriate bits in the HSMCI Interrupt Enable Register (HSMCI_IER) allows using an interrupt method.