The author believes that for a specific function, stripping the dependence of the corresponding data on the computer can make full use of U disk data on the one hand, and on the other hand, it can also give play to the versatility of USB protocol, so that U disk can achieve the portable characteristics of what you get. Based on this, a U disk MP3 player circuit is designed, which mainly completes the data extraction and function operation tasks of the audio files stored in the U disk. The player is equivalent to the audio processing module of a personal computer. It can not only identify and extract MP3, WMA or MIDI format files stored in the U disk, but also complete data processing such as audio decoding by itself, and finally send it to the speaker or headphones for playback.
1 Principle diagram of player
composition The principle diagram of the player composition is shown in Figure 1. It consists of three main modules: the single-chip processing module, which consists of the STC12C4A60S52 single-chip computer and its peripheral circuits; the U disk reading and writing module, which consists of the CH375 and its peripheral circuits; and the audio decoding module, which consists of the VS1003 chip and its peripheral circuits.
The working process of the player is: MCU reads data from the USB storage device through CH375, and according to the control instructions of the function key, sends the relevant data of the USB storage device to the audio decoding module, and after decoding by VS1003, sends it to the speaker or earphone. Set up 6 human-computer interaction function keys to realize basic operation functions such as play, pause, previous song, next song, increase volume, and decrease volume.
2 Hardware circuit design
As shown in Figure 1, the circuit design of the three modules of U disk reading and writing, single-chip microcomputer processing and audio decoding is mainly completed.
2.1 U disk reading and writing module
The U disk reading and writing module consists of CH375 and its peripheral circuits, and its composition is shown in Figure 2.
CH375 is a USB bus universal interface chip that supports USB host and slave modes. On the local side, CH375 has an 8-bit data bus and read, write, chip select control lines and interrupt output, which can be easily connected to the system bus of microcontrollers/DSP/MCU/MPU and other controllers. In USB host mode, CH375 also provides serial communication mode, connecting with microcontrollers/DSP/MCU/MPU and other controllers through serial input, output and interrupt output. [page]
The USB host mode of CH375 supports commonly used USB full-speed devices. The external microcontroller can communicate with the USB device through CH375 according to the corresponding USB protocol. CH375 also has built-in firmware for processing the dedicated communication protocol of Mass-Storage mass storage devices. The external microcontroller can directly read and write commonly used USB storage devices with sectors as the basic unit.
In the design, CH375 adopts the host mode. J1 in the figure is a USB socket, which can be connected to storage devices such as U disks. D1 is an indicator LED, which lights up when a USB device is detected to be connected. When the TXD pin is connected to the ground, CH375 works in parallel mode. At this time, JP1 interface D0~D7 in the figure is a bidirectional data bus connected to the microcontroller.
The microcontroller is connected to the JP2 interface in the figure and controls CH375 through the program. Its functions and characteristics are shown in Table 1.
The microcontroller controls CH375 by writing commands and data, and obtains USB data through CH375. CH375 has built-in firmware programs that automatically handle USB and other protocols. The microcontroller can directly obtain the data of the USB sector through CH375, so it only needs to process the FAT file system layer to operate the USB file.
2.2 MCU module
The MCU module consists of the STC12C4A60S52 microcontroller and its peripheral circuits. STC12C5A60S2 is a single-clock/machine cycle microcontroller produced by Hongjing Technology. The instruction code is fully compatible with the traditional 8051, but the speed is 8 to 12 times faster. It provides 60 kByte of Flash program memory, 1 kByte of EEPROM, and 1 280 Byte of RAM on chip. The operating voltage is 5.5~3.5 V, and it integrates MAX810 dedicated reset circuit, 4 timers, 2 serial ports, 2 PWM channels, 8 high-speed 10-bit A/D conversion, ISP/IAP, built-in watchdog circuit, external power-off detection circuit, etc.
Figure 3 is the hardware circuit schematic diagram of the player MCU module, where JP4 is the power input interface, D1 is the power indicator, and the resistor Rp1 is the pull-up resistor of the P0 port. JP2 and JP3 are connected to the corresponding interface of the USB read/write module. Since the microcontroller works under a 5 V power supply and the VS1003 works under a 3.3 V power supply, the working P1 port should be connected to a current limiting resistor to JP1 and then to the corresponding interface of the audio decoding module. The circuit is set with 5 function buttons, "UP" for increasing the volume, "DOWN" for decreasing the volume, "LEFT" for selecting the previous song, "DOWN" for selecting the next song, and "PLAY" for the play/pause button.
2.3 Audio decoding module
The audio decoding module consists of the VS1003 chip and its peripheral circuits. VS1003 is a single-chip MP3/WMA/MIDI audio decoder and ADPCM encoder. It contains a high-performance, low-power DSP processor core VS_DSP, working data memory, 5 kB instruction RAM and 0.5 kB data RAM for user applications, serial control and data interface, 4 general-purpose I/O ports, 1 UART, 1 high-quality variable sampling rate ADC and stereo DAC, 1 headphone amplifier and ground buffer.
VS1003 receives the input bit stream through a serial interface and can be used as a system slave. The input bit stream is decoded and then reaches an 18-bit oversampling multi-bit ε-△ DAC through a digital volume controller. VS1003 controls the decoder through a serial bus. In addition to basic decoding functions, other special applications can be done in the user RAM, such as DSP sound processing.
Figure 4 is the schematic diagram of the VS1003 peripheral hardware circuit of the player, where AVDD is the analog positive power supply 3.3 V, CVDD is the digital positive power supply 2.5 V, IOVDD is the I/O positive power supply 3.3 V, and the analog ground and digital ground are isolated by 0 resistors. J1 and J2 are both 3.5 audio sockets, J1 is audio output, and J2 is audio input.
The microcontroller sets the VS1003 chip by writing to the VS1003 register and writes data to the VS1003 data buffer to decode it.
[page]
3 Software program flow chart
The MCU program mainly solves two problems: reading CH375 data and writing VS1003 registers for playing music. Among them, the five functions correspond to the five function keys in Figure 3. The software program flow chart is shown in Figure 5.
4 Conclusion
As shown in the figure, in order to separate the audio processing function from the computer and expand the scope of use of the U disk, a player circuit for U disk audio file data processing is designed, and the relevant program is written in C language. The circuit is mainly composed of 3 modules, among which the main controller uses the enhanced 51 single-chip microcomputer STC12C5A60S2, the voice decoding chip uses the VS1003 of the Finnish VLSI company, and the USB device interface chip uses the CH375 of Nanjing Qinheng Company. The USB host mode is adopted, and the external single-chip microcomputer does not need to process the USB protocol, and can directly read and write common USB storage devices with sectors as the basic unit.
The actual operation results prove that the player fully meets the design expectations, the U disk is plug-and-play, and it can not only play MP3 files, WMA files, and MIDI files in the specified directory of the U disk, but also can be controlled by buttons to realize various functions. The cost performance of the entire system circuit is high and has strong extensibility.
Previous article:Analysis of LED dimming system circuit based on STC89C52/MAX1771
Next article:Design and implementation of educational robot based on STC12C5A60S2
Recommended ReadingLatest update time:2024-11-16 14:25
- 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