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:
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:
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:
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:
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:
The experimental results are as follows:
Previous article:Notes on using LPC2148GPIO
Next article:LPC1114 read and write SD card under FAT
- Popular Resources
- Popular amplifiers
Professor at Beihang University, dedicated to promoting microcontrollers and embedded systems for over 20 years.
- Innolux's intelligent steer-by-wire solution makes cars smarter and safer
- 8051 MCU - Parity Check
- How to efficiently balance the sensitivity of tactile sensing interfaces
- What should I do if the servo motor shakes? What causes the servo motor to shake quickly?
- 【Brushless Motor】Analysis of three-phase BLDC motor and sharing of two popular development boards
- Midea Industrial Technology's subsidiaries Clou Electronics and Hekang New Energy jointly appeared at the Munich Battery Energy Storage Exhibition and Solar Energy Exhibition
- Guoxin Sichen | Application of ferroelectric memory PB85RS2MC in power battery management, with a capacity of 2M
- Analysis of common faults of frequency converter
- In a head-on competition with Qualcomm, what kind of cockpit products has Intel come up with?
- Dalian Rongke's all-vanadium liquid flow battery energy storage equipment industrialization project has entered the sprint stage before production
- Allegro MicroSystems Introduces Advanced Magnetic and Inductive Position Sensing Solutions at Electronica 2024
- Car key in the left hand, liveness detection radar in the right hand, UWB is imperative for cars!
- After a decade of rapid development, domestic CIS has entered the market
- Aegis Dagger Battery + Thor EM-i Super Hybrid, Geely New Energy has thrown out two "king bombs"
- A brief discussion on functional safety - fault, error, and failure
- In the smart car 2.0 cycle, these core industry chains are facing major opportunities!
- The United States and Japan are developing new batteries. CATL faces challenges? How should China's new energy battery industry respond?
- Murata launches high-precision 6-axis inertial sensor for automobiles
- Ford patents pre-charge alarm to help save costs and respond to emergencies
- New real-time microcontroller system from Texas Instruments enables smarter processing in automotive and industrial applications
- Sharing joy with others is worse than enjoying it alone——TI training’s “recommended courses” function is now available for public testing. We invite you to make suggestions and participate in the competition!
- Seeking advice from hardware experts: PWM control transistor buck-boost output waveform
- November 24 live broadcast review: NXP's embedded human machine interface solution detailed explanation (including video playback, ppt, Q&A)
- BLDC Motor Control Algorithm - FOC Brief Introduction
- PyPortal weather and clock display
- TL437x-EVM Evaluation Board Test Manual (1)
- EEWORLD University - Understanding and comparing high-speed analog-to-digital (ADC) and digital-to-analog converter (DAC) converter architectures
- [Gizwits Gokit3 Review] + Networking and lighting up RGB lights
- Comprehensively explain the relationship between power supply PCB layout and EMC from nine aspects!
- SHT31 Review + Unboxing