SPC58xEx/SPC58xGx multimedia card via SPI interface
Introduction
The multimedia card is a universal data storage and communication media device. It is designed to support a wide range of
applications, in particular more recently on automotive products.
This AN5595 describes about the SPI mode to control the MMC/SD cards. The software application has been developed by
using the SPC58xEx/SPC58xGx microcontroller and its software development is based on top of SPC5-STUDIO tool available
at the following link: https://www.st.com/en/development-tools/spc5-studio.html.
The SPI mode is an alternative operating mode that is defined to use the MMC/SD cards on microcontrollers without a native
host interface. The MMC/SD can be used on a microcontroller via a generic SPI interface or some GPIO ports. Therefore,
the SPI mode is suitable for low cost embedded applications. This mode can be accepted on platforms where no specific
performances are required and where some limitations of the MMC/SD protocol via SPI mode do not impact on system
requirements.
AN5595 - Rev 1 - January 2021
For further information contact your local STMicroelectronics sales office.
www.st.com
1MMC basic concepts
The multimedia card transfers data via a configurable number of data bus signals:
•CLK: the frequency may vary according to the card speed
•CMD: is a bidirectional command channel used for card initialization and transfer of commands
•DAT0-DAT7: these are bidirectional data channels; the multimedia card includes internal pull-ups for all data
lines
Useful terms and definitions while talking about the multimedia card:
•Block: number of bytes, basic data transfer unit
•CID: card identification number register
•CLK: clock signal
•CMD: command line or multimedia card bus command (if extended CMDXX)
•CSD: card specific data register
•OCR: operation conditions register
•CD: card detection
•W/P: write protection
AN5595
MMC basic concepts
AN5595 - Rev 1
page 2/25
2Card registers
Within the card interface six register classes are defined:
•The operation conditions register (OCR) stores the VDD voltage profile
•The card-specific data (CSD) register provides information on how to access the card contents. The CSD
defines the data format, error correction type, maximum data access time, data transfer speed, whether the
DSR register can be used
•The extended CSD register defines the card properties and selected modes
•The relative card address (RCA) register carries the card address assigned by the host during the card
identification
•The driver stage register (DSR) optionally used to improve the bus performance for extended operating
conditions
AN5595
Card registers
AN5595 - Rev 1
page 3/25
3MMC/SD SPI mode introduction
The SPI mode has been removed from new specifications, but it can be found in previous JEDEC standard
No. JESD84-B41.
The communication protocol of the SPI mode is rather simple compared to its native operating mode.
The MMC/SDC can be attached to the microcontroller via a generic SPI interface as shown below:
Figure 1. SPI bus connection
AN5595
MMC/SD SPI mode introduction
While the multimedia card is based on command and data bit streams which are initiated by a start bit and
terminated by a stop bit, the SPI channel is byte oriented. Each command or data block consists of 8-bit bytes
and his octet aligned on the CS signal. Like the multimedia card protocol, the SPI messages consist of command,
response, and data-block tokens.
The response behavior in the SPI mode differs from the multimedia card mode in the following three aspects:
•The selected card always responds to the command
•Additional (8-, 16- and 40-bit) response structures are used
•When the card encounters a data retrieval problem, it will respond with an error response rather than a
time-out
AN5595 - Rev 1
page 4/25
4DSPI overview
The SPC58x microcontroller embeds the deserial serial peripheral interface (DSPI) module. This provides a
synchronous serial bus for communication between an MCU and an external peripheral device.
The DSPI supports the MCU pin count reduction through serialization and deserialization of the MCU internal
signals transmitted over the SPI serial link. The DSPI supports different modes including the SPI. All the
necessary information about the DSPI can be found inside the microcontroller’s reference manual.
AN5595
DSPI overview
AN5595 - Rev 1
page 5/25
5SPI signals
The SPI mode is compliant with the serial peripheral interface (SPI) specification: its bus architecture includes the
following signals:
•CS: host to card chip select signal
•CLK: host to card clock signal
•MOSI: (master out slave in) host to card single bit data signal
•MISO: (master in slave out) card to host single bit data signal
The SPI mode is implemented to access the MMC/SD media card so:
•Every transaction by asserting the CS signal low
•Commands and tx data are sent to the media card on the MOSI line
•Command response and RX data are received from the media card on the MISO line
•The CLK signal is used to synchronize the data transfer on the bus
AN5595
SPI signals
Figure 2. Card signals
AN5595 - Rev 1
page 6/25
Figure 3. Signal comparisons (MMC versus SPI) from standard
AN5595
SPI signals
AN5595 - Rev 1
page 7/25
6MMC/SD SPI protocol
6.1Initialization procedure
After power on reset, MMC/SDC enters are native operating modes.
The card will enter SPI mode if the CS signal is low during the reception of the reset command (CMD0) and it will
respond with SPI mode R1 response.
The only way to return to the multimedia card mode is by a power cycle (turn the power off and on).
Since CMD0 has no arguments, the content of all the fields plus the CRC (not calculated by the card) field are
constant.
Reset command:0x40, 0x0, 0x0, 0x0, 0x0, 0x95
In idle state, the card accepts only CMD0, CMD1, ACMD41, CMD58 and CMD59.
Note that all cards work at supply voltage range of 2.7 to 3.6 V at least, so that the host controller doesn't need to
check the OCR if the supply voltage is in this range.
In SPI mode the CMD1 has no operands and does not return the contents of the OCR register. Instead, the host
may use CMD58 (only in SPI mode) to read the OCR.
Figure 4. Example of initialization flow chart
AN5595
MMC/SD SPI protocol
AN5595 - Rev 1
page 8/25
Loading...
+ 17 hidden pages
You need points to download manuals.
1 point = 1 manual.
You can buy points or you can get point for every manual you upload.