tyron's page 不断探索是一件好事,学无止境!

eMMC、SD应用笔记

2020-06-28
David
 


参考:

  1. JEDEC Standard, Embedded Multi-Media Card(eMMC) Electrical Standard (5.01), JESD84-B50.1
  2. JEDEC Standard, Embedded MultiMediaCard(e•MMC)e•MMC/Card Product Standard, High Capacity, including Reliable Write, Boot, Sleep Modes, Dual Data Rate, Multiple Partitions Supports, Security Enhancement, Background Operation and High Priority Interrupt (MMCA, 4.41), JESD84-A441

擦写次数

emmc的擦写次数是有限的,一般使用久了速度会变慢。

是因为emmc内部数据处理变慢了。

我们可以从寄存器中获知,状态寄存器data0一直为0,即data0一直为拉低的状态,data0一直是busy的状态,就会出现传输数据(一般是写超时)超时,这个是因为emmc老化导致内部处理的数据变慢,一直在处理数据,不让主机在往里面写。

eMMC真正的存储media还是NAND Flash, 而NAND又分为SLC、MLC和TLC。

目前市场上主流的eMMC还是以MLC的NAND为主,而TLC的eMMC也在逐漸的增加。

目前市场上的MLC,擦除次数大概在3000~5000cycle。

而SLC的擦除次数则在25000~40000cycle。

所以,SLC要比MLC效率高,更稳定。

Signals

emmc有11根通讯总线:

  • CLK

时钟。一个周期内,传输1bit或2bit。

单向。

主机向设备发送的信号,clock操作在推挽模式下

  • DS(Data Strobe)

设备给主机的信号,数据选通操作在推挽模式。

仅仅存在于HS400 mode。2 bit传输(上升沿+下降沿)。

  • CMD

双向。

主机和设备驱动有开漏和推挽二种模式。

用于传输command(host->device)和response(host<-device)。

有两种mode: open-drain:initialization mode

push-pull:fastcommand transfer

  • D0~D7(8-bit)/D0~D3(4-bit)/D0(1-bit)

双向。

主机和设备驱动都是在推挽模式下(data0默认为拉高的状态)

注意: 由于涉及到高速信号应用,layout时,CLK/CMD/DX信号,要进行长度匹配(等长),阻抗匹配(50欧姆)。

Protocol

Figure 1——Multiple-block read operation

Figure 2——Multiple-block write operation

Figure 3——No response and No data operation

Bus Speed Modes

Figure 4——Bus Speed Mode

Device Registers

和Device有关的6个寄存器:

  • OCR

定义了VDD电压和访问mode。

  • CID

定义了Device ID。

  • CSD

定义了data format,data transfer speed,Max_read/write_current@ VDDmin/VDDmax等等。

  • EXT_CSD

定义Device属性和可选择的mode。共有512 bytes。

  • 高320 bytes——定义了device的capability,不能被host修改。
  • 低192 bytes——定义了mode,host可以通过SWITCH命令进行修改。 如,byte 179定义了可以boot的partition,byte 177定义了boot时的bus width。

  • RCA

  • DSR

Boot

eMMC、SD卡的分区:

Figure 5——Memory partition

通过Extend CSD register [179] bit[5:3] 可以选择boot的区域有:partition 1/2,user area。

  • 0x0 : Device not boot enabled (default)
  • 0x1 : Boot partition 1 enabled for boot
  • 0x2 : Boot partition 2 enabled for boot
  • 0x3–0x6 : Reserved
  • 0x7 : User area enabled for boot

Power-up

Figure 6——Power-up

细节请参考下文中“High-speed eMMC bus function”的“Bus initialization”。

Figure 7——eMMC voltage combination

High-speed eMMC bus function

参考A.6 High-speed eMMC bus function的操作步骤。 共包括3个主要步骤:

  • Bus initialization
  • Switching to high-speed mode
  • Changing the data bus width

Comments

Content