embedded Multi-Media Controller
La memoria eMMC e' una tipologia di memoria MMC. Questa tipologia di memoria, a differenza della memoria flash, contiene al suo interno (solitamente in un package BGA) sia la memoria flash che il controller che la gestisce; questi due elementi formano la memoria eMMC. Di solito i package utilizzati per le memorie eMMC exists sono: BGA100, BGA153, BGA169. A differenza delle altre memorie MMC, la eMMC non e' una memoria removibile, ma viene saldata direttamente sulla scheda del dispositivo e pertanto non e' raggiungibile dall'utente (perfetta per ospitare un firmware). E' ottimizzata per bassi consumi di corrente e piccole dimensioni. Viene utilizzata in molti dispositivi come smartphone, console, tablet, computer. A differenza delle memorie EEPROM, questa puo' contenere una grande quantita' di dati, arrivando senza problemi al Gigabyte. Per interfacciarsi con la memoria eMMC serve l'host (che puo' essere un programmatore, o un interfaccia dedicata).
Questa memoria utilizza possiede svariati pin per le operazioni comuni di lettura e scrittura (oltre ovviamente, ai pin di alimentazione):
Ci sono due modalita' di funzionamento per il BUS, come precedentemente accennato:
In base all'operazione da svolgere, va selezionata una delle due modalita'. Per esempio, se vogliamo far entrare la memoria in modalita' trasferimento dati, e' necessaria la modalita' push-pull. |
Quindi, come detto prima, tramite il pin CMD, l'host puo' inviare dei comandi per eseguire delle operazioni che la memoria eMMC andra' a ricevere. Mentre, viceversa, la memoria eMMC puo' inviare le risposte che ricevera' l'host. Ecco i comandi principali:
I comandi disponibili per la memoria eMMC si dividono in svariate classi:
Qui sotto ho creato una tabella con i comandi piu' utilizzati. |
Command |
Abbreviazione |
Tipologia |
Argomento |
Risposta |
Descrizione |
CMD0 |
|
|
|
|
|
CMD1 |
SEND_OP_COND |
BCR |
[31:0] OCR without busy |
R3 |
Asks Device, in idle state, to send its Operating Conditions Register contents in the response on the CMD line. |
CMD2 |
ALL_SEND_CID |
BCR |
[31:0] stuff bits |
R2 |
Asks Device to send its CID number on the CMD line |
CMD3 |
SET_RELATIVE_ADDR |
AC |
[31:16] RCA, [15:0] stuff bits |
R1 |
Assigns relative address to the Device |
CMD4 |
SET_DSR |
BC |
[31:16] DSR, [15:0] stuff bits |
No |
Programs the DSR of the Device |
CMD5 |
SLEEP_AWAKE |
AC |
[31:16] RCA, [15]Sleep/Awake, [14:0] stuff bits |
R1B |
Toggles the Device between Sleep state and Standby state. |
CMD6 |
SWITCH |
AC |
[31:26] Set to 0, [25:24] Access, [23:16] Index, [15:8] Value, [7:3] Set to 0, [2:0] Cmd Set |
R1B |
Switches the mode of operation of the selected Device or modifies the EXT_CSD registers. |
CMD7 |
SELECT/DESELECT_CARD |
AC |
[31:16] RCA, [15:0] stuff bits |
R1/R1B |
Command toggles a device between the standby and transfer states or between the programming and disconnect states. |
CMD8 |
SEND_EXT_CSD |
ADTC |
[31:0] stuff bits |
R1 |
Device sends its EXT_CSD register as a block of data. |
CMD9 |
SEND_CSD |
AC |
[31:16] RCA, [15:0] stuff bits |
R2 |
Addressed Device sends its Device-pecific data (CSD) on the CMD line. |
CMD10 |
SEND_CID |
AC |
[31:16] RCA, [15:0] stuff bits |
R2 |
Addressed Device sends its Device identification (CID) on CMD the line. |
CMD11 |
READ_DAT_UNTIL_STOP |
ADTC |
[31:0] data address |
R1 |
Reads data stream from the card, starting at the given address, until a STOP_TRANSMISSION follows. |
CMD12 |
STOP_TRANSMISSION |
AC |
[31:16] RCA, [15:1] stuff bits, [0] HPI |
R1/R1B |
Forces the Device to stop transmission. If HPI flag is set the device shall interrupt its internal operations in a well-defined timing. |
CMD13 |
SEND_STATUS |
AC |
[31:16] RCA, [15] SQS, [14:1] stuff bits, [0] HPI |
R1 |
In case SQS bit = 0: Addressed Device sends its status register. If HPI flag is set the device shall interrupt its internal operations in a well-defined timing. In case SQS bit = 1: indicate that this is a QSR query. In response device shall send the QSR (Queue Status Register). In this case HPI must be set to ‘0’ |
CMD14 |
BUSTEST_R |
ADTC |
[31:0] stuff bits |
R1 |
A host reads the reversed bus testing data pattern from a Device. |
CMD15 |
GO_INACTIVE_STATE |
AC |
[31:16] RCA, [15:0] stuff bits |
No |
Sets the Device to inactive state |
CMD16 |
SET_BLOCKLEN |
AC |
[31:0] block length |
R1 |
Sets the block length (in bytes) for all following block commands (read and write). Default block length is specified in the CSD |
CMD17 |
READ_SINGLE_BLOCK |
ADTC |
[31:0] data address |
R1 |
Reads a block of the size selected by the SET_BLOCKLEN command |
CMD18 |
READ_MULTIPLE_BLOCK |
ADTC |
[31:0] data address |
R1 |
Continuously transfers data blocks from Device to host until interrupted by a stop command, or the requested number of data blocks is transmitted If sent as part of a packed read command, the argument shall contain the first read data address in the pack (address of first individual read command inside the pack). |
CMD19 |
BUSTEST_W |
ADTC |
[31:0] stuff bits |
R1 |
A host sends the bus test data pattern to a Device |
CMD20 |
WRITE_DAT_UNTIL_STOP |
ADTC |
[31:0] data address |
R1 |
Writes data stream from the host, starting at the given address, until a STOP_TRANSMISSION follows. |
CMD21 |
SEND_TUNING_BLOCK |
ADTC |
[31:0] stuff bits |
R1 |
128 clocks of tuning pattern (64 byte in 4bit mode or 128 byte in 8 bit mode) is sent for HS200 optimal sampling point detection. |
CMD22 |
|||||
CMD23 |
SET_BLOCK_COUNT |
AC |
[31] Reliable Write Request, [30] ‘0’ non- packed, [29] tag request,[28:25] context ID, [24]: forced programming, [23:16] set to 0, [15:0] number of blocks |
R1 |
Defines the number of blocks (read/write) and the reliable writer parameter (write) for a block read or write command. |
CMD24 |
WRITE_BLOCK |
ADTC |
[31:0] data address |
R1 |
Writes a block of the size selected by the SET+BLOCKLEN command. |
CMD25 |
WRITE_MULTIPLE_BLOCK |
ADTC |
[31:0] data address |
R1 |
Continuously writes blocks of data until a STOP_TRANSMISSION follows or the requested number of block received. If sent as a packed command (either packed write, or the header of packed read) the argument shall contain |
CMD26 |
PROGRAM_CID |
ADTC |
[31:0] stuff bits |
R1 |
Programming of the Device identification register. This command shall be issued only once. The Device contains hardware to prevent this operation after the first programming. Normally this command is reserved for the manufacturer. |
CMD27 |
PROGRAM_CSD |
ADTC |
[31:0] stuff bits |
R1 |
Programming of the programmable bits of the CSD. |
CMD28 |
SET_WRITE_PROT |
AC |
[31:0] data address |
R1B |
If the card has write protection features, this command sets the write protection bit of the addressed group. The properties of write protection are coded in the card specific data (WP_GRP_SIZE or HC_WP_GRP_SIZE). |
CMD29 |
CLR_WRITE_PROT |
AC |
[31:0] data address |
R1B |
If the card provides write protection features, this command clears the write protection bit of the addressed group. |
CMD30 |
SEND_WRITE_PROT |
ADTC |
[31:0] write protect data address |
R1 |
If the card provides write protection features, this command asks the card to send the status of the write protection bits. |
CMD31 |
SEND_WRITE_PROT_TYPE |
ADTC |
[31:0] write protect data address |
R1 |
This command sends the type of write protection that is set for the different write protection groups. |
Lettura/Scrittura eMMC
Adattatore eMMC -> SD
Per leggere una memoria eMMC possiamo utilizzare un comune adattatore USB per schede SD o microSD. Sull'adattatore infatti ci sara' l'host che andra' ad interfacciarsi con il controller della memoria eMMC. I pin utilizzati sono 5: i soliti 2 pin di alimentazione (GND e VCC; prima di collegare VCC bisogna controllare sul datasheet la tensione di alimentazione della memoria e, all'occorrenza, utilizzare uno stabilizzatore di tensione se la tensione non va bene) poi CMD, CLK e D0. Per leggere la memoria eMMC, basta saldare tutti e 5 i cavi sull'adattatore USB-SD e poi saldarli sul package BGA della memoria eMMC (dissaldata dalla scheda) aiutandosi con il pinout preso dal datasheet.
|
Programmatore Dedicato
Se invece abbiamo a disposizione un programmatore professionale, come XGecu T56 oppure l'RT809H, possiamo leggere la memoria eMMC direttamente dalla scheda, senza dissaldarla (ICSP, In Circuit Serial Programming). Per farlo dobbiamo prima individuare i pin di interesse (CMD, CLK, D0, VCC e GND) sulla scheda. Altrimenti possiamo sempre dissaldare la memoria eMMC ed utilizzare un apposito adattatore BGA per il programmatore.
|