Design of USB audio player based on STC12C5A60S2

Publisher:SparklingBeautyLatest update time:2012-11-08 Source: 现代电子技术 Keywords:STC12C5A60S2  VS1003 Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere
U disk is a flash drive, which is a medium that uses flash memory to store data, usually using a USB plug. U disk is small, light, hot-swappable and can be rewritten. Since its launch, it has quickly become popular and replaced traditional floppy disks, becoming the main portable storage mode. As the size of U disk continues to decrease and the storage capacity continues to increase, the scope of use of U disk is also expanding. However, the data stored in U disk is still mostly extracted and processed by computers, which also limits the development scope of U disk.
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.

a.jpg


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.

b.jpg


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.

c.jpg


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.

d.jpg


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.

e.jpg


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.

f.jpg



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.

Keywords:STC12C5A60S2  VS1003 Reference address:Design of USB audio player based on STC12C5A60S2

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

Design of MP3 player based on VS1003 decoder
introduction Although there are more and more styles of MP3 players on the market, with more and more functions and more personalized and user-friendly appearance, most of the existing MP3 players still integrate the decoder and the memory. This design plays a key role in the portability of MP3 players, but
[Microcontroller]
Design of MP3 player based on VS1003 decoder
How to calculate stc12c5a60s2 crystal oscillator frequency
The STC12C5A60S2/AD/PWM series microcontroller is a single clock/machine cycle (1T) microcontroller produced by Hongjing Technology. It is a new generation of 8051 microcontroller with high speed/low power consumption/super anti-interference. The instruction code is fully compatible with the traditional 8051, but the
[Microcontroller]
How to calculate stc12c5a60s2 crystal oscillator frequency
Design of automatic batching control system based on STC12C5A60S2
  1. Introduction   In large-scale industrial production, materials need to be weighed and proportioned. At present, factories generally use two methods. The first method uses manual weighing, and then puts various raw materials in proportion into the batching machine at the same time for mixing; the other method is
[Microcontroller]
Design of automatic batching control system based on STC12C5A60S2
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
Guess you like

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号