LPCXpresso LPC1114 SSP multi-sector read and write SD card

Publisher:BlissfulMoonLatest update time:2016-07-15 Source: eefocusKeywords:LPCXpresso Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere
In order to more clearly explain the difference between multi-sector and single-sector reading and writing, a separate post is opened for detailed explanation.

 

When working with the FatFs file system, I found that in order to increase the read and write speed of the SD card, a multi-sector read and write function is needed. Of course, many people's first reaction is that it can be achieved by calling a single-sector read and write function in a loop? For example:

uint8 i;

 

for (i=0; i < count; i++)

{

    MMCWriteSingleBlock(); // Single sector write

    MMCReadSingleBolck(); // Single sector read

}

 

In fact, it can be implemented in this way, but if it is implemented in this way, there will be no advantage of multi-sector reading and writing. The speed will not be improved at all. So we consult the SD card technology and get the following timing:

 

LPCXpresso LPC1114 SSP multi-sector read and write SD card (original) - My Heart Will Go On - ARM - New Dream

 

Let's first look at the read and write timing of the single sector and multi-sector of the SD card. It can be found that the timing is basically the same. It's just that the multi-sector read function needs to send a stop command after the reading is completed. The implementation function is as follows:

LPCXpresso LPC1114 SSP multi-sector read and write SD card (original) - My Heart Will Go On - ARM - New Dream

LPCXpresso LPC1114 SSP multi-sector read and write SD card (original) - My Heart Will Go On - ARM - New Dream

 

 

Check the timing, and then the following functions are very easy to understand, so I won't go into details. In fact, the functions written in the SD card are the same, first look at the following timing:

LPCXpresso LPC1114 SSP multi-sector read and write SD card (original) - My Heart Will Go On - ARM - New Dream

 

 

Similarly, we found that the timing of single-sector writing and multi-sector writing is basically the same, except that the multi-sector writing function has an additional "send 'stop transmission token'". That is, the stop token, the function is as follows:

 

LPCXpresso LPC1114 SSP multi-sector read and write SD card (original) - My Heart Will Go On - ARM - New Dream

LPCXpresso LPC1114 SSP multi-sector read and write SD card (original) - My Heart Will Go On - ARM - New Dream

 

 

Comparing the above timing and functions is very easy to understand, so I won’t go into details.

 

Through the above timing and function implementation, we know that the multi-sector read and write function is much more efficient than the single-sector read and write function. Of course, appropriate modifications to some codes in the function will further improve the execution efficiency. I will not go into details here. Netizens with programming experience know how to change it.

Let's take a look at the implementation of the main function:

 

LPCXpresso LPC1114 SSP multi-sector read and write SD card (original) - My Heart Will Go On - ARM - New Dream

The experimental results are as follows:

 

LPCXpresso LPC1114 SSP multi-sector read and write SD card (original) - My Heart Will Go On - ARM - New Dream

 IMG_3424.JPG  (40.69 KB)
2010-5-23 08:10

 

 

LPCXpresso LPC1114 SSP multi-sector read and write SD card (original) - My Heart Will Go On - ARM - New Dream

 IMG_3427.JPG  (45.85 KB)
2010-5-23 08:10

 

 

LPCXpresso LPC1114 SSP multi-sector read and write SD card (original) - My Heart Will Go On - ARM - New Dream

 

 

Keywords:LPCXpresso Reference address:LPCXpresso LPC1114 SSP multi-sector read and write SD card

Previous article:Notes on using LPC2148GPIO
Next article:LPC1114 read and write SD card under FAT

Latest Microcontroller Articles
  • Download from the Internet--ARM Getting Started Notes
    A brief introduction: From today on, the ARM notebook of the rookie is open, and it can be regarded as a place to store these notes. Why publish it? Maybe you are interested in it. In fact, the reason for these notes is ...
  • Learn ARM development(22)
    Turning off and on interrupts Interrupts are an efficient dialogue mechanism, but sometimes you don't want to interrupt the program while it is running. For example, when you are printing something, the program suddenly interrupts and another ...
  • Learn ARM development(21)
    First, declare the task pointer, because it will be used later. Task pointer volatile TASK_TCB* volatile g_pCurrentTask = NULL;volatile TASK_TCB* vol ...
  • Learn ARM development(20)
    With the previous Tick interrupt, the basic task switching conditions are ready. However, this "easterly" is also difficult to understand. Only through continuous practice can we understand it. ...
  • Learn ARM development(19)
    After many days of hard work, I finally got the interrupt working. But in order to allow RTOS to use timer interrupts, what kind of interrupts can be implemented in S3C44B0? There are two methods in S3C44B0. ...
  • Learn ARM development(14)
  • Learn ARM development(15)
  • Learn ARM development(16)
  • Learn ARM development(17)
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号