Key points of SD card reading and writing

Publisher:快乐旅行Latest update time:2015-09-10 Source: eefocus Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere
[Reprint] Key points of SD card reading and writing

This is the reset timing diagram. Let's analyze how to read the timing diagram in combination with the program.

The IN and OUT above are definitions for the SD card as the host. IN is the interface for the microcontroller to send data to the SD card, and OUT is the interface for the SD card to send data.

Timing diagram We write the program step by step based on the CLK status. The first part is: 74 clock beats, which means starting to send 74 clock beats. CS must be set high, data line IN must send 1, and OUT can be ignored. The program is as follows

SD_CS=1;  

for(i=0;i<0x0f;i++) 
    SD_spi_write(0xff); 

SD_CS=0;

In this way, we have completed the first part of the timing. SD_spi_write() is the read and write function of the SPI interface that I wrote earlier. Here we sent more than 74 clock beats. Will this be a problem? We can see that there is a blank after 74 in the timing diagram, so there is no problem. The timing beats can be more but not less.

Reference address:Key points of SD card reading and writing

Previous article:SD card SPI read and write subroutines and SD card settings for SPI bus operations
Next article:Use of volatile variables

Latest Microcontroller 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号