O Introduction
SD card (secure digital memory card) is a new generation memory device based on semiconductor flash memory. It is widely used in portable devices such as digital cameras, personal digital assistants (PDAs) and multimedia players. SD card was jointly developed by Japan's Panasonic, Toshiba and the United States SanDisk in August 1999. The size of an SD card is like a stamp, and it weighs only 2g, but it has high memory capacity, fast data transfer rate, great mobility and good security.
This article uses the AVR microcontroller to read the data in the FAT32 file system on the SD card through a combination of software and hardware design. FAT32 is a new generation of file system developed by Microsoft. It supports larger storage capacity and file names up to 255 characters. It can also access the data in the memory through a computer through a serial port to USB interface chip, thereby realizing a multi-channel three-dimensional access method and further improving resource utilization.
1 File System
1.1 Introduction to FAT file system
The File Allocation Table (FAT) is a partially patented file system invented by Microsoft for use with MS-DOS and non-NT-kernel Microsoft Windows. The FAT file system was not complicated considering the limited performance of computers at the time, and is therefore supported by almost all personal computer operating systems. These features make it an ideal file system for floppy disks and memory cards. But FAT has a serious disadvantage: when files are deleted and new data is written to the same location, their fragments are usually scattered, slowing down the reading and writing speed. Disk defragmentation is a solution, but it must be reorganized frequently to maintain the efficiency of the FAT file system.
1.2 FAT file system upgrade version
FAT32 is actually a form of file partition table, which is relative to FAT16. It can greatly save disk space. Files are stored in clusters on the disk. If a file is stored in a cluster, no other files can be stored.
The biggest advantage of FAT32 is that it can support disk sizes up to 2 TB (2 048 GB), but it cannot support partitions smaller than 512 MB. Due to the use of smaller clusters, the FAT32 file system can save information more efficiently. FAT32 can use space more efficiently. FAT32 uses smaller clusters (i.e., for drives within 8 GB in size, 4 KB clusters are used), which can increase the utilization of disk space by 10 9.6-15% compared to large FAT or FAT16 drives.
FAT32 is more stable and reliable. FAT32 can relocate the root folder, and it uses a backup copy of the file allocation table instead of the default copy. In addition, the boot record on FAT32 drives is expanded to include backup copies of key data structures. Therefore, FAT32 drives are less susceptible to single points of failure than existing FAT16 drives.
FAT32 is more flexible. The root folder on a FAT32 drive is a normal cluster chain, so it can be located anywhere on the drive. The previous limit on the number of root folders no longer exists. In addition, file allocation table mirroring can be disabled, so that a copy of the file allocation table is active instead of the first file allocation table. These features allow you to dynamically resize FAT32 partitions.
2 Hardware Design
2.1 Chip Overview
ATmega32 is a low-power 8-bit CMOS microcontroller based on an enhanced AVR RISC structure. Due to its advanced instruction set and single-clock cycle instruction execution time, the data throughput of ATmega32 is as high as 1 MIPS/MHz, which can alleviate the contradiction between power consumption and processing speed in the system. The ATmega32 AVR core has a rich instruction set and 32 general-purpose working registers. All registers are directly connected to the arithmetic logic unit (ALU), so that one instruction can access two independent registers simultaneously in one clock cycle. This structure greatly improves code efficiency and has a data throughput of up to 10 times that of ordinary CISC microcontrollers.
PL2303 is used to realize the conversion between USB and standard RS 232 serial port. Two independent large buffers are used to connect the two buses. The large data buffer is used for USB bulk data transmission. The automatic handshake mode can be used for serial communication, so the baud rate can be much higher than that of the standard UART controller. PL2303 supports USB power management and remote wake-up protocol. In this design, the PL2303 chip is mainly used to combine the download line of the main control unit with the power supply module, which greatly simplifies the design complexity of the system.
NOKIA 5110 LCD display, a traditional dot matrix LCD display, does not have built-in English and Chinese character fonts. Therefore, the NOKIA 5110 LCD display process requires the microcontroller to convert the ASCII code value read from the memory into the corresponding English and Chinese character dot matrix information, and then transmit the dot matrix information to the LCD display through the serial port for display.
2.2 Hardware Design
The hardware unit includes: AVR master control ATmega32 unit module, SD card interface module, LCD display interface module, and serial port to USB interface.
2.2.1 Main control circuit design
The main control circuit (as shown in FIG. 1 ) is mainly responsible for converting the data read from the input interface into corresponding character codes.
2.2.2 Storage system module and download interface design
The SD card interface is shown in Figure 2.
2.2.3 LCD display module design
The LCD display interface is shown in Figure 3.
2.2.4 USB conversion interface module design
The design of the serial-to-USB interface on the computer side is shown in Figure 4.
3 Software Design
The system software design mainly includes several modules such as AVR microcontroller main control program, interrupt service control subroutine, LCD control subroutine, encoding conversion subroutine, etc. The program running flow of the microcontroller side is shown in Figure 5, and the program running flow of the computer side is shown in Figure 6.
4 Summary and Outlook
Since this design uses some general devices, it is an experimental expansion application of general devices. The human-machine interface designed through LCD realizes friendly operation of the equipment, can perform two-way three-dimensional reading and writing through the microcontroller and computer, and can realize online real-time FAT32 file system resource management. Therefore, this system has certain social value and application value.
Previous article:Design and implementation of ship weather instrument test system based on AVR microcontroller
Next article:Design of CCD driving circuit based on ATmega16 microcontroller
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
- What does a 5G base station look like? This article will help you find out!
- Help! Is there a suitable sensor?
- [TI recommended course] TI development board to realize intelligent servo
- Design of intelligent robot for home medical care based on Bluetooth and DSP
- [RVB2601 Creative Application Development] Simulating UART 1
- When you have self-doubt, you can talk to your friends more often.
- [NXP Rapid IoT Review] +9. Experience of using NXP Rapid IOT
- The issue of volume size and capacity of audio transformers
- High Speed Digital Design Handbook (Black Book)
- [Raspberry Pi 4B Review] Install the game system Lakka on Raspberry Pi 4 to play retro games