Design of storage device dumper based on single chip microcomputer

Publisher:水墨人生Latest update time:2014-03-14 Source: elecfansKeywords:MCU Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

  At present, USB flash drives have become one of the most commonly used mobile storage devices due to their small size, easy to carry, large capacity, and convenient use. However, people have always used USB flash drives only for communication between USB flash drives and computers. If you want to transfer the contents of multiple USB flash drives to each other, you must do it through computer connection, which is troublesome and cannot meet people's needs to dump data anytime and anywhere when they are out. In response to this demand, this paper designs a USB flash drive dumper with C8051FD40 microcontroller as the core, which can realize the data exchange between two USB flash drives without using a computer. It has the advantages of small size, fast transmission speed, convenient operation, and low hardware comprehensive cost.

  1 System Hardware Design

  1.1 System overall structure and working principle

  The system consists of a power module, a USB interface dump module, a control module, a keyboard module, and a liquid crystal display module, as shown in Figure 1. The C8051F040 microcontroller is connected to two CH375 USB flash drive modules. By opening a data buffer inside the microcontroller, the subroutine library is directly called to transfer the selected file data in one USB flash drive to another USB flash drive. The liquid crystal and external keyboard realize the human-machine interface. The file to be transferred is selected through the up, down, select, copy and other buttons on the keyboard, and the file name, file size and other related information are displayed in the liquid crystal module. The human-machine interaction interface is friendly and easy to operate.

  

System overall structure

 

  1.2 CH375 USB flash drive module

  The CH375 USB flash drive reader/writer module developed by Zhennan Electronics is used. The module is small in size, only 3.3x2.0 cm2. The module is powered by 5 V and is equipped with an indicator light, which is lit when working. The module uses the USB master-slave controller CH375B and is driven in parallel to realize the reading and writing of the USB flash drive. A total of 13 signal lines are required (5 control lines and 8 data lines).

  The znFAT provided by this module is a FAT32 file system solution on a single-chip microcomputer, which can easily realize various file-level applications on the U disk. It mainly includes some basic file operations such as file sector positioning, file opening, information modification, file closing, file deletion, file reading, file writing, and disk information query. This module has the characteristics of small size, low price and easy use. Through this module, it is easy to transfer related files between two U disks through a single-chip microcomputer.

  The connection between CH375 U disk read/write module and C8051F040 microcontroller is shown in Figure 2. C8051F040 selects the U disk module through CS, and the U disk module communicates with the microcontroller in interrupt mode through INT. DO~D7 are the parallel communication data lines between CH375 U disk module and microcontroller, and the microcontroller controls CH375U disk module through AO, RD, and WR control signals. D+ and D- are the serial interfaces between CH375 U disk module and USB storage device. Through CH375 U disk module, it is easy to realize direct data dump between microcontroller and USB storage device.

  

