File System Component  Version 6.5
MDK-Professional Middleware for Devices with Flash File System
 All Data Structures Files Functions Variables Enumerations Enumerator Macros Groups Pages
Memory Card Control Layer

The Memory Card (MC) Control Layer is used when connecting to external memory cards or eMMC devices. It supports data transfer via MCI or SPI, but the data rates are much better using MCI.

List of Supported Devices

In general, the following devices are supported by the File System Component:

Memory Card Specification
Standard Capacity SD Memory Card (SDSC) Up to and including 2 GB
High Capacity SD Memory Card (SDHC) More than 2GB and up to and including 32GB
Extended Capacity SD Memory Card (SDXC)More than 32GB and up to and including 2TB
MultiMediaCard (MMC) Up to specification version 4.2
Embedded MultiMediaCard (eMMC) Up to specification 4.41

List of Supported MCI Driver Capabilities

MC Control Layer uses MCI driver when memory device is connected via MCI. Depending on MCI driver capabilities, File System Component can take advantage of certain features. The following table briefly describes how enabled capabilities affect the functionality of the MC Control Layer:

Capability Functionality
cd_state Enables device presence detection by pooling the Card Detect (CD) switch state
cd_event Enables device presence detection using MCI driver events
wp_state Enables write protection detection by pooling Write Protect (WP) switch state
vdd Power consumption can be controlled by turning VDD (VCC) power supply on or off
vccq Power consumption can be controlled by turning VCCQ power supply on or off
data_width_4Data transfer rate can be increased by using 4-bit data bus
data_width_8Data transfer rate can be increased by using 8-bit data bus
high_speed Data transfer rate can be increased by using MCI bus frequencies up to 52MHz
rst_n eMMC device can be reset from software using RST_n pin

Device Specific Features

Power Supply Voltage Control

With appropriately designed hardware and support from the corresponding MCI driver, MC Control Layer can control memory device power supply voltage:

  • VDD (VCC) and VCCQ power supply is turned on when device is mounted
  • VDD (VCC) and VCCQ power supply is turned off when device is unmounted,
  • VCC power supply is turned on/off when eMMC device is switched to/from Sleep state

Data Bus Width

Depending on the memory device type, appropriate data bus width will be selected:

  • 1-bit data bus width is selected by default, since it must be supported by all devices and MCI drivers.
  • 4-bit or 8-bit data bus width selection depends on both, device and MCI driver capabilities. In order to switch either to 4 or 8-bit data bus, both, device and MCI driver must support it.

High Speed Mode

The MC Control Layer is able to automatically switch to high speed mode for SD cards supporting SD specification version 1.10 or higher (3.3V signaling, bus clock frequency up to 50MHz) and MMC/eMMC devices supporting MMCA specification version 4.2 or higher (3.3V signaling, bus clock frequency up to 52MHz). In order to do so, the high speed mode needs to be supported by the corresponding MCI driver.

Note
Improper PCB design can cause reliability problems when in high speed mode.

Power Saving Features

File System Component tends to reduce overall power consumption as much as possible, therefore the MC Control Layer will automatically:

  • switch the memory device between Transfer state and Standby state. This way the memory device spends most of the time in Standby state without noticeable effect on the data transfer performance.
  • stop bus clock when there is no communication on the bus

eMMC devices (MMCA specification version 4.3 and higher) support CMD5 (Sleep state). To switch between Sleep state and Standby state, use the function fs_ioc_device_ctrl. While in the Sleep state, VCC power supply may be switched off to further minimize the power consumption.

SPI Mode Support

SD memory cards (up to SD specification version 4.10) and MMC devices (up to MMCA specification version 4.2) also support Serial Peripheral Interface (SPI) bus mode as alternative way of communication. When SPI mode is used, MC Control Layer will use CMSIS-Driver SPI to use the underlying hardware.

The advantage of using the memory card in SPI mode is in simplified hardware requirements, but at the cost of performance loss and limited command set. Since SPI consists of only SCLK, MOSI, MISO and nSS communication lines, File System Component provides following callback routines for interfacing Card Detect (CD) and Write Protect (WP) switches:

Callback functions fs_mc_read_cd and fs_mc_read_wp are optional. If they are not implemented by user application, File System Component will assume that memory device in SPI mode is always present and without write protection.

Since software controlled Slave Select line is not always available an alternative way is provided in such case:

User application should only implement callback function fs_mc_spi_control_ss when SPI driver does not provide software controlled Slave Select line.