Design of SD card reading platform based on single chip microcomputer and serial port

Publisher:电子创意达人Latest update time:2010-11-19 Source: 现代电子技术 Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

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.

Reference address:Design of SD card reading platform based on single chip microcomputer and serial port

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

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号