Connection between CH375 U disk read/write module and C8051F040 microcontroller

 

  1.3 LCD display module

  This system uses the MGLS12232 LCD module with 122x32 dot matrix. The module has two 2.560-bit RAMs and two SED1520 controllers built in. The left and right half screens are controlled by two selection signals, E1 and E2. There are two connection methods for graphic LCD modules: one is direct access method and the other is indirect control method. This system uses direct control method, which directly connects the interface of the LCD module as a memory or I/O device to the microcontroller bus. The module is small in size, low in price and can meet the display of general folder names, file names and file information through the LCD module. [page]

  1.4 Keyboard Module

  The keyboard module is a 3x3 matrix keyboard structure, using Button keys, which define the power-on, reset, page up, page down, select, copy, paste and other keys, so as to realize various file dump operations with the least number of keys.

  1.5 C8051F040 MCU Control Module

  The C8051F040 microcontroller control module is the core control module of this system. The microcontroller has rich on-chip resources and powerful control functions: it is fully compatible with 8051, the maximum system clock frequency is 24 MHz, and the execution time of 70% of the instructions is 1 or 2 system clock cycles. Rich interrupt sources, the extended interrupt system provides 20 interrupt sources to CIP-51. An interrupt-driven system requires less MCU intervention, so it has higher execution efficiency. So many interrupt sources can fully meet all the peripherals of this system. Universal Serial Bus (USB) function controller, with 8 flexible endpoint pipelines, integrated transceiver and 1K FIFO RAM; large on-chip storage, CIP-51's SFR address space can contain up to 256 SFR pages. Through SFR paging, CIP-51MCU can control a large number of SFRs required for controlling and configuring on-chip peripherals. Rich serial port resources, with two enhanced full-duplex UARTs, an enhanced SPI bus and SMBus/I2C. Each serial bus is fully implemented in hardware and can generate interrupts to the CIP-51, so very little CPU intervention is required. These serial buses do not "share" resources such as timers, interrupts, or port I/O, and any one or more can be used simultaneously.

  The function of this module is to cache the file data to be transferred between two USB flash drives by opening a data buffer inside the microcontroller, and to control the opening, reading, writing and closing of USB flash drive files through two CH375 USB flash drive modules to achieve the transfer of file data. The control unit can also process the interrupt information sent by the peripheral keyboard to achieve the control of the microcontroller such as file selection. Some relevant file information is displayed by controlling an MGLS12232 LCD display module.

  2 System Software Design

  2.1 Peripheral control method

  This system uses the CH375 U disk module, which comes with znFAT, a FAT32 file system solution on the microcontroller. This reduces the complicated programming of the Fat32 file system. Since the CH375 U disk module is equipped with a file system and file operation subroutines, it is easier to realize the LCD display of file names and file information, as well as file selection and transfer operations through the microcontroller main program call.

  Since the C8051F040 microcontroller has rich interrupt resources, and interrupts have the following advantages:

  1) Time-sharing operation. The CPU can serve multiple I/O devices in a time-sharing manner, thus improving the utilization rate of the computer.

  2) Real-time response. The CPU can handle random events of the application system in a timely manner, greatly enhancing the real-time performance of the system.

  3) High reliability. The CPU has the ability to handle emergencies such as equipment failure and power failure, thereby improving the reliability of the system.

  In summary, all peripheral keyboards in this system are controlled by interrupts, and file transfer is also controlled by interrupts. In this way, the utilization efficiency of C8051F040 system resources has been greatly improved.

    2.2 File Dump Solution

  First, a buffer is opened inside the C8051F040 microcontroller. When a file needs to be transferred, first select a file in a USB flash drive. When the copy and paste buttons are clicked, the relevant program will be automatically called through an interrupt to open the file, read the file data from the opened buffer, and then store the buffer data in a newly created file with the same name in the corresponding directory of another USB flash drive.

  The overall flow chart of the system is shown in Figure 3. After the system is powered on, the buffer zone opened inside the C8051F040 microcontroller is initialized, and the LCD screen displays the initial interface, and then enters the state of waiting for the USB flash drive to be inserted. After waiting for a period of time, if no USB flash drive is inserted, the prompt message "Please insert the USB flash drive" is displayed. When the number of USB flash drives is one or two, the USB flash drive information is read and basic USB flash drive information is displayed on the LCD screen. After that, the C8051F040 microcontroller waits for keyboard operation, calls the corresponding interrupt program according to the code input by the keyboard, and after processing, continues to wait for the interrupt signal from the keyboard.

  

