Application of logic analyzer in SD card

Publisher:心灵舞动Latest update time:2012-03-22 Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere
1. Introduction

SD card plays an important role in today's mobile storage due to its large capacity, low power consumption, compactness, lightness, hot pluggability and low price.

Today, we will take the LAB7504, a series of logic analyzers produced by Guangzhou Zhiyuan Electronics , as an example to introduce its application in SD card design.

2. Introduction to SD card

SD cards support three transmission modes: SPI mode (independent serial input and serial output), 1-bit SD mode (independent command and data channels, unique transmission format), and 4-bit SD mode (supporting four-bit wide parallel transmission). Table 1 introduces the relationship between data rate and mode.

Speed ​​mode relationship

The bus topology of SD mode is:

A star topology with one master (such as a microcontroller), multiple slaves (cards) and synchronization.

All cards share the clock CLK, power and ground signals. The command line (CMD) and data lines (DAT0~DAT3) are dedicated lines for the card, that is, each card has these signal lines independently. Table 2 introduces the signal functions in SD mode.

Signal functions in SD mode

In SPI mode, the host uses the SPI bus to access the card. The microcontroller can select the card to enter SD mode or SPI mode in the first reset command after the card is powered on. However, the communication mode between them cannot be changed to SD mode during the card power-on period.

Table 3 describes the signal functions in SPI mode.

Signal functions in SPI mode

3. Decoding Analysis

The SD card protocol is relatively complex and has many modes. The commands, response behaviors, and CRC of data tokens in each mode are also very complex. If the R&D personnel need to parse the logic levels one by one during the design, the efficiency is too low and it is easy to make mistakes. The LAB7504 logic analyzer produced by Guangzhou Zhiyuan Electronics Co., Ltd. has SD card SPI mode and SD mode plug-in decoding tools, which can easily help engineers quickly and intuitively analyze the commands and data on the SD card bus. The following introduces the decoding plug-ins of the two modes respectively.

SD Mode

Click [Tools] and [Plugin Manager] on the logic analyzer host computer and select "SD Card SD Mode Protocol Analysis". The SD_SDMODE setting dialog box pops up. Fill in the bus setting options according to the actual situation of the SD card being collected. The bus settings for this collection are shown in Figure 1 (excluding the color setting and display setting).

SD-SDMODE settings

Parameter Setting Introduction

CLK: Select the clock signal of the data to be decoded, which represents the CLK clock signal in the protocol.

Block length: Enter the number of blocks in the multi-block transmission process. In the process of reading and writing data blocks, there are multi-block read and write commands. The user needs to set the number of blocks when reading and writing multiple blocks, and enter the corresponding number in the block length.

CLK frequency: Enter the clock frequency. The clock frequency refers to the frequency of the clock signal transmission and is set according to the transmission of the clock signal.

Wide bus: Select whether to use wide bus transmission.

That is, whether to select 4-bit SD mode, single bus is 1-bit SD mode.

CMD bus settings: Set command bus parameters.

DATA bus settings: Set data bus parameters.

Frame color setting: Set the display color of each frame in the decoded packet.

Packet color setting: Set the display color of the decoded packet.

Display mode: Set the display mode of the decoded data, which can be hexadecimal, decimal or character format.

Let's take a look at the result after decoding through the plug-in. As shown in Figure 2, the decoded signal is enlarged, and the start bit: START; transfer bit: ToCard; command: READ_MULTIPLE_BLOCK and other information can be seen (there are also command parameters, CRC check, end bit and other information not displayed here).

Command parsing

As shown in Figure 3, the result after data bus decoding, the red box is the data start mark.

Data and start
SPI Mode

Click [Tools] and [Plugin Manager] on the logic analyzer host computer and select "SD Card SPI Mode Protocol Analysis". The SD_SPI Settings dialog box pops up. Fill in the bus setting options according to the actual situation of the SD card being collected. The bus settings for this collection are shown in Figure 4 (color settings and display settings are omitted).

SD_SPI Settings

Parameter Setting Introduction

CS: Select the chip select signal line, representing the CS chip select signal in the protocol.

CLK: Select the clock signal of the data to be decoded, which represents the CLK clock signal in the protocol.

Block Length: Enter the number of blocks in a multi-block transfer.

CLK frequency: The clock frequency of the input CLK signal.

SPI mode: Select the SPI decoding mode, starting from the first or second pulse, rising edge or falling edge sampling.

DataIn bus: Set the input bus information in the protocol.

DataOut bus: Set the output bus information in the protocol.

Frame color setting: Set the display color of each frame in the decoded packet.

Packet color setting: Set the display color of the decoded packet.

Display mode: Set the display mode of the decoded data, which can be hexadecimal, decimal or character format.

Due to space limitations, we will not go into detail about the decoding of the SPI mode here. The way to view the instructions and data after software decoding is similar to the operation in the SD mode. Readers can experience these operations themselves in actual applications.

Here is a screenshot of the start transmission command, as shown in Figure 5. Error! Reference source not found. At the beginning, the command information is clear at a glance.

Observe the start transfer command

4. Conclusion

LAB7504 provides excellent sampling rate and storage capacity, which can easily find timing problems between communication signals, helping engineers to quickly find and solve current problems and potential timing risks.

Reference address:Application of logic analyzer in SD card

Previous article:Digital stopwatch design using Verilog
Next article:Circuit for testing capacitors

Latest Analog Electronics Articles
Change More Related Popular Components

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

About Us Customer Service Contact Information Datasheet Sitemap LatestNews


Room 1530, 15th Floor, Building B, No.18 Zhongguancun Street, Haidian District, Beijing, Postal Code: 100190 China Telephone: 008610 8235 0740

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京ICP证060456号 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号