[GD32E503 Review] 06 Review of SDIO bus driver SD card (Part 1)
[Copy link]
SD requires high-speed reading and writing, and also needs to be easy to use for embedded devices such as handheld devices. There are two access interfaces: SD mode interface and SPI interface. At the beginning of the SD card power-on, the card master determines whether to use SD mode or SPI mode by detecting pin 1 (DAT3). When this pin is connected to a 50KOhm pull-up resistor, the card enters SD mode; when this pin is low, the card works in SPI mode.
SD/MMC card internal registers
SD Card Registers
Name Width Description
CID 128 Card identification number: individual card number for identification.
RCA 16 Relative card address
CSD 128 Card specific data: information about the card operation conditions.
SCR 64 SD Configuration Register: information about the SD Card’s special features capabilities.
OCR 32 Operation Condition Register
SD Card Registers
Name Width Description
CID 128 Card identification code: used to identify a single card number.
RCA 16 Card relative address (this register is not available in SPI mode)
CSD 128 Card characteristic data: related information about the working conditions of this card.
SCR 64 SD configuration register: characteristic information about the special functions of this SD card.
OCR 32 Working condition register (voltage)
Card Identification Register(CID)
This CID register is 16 bytes long, as shown in Table 3-9, and contains the card's unique identification code (ID number). This information is programmed
(burned) during the card's production, and the host controller cannot modify its contents. Note: The CID register of the SD card and the CID register of the MMC card are different in record structure.
Name
|
Type
|
Width
|
CID Slice
|
Comments
|
CID Value
|
Manufacturer ID (MID) |
Binary |
8 |
[127:120] |
Manufacturer ID number controlled and assigned by the SD Card Association |
0x03 |
OEM/Application ID (OID) |
ASCII |
16 |
[119:104] |
OEM and/or card content ID number used to identify the card |
‘SD’ |
Product Name(PNM) |
ASCII |
40 |
[103:64] |
SD128, SD064, SD032, SD016, SD008 |
|
Product Revision (PRV) |
BCD |
8 |
[63:56] |
Two binary coded decimal numbers (BCD) |
Product Revision Number |
Serial Number (PSN) |
Binary |
32 |
[55:24] |
32-bit unsigned integer |
Product serial number |
Reserved |
|
4 |
[23:20] |
reserve |
|
Manufacture Date Code(MDT) |
BCD |
12 |
[19:8] |
Production date format: April 2001 = 0x014 |
|
CRC7 checksum(CRC) |
Binary |
7 |
[7:1] |
CRC checksum |
CRC7 |
Reserved,always ‘1’ |
|
1 |
[0:0] |
This part is not used and the value is always "1" |
|
CRC Calculation: G(x) = x7+3+1
M(x) = (MID-MSB)*x119 + ... + (CIN-LSB)*x0
CRC[6...0] = Remainder[(M(x)*x7)/G(x)]
Card Specific Data Register(CSD)
The card description data register (CSD) contains the necessary configuration information when accessing the card data.
The "cell type" column defines whether the CSD area is read-only (R), programmable once (R/W) or erasable (R/W/E) ["R/W" means it can be written multiple times,
"R/W (1)" means it can only be written once and cannot be erased]. The values shown in this table correspond to the respective areas and codes in the actual CSD structure.
The style of the CSD area is based on the column mark (and a check mark √). Note that the CSD registers in the SD card and the CSD registers of the MultiMedia card have different structures.
Name
|
Field
|
Width
|
Cell Type
|
CSD-Slice
|
CSD Value
|
CSD Code
|
CSD structure |
CSD_STRUCTURE |
2 |
R |
[127:126] |
1.0 |
00b |
Reserved |
- |
6 |
R |
[125:120] |
- |
000000b |
data read access time |
TAC |
8 |
R |
[119:112] |
1.5msec |
00100110b |
Same as above in CLK cycles |
NSAC |
8 |
R |
[111:104] |
0 |
00000000b |
max.data transfer rate |
TRAN_SPEEN |
8 |
R |
[103:96] |
25MHz |
00110010b |
card command classes |
CCC |
12 |
R |
[95:84] |
ALL |
1F5h |
max.read data block length |
READ_BL_LEN |
4 |
R |
[83:80] |
512Byte |
1001b |
partial blocks for read allowed |
READ_BL_PARTIAL |
1 |
R |
[79:79] |
YES |
1b |
write block misalignment |
WRITE_BLK_MISALIGN |
1 |
R |
[78:78] |
NO |
0b |
read block misalignment |
READ_BLK_MISALIGN |
1 |
R |
[77:77] |
NO |
0b |
DSR implemented |
DSR_IMP |
1 |
R |
[76:76] |
NO |
0b |
Reserved |
- |
2 |
R |
[75:74] |
- |
00b |
device size |
C_SIZE |
12 |
R |
[73:62] |
as follows |
- |
max.read current @vdd min |
VDD_R_CURR_MIN |
3 |
R |
[61:59] |
100mA |
111b |
max.read current @VDD max |
VDD_R_CURR_MAX |
3 |
R |
[58:56] |
80mA |
110b |
max.wirte current @VDD min |
VDD_W_CURR_min |
3 |
R |
[55:53] |
100mA |
111b |
max.write current @VDD max |
VDD_W_CURR_MAX |
3 |
R |
[52:50] |
80mA |
110b |
device size multiplier |
C_SIZE_MULT |
3 |
R |
[49:47] |
as follows |
- |
erase single block enable |
ERASE_BLK_EN |
1 |
R |
[46:46] |
YES |
1b |
erase sector size |
SECTOR_SIZE |
7 |
R |
[45:39] |
32blocks |
00111111b |
write protect group size |
WP_GRP_SIZE |
7 |
R |
[38:32] |
128sectors |
11111111b |
write protect group enable |
WP_GRP_EN |
1 |
R |
[31:31] |
YES |
1b |
Rserved for MultiMediaCard |
|
2 |
R |
[30:29] |
- |
00b |
write speed factor |
R2W_FACTOR |
3 |
R |
[28:26] |
X16 |
100b |
max.write data block length |
WRITE_BL_LEN |
4 |
R |
[25:22] |
512Byte |
1001b |
Reserved |
- |
5 |
R |
[20:16] |
- |
0000b |
file format group |
FILE_FORMAT_GRP |
1 |
R/W(1) |
[15:15] |
0 |
0b |
copy flag(OTP) |
COPY |
1 |
R/W(1) |
[14:14] |
Not Original |
1b |
permanent write protection |
PERM_WRITE_PROTECT |
1 |
R/W(1) |
[13:13] |
Not Protected |
0b |
temporary write protection |
TMP_WRITE_PROTECT |
1 |
R/W |
[12:12] |
Not Protected |
0b |
File format |
FILE_FORMAT |
2 |
R/W(1) |
[11:10] |
HD w/partition |
00b |
Reserved |
- |
2 |
R/W |
[9:8] |
- |
00b |
CRC |
CRC |
7 |
R/W |
[7:1] |
- |
CRC7 |
not used, always’1’ |
- |
1 |
- |
[0:0] |
- |
1b |
CSD_STRUCTURE : describes the version of the CSD structure. 00: CSD version No. 1.0 Others Reserved
TAAC defines the read operation time of this asynchronous part (relative to the SD card clock (CLK)).
TAAC Bit Position Code Note
2:0 time unit 0=1ns, 1=10ns, 2=100ns, 3=1μs, 4=10μs, 5=100μs, 6=1ms, 7=10ms Time unit
6:3 time value 0=reserved, 1=1.0, 2=1.2, 3=1.3, 4=1.5, 5=2.0, 6=2.5, 7=3.0, 8=3.5, Time value
9=4.0, A=4.5, B=5.0, C=5.5, D=6.0, E=7.0, F=8.0
7 Reserved Reserved
NSAC defines the data access time under the worst case of the clock's related characteristics. Its unit is 100 clock cycles. Therefore, the maximum value of the read access time determined by the related part of the clock is 25.5K
(255*100) clock cycles.
min [ { { ( TAAC*f ) + (NSAC*100)}*1/8 }, { (100ms * f ) * 1/8 } ]
where units = (8 clocks) and “ f ” is the clock frequency.
TRAN_SPEED defines the maximum data transfer rate.
TRAN_SPEED Bit Code
2:0 transfer rate unit 0 = 100kbit / s, 1 = 1Mbit / s, 2 = 10Mbit / s, 3 = 100Mbit / s, 4... 7 = reserved
6:3 time value 0=reserved, 1=1.0, 2=1.2, 3=1.3, 4=1.5, 5=2.0, 6=2.5, 7=3.0, 8=3.5, 9=4.0, A=4.5,
B=5.0, C=5.5, D=6.0, E=7.0, F=8.0
CCC is a subset of the card command specification (command category), which defines the command categories that this card can support. A bit value of "1" in CCC means that the corresponding command category can be supported.
READ_BL_LEN is the maximum readable data block length and is calculated using 2^READ_BL_LEN. Therefore, the maximum block length is in the range of 512...2048 bytes. Note: In SD cards,
WRITE_BL_LEN is always equal to READ_BL_LEN.
READ_BL_PARTIAL is always 1 in SD card. Partial read of blocks is always allowed on SD card. It means that appropriately small blocks can be used. The smallest block can be as small as 1 byte.
READ_BL_PARTIAL = 0 means that the block size can only use the size of READ_BL_LEN for data transfer.
READ_BL_PARTIAL = 1 means that small blocks can be used. The smallest block will be equal to the smallest address unit (one byte).
WRITE_BLK_MISALIGN defines whether one write command can cover more than one physical block on the memory device. The size of this block is defined in WRITE_BL_LEN.
WRITE_BLK_MISALIGN = 0 means that crossing the physical block boundary is not allowed.
WRITE_BLK_MISALIGN = 1 means that crossing the physical block boundary is allowed.
READ_BLK_MISALIGN defines whether one read command can cover more than one physical block on the memory device. The size of this block is defined in READ_BL_LEN.
READ_BLK_MISALIGN = 0 means that crossing the physical block boundary is not allowed.
READ_BLK_MISALIGN = 1 means that crossing the physical block boundary is allowed.
DSR_IMP defines whether a configurable driver level is integrated on the card. If set, a driver level register (DSR) must be available. (DSR_IMP = 0 no SDR available)
C_SIZE (device size) This parameter is used to calculate the capacity of the card (excluding the security protection area). The memory capacity of the card is calculated by C_SIZE, C_SIZE_MULT and READ_BL_LEN
, see this formula:
Memory capacity = BLOCKNR * BLOCK_LEN = (C_SIZE+1)*2^(C_SIZE_MULT+2)*2^(READ_BL_LEN)
And those parameters are:
BLOCKNR = (C_SIZE+1) * MULT
MULT = 2^(C_SIZE_MULT+2)
BLOCK_LEN = 2^(READ_BL_LEN)
Therefore, the maximum capacity can be encoded as: 4096*512*2048 = 4 GByte. For example: a 4 MByte card with BLOCK_LEN = 512 can be encoded as C_SIZE_MULT = 0
and C_SIZE = 2047.
READ_BL_LEN is the maximum readable data block length and is calculated using 2^READ_BL_LEN. Therefore, the maximum block length is in the range of 512...2048 bytes. Note: In SD cards,
WRITE_BL_LEN is always equal to READ_BL_LEN.
VDD_R_CURR_MIN, VDD_W_CURR_MIN are the maximum currents required for read and write operations at the minimum voltage supply.
VDD_R_CURR_MAX, VDD_W_CURR_MAX are the maximum currents required for read and write operations at the maximum voltage supply.
C_SIZE_MULT (Device Size Multiplier) This parameter is used to represent the MULT, which is used to calculate the capacity of the device (refer to "C_SIZE"). MULT is defined as 2^(C_SIZE_MULT+2).
ERASE_BLK_EN defines whether erasing a writable block (see WRITE_BL_LEN) is allowed (i.e. in addition to SECTOR_SIZE given below).
ERASE_BLK_EN = 0 The host controller can only erase one SECTOR_SIZE unit. ERASE_BLK_EN
= 1 The host controller can erase either one SECTOR_SIZE unit or one WRITE_BLK_LEN unit.
SECTOR_SIZE The size of the erasable sector. This register is a 7-bit binary coded value that defines the number of writable blocks (see WRITE_BL_LEN). The actual size is this number plus 1.
A 0 means 1 writable block, 127 means 128 writable blocks.
WP_GRP_SIZE Size of the write protection group. This register is a 7-bit binary coded value defining the number of erasable groups (see SECTOR_SIZE). The actual size is this number plus 1.
A 0 means 1 erasable group, 127 means 128 erasable groups.
WP_GRP_ENABLE A "0" means no write protection group exists, a "1" does the opposite.
R2W_FACTOR defines the typical block programming (burning) time as a multiple of the read access time.
R2W_FACTOR Multiples of Read Access Time Note
0 1
1 2 (write half as fast as read) Half fast write and read the same
2 4
3 8
4 16
5 32
6, 7 Reserved Reserved
The maximum write data block length WRITE_BL_LEN is calculated as 2^WRITE_BL_LEN. The maximum block length can range from 512 to 2048 bytes.
It is always supported when the write block length is set to 512 (the default value of the SD card system). Note: In the SD card, WRITE_BL_LEN is always equal to READ_BL_LEN.
WRITE_BL_PARTIAL defines whether the "Block Write" command can be used for incomplete blocks.
WRITE_BL_PARTIAL = 0 means that the block size can only be WRITE_BL_LEN, and the associated partial must be a block of 512 units, which can be used to write block index data.
WRITE_BL_PARTIAL = 1 means that very small blocks can also be used. The minimum block size is 1 byte.
FILE_FORMAT_GROUP indicates the file format of the selected component. This area is ROM and can only be read.
FILE_FORMAT_GRP FILE_FORMAT Type Notes
0 0 Hard disk-like file system with partition table has an allocation table, similar to a hard disk file system
0 1 DOS FAT (floppy-like) with boot sector only (no partition table) has only a boot sector DOS FAT (similar to a floppy disk) (no allocation table)
0 2 Universal File Format Universal file format
0 3 Others/Unknown Others/Unknown
1 0, 1, 2, 3 Reserved Reserved
The COPY bit marks whether the card is original (0) or non-original (1). Once set to non-original, this bit cannot be reset to original. The definition of "original" and "non-original" is determined and
modified by the application, not a characteristic of the card.
PERM_WRITE_PROTECT permanently protects all contents on the card except the security protection area, prohibiting rewriting or erasing (all write and erase commands of the card are invalid). Its default value is "0",
which means no permanent write protection. This feature bit can only be written once, so it can be used to set the SD card to a read-only ROM, and the user cannot rewrite the contents.
TMP_WRITE_PROTECT temporarily protects all contents on the card except the security protection area, which can be rewritten or erased later (all write and erase commands of the card are temporarily invalid). This bit can be
set and reset. Its default value is "0", which means no write protection.
FILE_FORMAT describes the file format on the card. This area is ROM and can only be read. The definition is the same as FILE_FORMAT_GROUP
CRC This CRC area carries the checksum of the CSD contents. This checksum must be recalculated after any modification of the CSD by the host controller. The default value corresponds to the contents of the CSD when it was initialized.
SD card Configuration Register (SCR)
In addition to the CSD register, there is another configuration register called the SD Card Configuration Register (SCR). The SCR provides some special features of the SD card. Its size is 64 bits. The
contents of this register are set by the manufacturer at the factory.
Description Field Width Cell Type SCR
4 R 0
4 R 0
1 R 0 0
3 R 2
4 R 5
- 16 R 0 0
- 32 R 0 0
Description
|
Field
|
Width
|
Cell Type
|
SCR Slice
|
SCR Value
|
SCR Code
|
SCR Structure |
SCR_STRUCTURE |
4 |
R |
[63:60] |
V1.0 |
0 |
SD Card—Spec. Version |
SD_SPEC |
4 |
R |
[59:56] |
V1.01 |
0 |
data_status_after erases |
DATA_STAT_AFTER_ERASE |
1 |
R |
[55:55] |
0 |
0 |
SD Security Support |
SD_SECURITY |
3 |
R |
[54:52] |
Prot 2, Spec V1.01 |
2 |
DAT Bus widths supported |
SD_BUS_WIDTHS |
4 |
R |
[51:48] |
1 & 4 |
5 |
Reserved |
- |
1 |
R |
[47:32] |
0 |
0 |
Reserved for manufacturer usage |
- |
3 |
R |
[31:0] |
0 |
0 |
SCR_STRUCTURE Version number of the SCR structure in the physical level description within the SD card.
SD_SPEC describes the specification version supported by this SD card at the physical level.
DATA_STAT_AFTER_ERASE defines the state of the data after erasure. It can be either "0" or "1" (depending on the card vendor).
SD_SECURITY describes the security algorithms supported by the card. 0: None 1: Security Protocol 1.0 Security Description Version 0.96 2: Security Protocol 2.0 Security Description Version 1.0 - 1.01. Others are reserved
SD_BUS_WIDTHS describes all data bus widths supported by the card. Starting from the SD card supporting at least 1-bit or 4-bit bus width modes, any SD card will at least set bits 0 and 2
(ie SD_BUS_WIDTH = 0101). 1.4 bits are reserved
Operating Conditions Register (OCR)
This 32-bit operating condition register stores the card's VDD voltage profile. Any standard SD card host controller can use an operating voltage of 2V to 3.6V
to allow the SD card to perform this voltage identification operation (CMD1). The array operation to access the memory requires an operating voltage of 2.7V to 3.6V anyway.
The OCR register shows the voltage range required when accessing the card's data. The structure of the OCR register is described as follows:
Bit
|
Voltage
|
Bit
|
Voltage
|
0 |
Reserved |
16 |
2.8-2.9 |
1 |
Reserved |
17 |
2.9-3.0 |
2 |
Reserved |
18 |
3.0-3.1 |
3 |
Reserved |
19 |
3.1-3.2 |
4 |
1.6-1.7 |
20 |
3.2-3.3 |
5 |
1.7-1.8 |
21 |
3.3-3.4 |
6 |
1.8-1.9 |
22 |
3.4-3.5 |
7 |
1.9-2.0 |
23 |
3.5-3.6 |
8 |
2.0-2.1 |
24 |
Reserved |
9 |
2.1-2.2 |
25 |
Reserved |
10 |
2.2-2.3 |
26 |
Reserved |
11 |
2.3-2.4 |
27 |
Reserved |
12 |
2.4-2.5 |
28 |
Reserved |
13 |
2.5-2.6 |
29 |
Reserved |
14 |
2.6-2.7 |
30 |
Reserved |
15 |
2.7-2.8 |
31 |
Status bit at power-on (0: busy) |
3. SD/MMC card SPI mode command set
NOTE:
1) class1, class3, class9: SPI mode is not supported!
2) SD2.0 was introduced after SD1.1, and its main feature is to support larger capacity. In SD1.1, the card capacity is stored in the CSD register,
and because the value of the relevant field in its specification is small, it can only represent a maximum of 2G address. With the great increase in Nand capacity,
SD1.1 is no longer suitable for the trend, so SD2.0 was introduced.
The initialization process is similar, and only requires the recognition of CMD8 command after CMD0. SD1.1 does not support CMD8,
while SD2.0's CMD8 can read the interface information of the card. If the card responds to CMD8 as an invalid command, it will follow the SD1.1 process, which
may be SD1.1 or MMC. If the CMD8 response is correct, it is likely to be SD2.0.
3) The SD card has a security encryption function and a built-in 128-bit encryption bit. In the encrypted state, the user needs to provide a password to access the data in the card.
When the card is powered on, if the card contains a password, the card automatically enters a locked state, and all read and write commands return errors to protect the card contents from being read and modified.
The password setting function is implemented by CMD42, and its data packet includes all the information in the command.
Byte Bit7 Bit6 Bit5 Bit4 Bit3 Bit2 Bit1 Bit0
0 Erase Card Lock/UnLock ClrPwd SetPwd
1 Psw_Length
2 Pwd Data
.
.
.
PwdLen+1
Erase: When this position is 1, the password and content of the card will be forcibly erased. This function can be used when the password is forgotten.
Lock/Unlock: When this position is 1, it means the status is locked after the command is completed, and 0 means the card is unlocked.
Clear password: This position is 1, indicating that the old password of the card is cleared. At this time, the data must contain the correct content of the old password.
Encryption: This position is set to 1, indicating that the new password of the card is set. The data must contain the new password content; when changing the password, the new password follows the old password content.
At any time, the host can read the internal state of the card through the CMD13 command to determine its lock state. Bit0 is set to 1 to indicate that the card is in the locked state.
1. Set a password
Use CMD16 to set the Block length to the password length PWD_LEN+2;
Send CMD42 command: 0x6A, 0x00, 0x00, 0x00, 0x00, 0x95;
Send command data: 0x01,LEN,CMD_DATA0,CMD_DATA1...,0xFF,0xFF;
Use CMD16 to restore the original Block length.
2. Clear password
Use CMD16 to set the Block length to PWD_LEN+2;
Send CMD42 command: 0x6A, 0x00, 0x00, 0x00, 0x00, 0x95;
Send command data: 0x02,LEN,CMD_DATA0,CMD_DATA1...,0xFF,0xFF;
Use CMD16 to restore the original Block length.
3. Locking and unlocking the card
Use CMD16 to set the Block length to PWD_LEN+2;
Send CMD42 command: 0x6A, 0x00, 0x00, 0x00, 0x00, 0x95;
Send command data: 0x04,LEN,password [LEN]……,0xFF,0xFF;
Use CMD16 to restore the original Block length.
4. Change password
Use CMD16 to set the Block length to OLD_PWD_LEN+NEW_PWD_LEN+2;
Send CMD42 command: 0x6A, 0x00, 0x00, 0x00, 0x00, 0x95;
Send command data: 0x05, LEN, old password [n], new password [m]..., 0xFF, 0xFF;
Use CMD16 to restore the original Block length.
5. Card Erase
Use CMD16 to set the Block length to 1;
Send CMD42 command: 0x6A, 0x00, 0x00, 0x00, 0x00, 0x95;
Send command data: 0x08, 0xFF, 0xFF;
Use CMD16 to restore the original Block length.
/******************************** Class0: Basic command set Basic command set **************************/
/* Reset cards to idle state */
#define CMD0 0
#define CMD0_R R1
/* Read the OCR register, not applicable to SD cards Read the OCR (MMC mode, do not use for SD cards) */
#define CMD1 1
#define CMD1_R R1
/* Read the CSD register Card sends the CSD */
#define CMD9 9
#define CMD9_R R1
/* Read CID register Card sends CID */
#define CMD10 10
#define CMD10_R R1
/* Stop a multiple block (stream) read/write operation */
#define CMD12 12
#define CMD12_R R1B
/* Read Card_Status register Get the addressed card's status register */
#define CMD13 13
#define CMD13_R R2
/******************************** Class2: Block read commands ******************************/
/* Set the block length */
#define CMD16 16
#define CMD16_R R1
/* Read a single block */
#define CMD17 17
#define CMD17_R R1
/* Read multiple blocks until the host sends a CMD12 Read multiple blocks until a CMD12 */
#define CMD18 18
#define CMD18_R R1
/***************************** Class4: Block write commands *************************/
/* Write a block of the size selected with CMD16 */
#define CMD24 24
#define CMD24_R R1
/* 写多块 Multiple block write until a CMD12 */
#define CMD25 25
#define CMD25_R R1
/* Write the programmable bits of the CSD register */
#define CMD27 27
#define CMD27_R R1
/*****************************Class6: Write protection *****************************/
/* Set the write protection bit of the addressed group */
#define CMD28 28
#define CMD28_R R1B
/* Clear the write protection bit of the addressed group */
#define CMD29 29
#define CMD29_R R1B
/* Ask the card for the status of the write protection bits */
#define CMD30 30
#define CMD30_R R1
/***************************** Class5: Erase commands *******************************/
/* Set the address of the first write block to be erased(only for SD card) */
#define CMD32 32
#define CMD32_R R1
/* Set the address of the last write block to be erased(only for SD) */
#define CMD33 33
#define CMD33_R R1
/* Set the address of the first write block to be erased(only for MMC) */
#define CMD35 35
#define CMD35_R R1
/* Set the address of the last write block to be erased(only for MMC) */
#define CMD36 36
#define CMD36_R R1
/* Erase the selected write blocks */
#define CMD38 38
#define CMD38_R R1B
/***************************** class7: Lock Card commands ******************************/
/* Set/reset the password or lock/unlock the card */
#define CMD42 42
#define CMD42_R R1B
/* Commands from 42 to 54, not defined here */
/***************************** Application-specific commands ****************/
/* Notify the card that the next command is a special command, not a standard command Flag that the next command is application-specific */
#define CMD55 55
#define CMD55_R R1
/* General purpose I/O for application-specific commands */
#define CMD56 56
#define CMD56_R R1
/* Read the OCR register (SPI mode only) (Power configuration register) */
#define CMD58 58
#define CMD58_R R3
/* Turn CRC on or off */
#define CMD59 59
#define CMD59_R R1
/***************************** Application-specific commands ***************/
/* Get the SD card's status */
#define ACMD13 13
#define ACMD13_R R2
/* Get the number of written write blocks (Minus errors ) */
#define ACMD22 22
#define ACMD22_R R1
/* Set the number of write blocks to be pre-erased before writing */
#define ACMD23 23
#define ACMD23_R R1
/* Activates the card's initialization process */
#define ACMD41 41
#define ACMD41_R R1
/* Connect or disconnect the 50kOhm internal pull-up on CD/DAT[3] */
#define ACMD42 42
#define ACMD42_R R1
/* Get the SD configuration register */
#define ACMD51 51
#define ACMD51_R R1
The above is an introduction to registers. There are indeed a lot of them, and they are quite complicated and need to be digested carefully.
|