System flow chart

 

  3 Online debugging

  The two USB interfaces of the USB dumper are connected to two USB disks A and B respectively. The LCD screen can display the files in USB disk A. The files in USB disk A can be selected by manually operating the keyboard buttons on the dumper and can be transferred to USB disk B. The most difficult part in the production of this USB dumper is to debug the program on the device side. Due to the strict requirements of the USB protocol, the program must perform certain requests or states within the valid time, otherwise the USB will not work properly. Therefore, in the debugging process, some information output by the serial port output program is often used to assist debugging and locate the problem.

  The debugging work is mainly divided into two steps. The first is to be able to display the files in the U disk. With the help of PC debugging software (Bus Hound downloaded from the Internet), the USB protocol on the device side is adjusted, and then the U disk is added to write the U disk display program. The file name in the U disk can be seen on the LCD screen; the second step is dump, writing the dump program in the microcontroller for debugging. Dumping files can be realized by selecting the keyboard button.

  4 Conclusion

  Although there are functional modules for microcontrollers to read and write USB flash drives on the market, they can only realize simple reading functions, and cannot realize direct transmission and display between two USB flash drives. The USB flash drive dumper designed in this paper has been shown to be very practical and operable through experiments. People can easily complete the file dump from one USB flash drive to another without the help of a computer outdoors. Because the USB interface uses a very fast transmission speed, it can fully meet the needs of ordinary users. The system uses STM packaging, has the advantages of small size and easy to wear, and is a cheap and practical electronic product.

Keywords:MCU Reference address:Design of storage device dumper based on single chip microcomputer

Previous article:Temperature collection and wireless transmission system based on single chip microcomputer
Next article:Design of a multi-purpose intelligent temperature measuring instrument

Recommended ReadingLatest update time:2024-11-16 19:39

Design of intelligent vehicle power manager based on single chip microcomputer
0Introduction With the progress of automobile industry and electronic technology, the number of on-board electrical equipment is increasing day by day. Traffic police vehicles have put forward new requirements for on-board power supply due to their use requirements and the particularity of occasions. In ord
[Microcontroller]
Design of intelligent vehicle power manager based on single chip microcomputer
The idea of ​​independent key detection and debounce of 51 single-chip microcomputer based on state machine
Key detection ideas of state machine 2 Let's review the definition first: the state machine has the following properties The conditions for state transition of the key state machine How to accurately detect whether the conditions occur and perform state transition Ensure that the state machine can migrate stably The p
[Microcontroller]
The idea of ​​independent key detection and debounce of 51 single-chip microcomputer based on state machine
How to use the 16-bit PIC18F458 microcontroller to implement LCD display?
This article introduces a new type of LCD display system for displaying measurement results in the power grid quality detection system. It is mainly composed of PIC18F458 and LCD display module MGLS12864. PIC18F458 microcontroller is an advanced product of 16-bit RISC instruction set launched by Microchip, USA, and is
[Microcontroller]
How to use the 16-bit PIC18F458 microcontroller to implement LCD display?
AVR microcontroller controlled switching power supply
    The microcontroller controls the switching power supply. There are several control methods just for the control of the power output.         One is that the MCU outputs a voltage (via DA chip or PWM mode) which is used as the reference voltage of the power supply. This method only replaces the original reference v
[Microcontroller]
51 single chip microcomputer realizes single key repeated key detection
/******************************************************************************** Copyright: 2013-07-27.version1.0 File name: key.c Description: Self-made single-key recognition to achieve repeated key function Author: Version: version1.0 Date: 2013.7.27 History: None ****************
[Microcontroller]
Serial communication between two microcontrollers
Serial communication between microcontrollers Notice: Cross-connect the RXD and TXD of the two microcontrollers and share the GND ground...   Program features: The sending MCU sends 16 characters from 0 to F, which are displayed on the digital tube of the receiving MCU;   ///Send the microcontroller progra
[Microcontroller]
Microcontroller signal generator program
With D/A, we can not only output square wave signals, but also any waveforms, such as sine wave, triangle wave, sawtooth wave, etc. Taking sine wave as an example, we first need to create a sine wave table. You don't need to calculate them one by one. You can find the sine wave data table by searching, and then select
[Microcontroller]
Microcontroller signal generator program
Analysis of the structure principle of special function register based on single chip microcomputer
We know that the microcontroller has ROM, RAM, and parallel I/O ports. So, apart from these things, what else is inside the microcontroller? How are these bits and pieces connected together? Let's make a complete functional analysis of the registers inside the microcontroller! As we can see in the figure below, th
[Microcontroller]
Analysis of the structure principle of special function register based on single chip microcomputer
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号