MP3 player design (Figure)

With the widespread use of digital sound as a method of storing, processing and transmitting high-fidelity sound in the field of consumer electronics, the related digital audio compression technology has also been fully developed, the emergence of MP3 music format and the increasing Internet. Popularization has pushed digital music to a climax. The way MP3 compresses music is to remove the high-frequency and low-frequency parts of the sound through an algorithm, greatly reducing the unnecessary waste of capacity, while retaining the audio part that humans can feel, so the advantage is that the digital sound is greatly reduced. The capacity of the file without damaging the original sound quality. The lower the sound quality, the higher the compression ratio can be obtained under the MP3 algorithm. This paper studies the application of digital audio technology in embedded systems, and gives the software and hardware design of embedded MP3 playback system.

system structure


The whole system includes the main control MCU (LPC2148), decoder, DAC (VS1003), SD card, button, OLED and lithium battery. The block diagram is shown in Figure 1. The PC manages the SD card through the USB interface and stores data information such as MP3 songs and documents. After the system is started, the MCU control sends the code stream information of the song stored in the Flash to the VS1003 chip, and realizes the playback function of the MP3 song through the VS1003 chip decoding and the high-quality stereo DAC and the headphone driving circuit. Under the control of the button, the function of song play mode and song selection is realized through the selection of the menu option in the OLED; while playing, the information displayed on the OLED includes the power of the system power supply battery in addition to the scrolling song name information. And song playback mode, etc.

Figure 1 system hardware block diagram

hardware design


1 power module


The MAX1811 is a charging chip for a highly integrated single-cell Li+ battery that can be powered directly from the USB port. The charging circuit is shown in Figure 2. The charging current of this system should be set to 500mA, and the SELV pin is set high. The MAX1811 chip is configured to charge Li+ battery to 4.2V. The CHG terminal allows the chip to illuminate the LED during charging.

Figure 2 Li+ battery charging circuit


Since the single discharge voltage of the Li+ battery is 3.6V, which is not suitable for the operating voltage of other chips, it is necessary to add the LDO chips SPR6200 and SPR6201 to reduce the voltage to 3.3V and 2.7V, respectively.


2 master chip


The LPC2148 is a 16/32-bit ARM7TDMI-S microcontroller that supports real-time emulation and embedded tracking. It embeds 512KB of high-speed flash memory, which is powerful enough to facilitate future system upgrades. In this system, only USB, SPI, SSP interface functions and ADC functions are used temporarily, and the use of other functions is subject to expansion.


3 decoding module


The VS1003 decoder chip integrates a VS_DSP processor, a stereo audio DAC, and a stereo headphone amplifier driver. Since the decoding is separated from the control chip, the sound quality is good and the control is relatively simple.


The LPC2148 controls the VS1003 through its SPI interface. Figure 3 shows the hardware connection diagram of the LPC2148 and VS1003.

Figure 3 LPC2148 and VS1003 connection circuit


4 display module


VGS12864E is a OLED monochrome, character, and graphic display module with 128×64 line matrix. The module has 64×64 display data RAM, each of which corresponds to the light and dark state of a dot on the OLED screen; its command system is compatible with the liquid crystal display drive controller HD61202. The system uses 8-bit I/O port to connect with OLED module 8-bit data bus D0~D7 through analog timing, and then through 3-bit I/O port and LCD command control or data operation bit RS, read/write control bit R /W is connected to the enable control bit E to control the OLED module.


5 storage module


The advantage of using an SD card as a storage medium is that it has a large capacity, a small volume, and vibration resistance. The songs are all stored in the SD card, and the SD card works in SPI mode. Connect to the SD card by setting the SSP of the LPC2148 to the SPI function. At the same time, the other two I/O ports of the chip are respectively set to the detection pins that the card is fully inserted into the deck to detect whether the pin and the card are write-protected. Figure 4 shows the interface circuit of the SD card, in which VSS1, VSS2 are connected to GND to ground; DAT1 and DAT2 are connected to 10kΩ pull-down resistors; 10 and 12 pins are connected to an I/O of LPC2148 after a resistor of about 100Ω, and pass through a 10kΩ resistor. Pull-up; at the same time, the 3 and 8 pins are also pulled up by resistors.

Figure 4 SD card interface circuit

software design


The software design of this system includes three parts: display program, SD card reading and writing program and MP3 player. Figure 5 shows the overall design flow of the software.

Figure 5 software overall design flow chart


1 display program


The system uses an OLED dot matrix display without characters and graphics, so the system service program includes graphics and display driver control for Chinese and English characters. Figure 6 is a software flow of the display module. The display program entry parameter is a character encoding, and the type of the character is determined according to the encoding, and different look-up table base addresses are set according to different types of characters (symbol, ASCII code, and Chinese characters). Then, the character code value is used as the table lookup offset address to obtain the display dot matrix data of the character and stored in the display buffer, and finally the execution program is called to complete the character display refresh. The display program also provides a table lookup interface for all ASCII characters and Simplified Chinese. The word library is stored in Flash inside the LPC2148. Since the highest voltage of A/D of LPC2148 can't exceed 3.3V, Li+ battery voltage is divided into resistors and sent to A/D port. The value after readout and conversion is also sent to OLED proportional display battery power supply. .

Figure 6 Software flow chart displayed by the OLED module


2 SD card reader program


The LPC2148 has a USB device controller that is fully compatible with the USB 2.0 specification. Configure the relevant registers inside the chip to enable only the logical endpoints 0 and 2 inside the chip, which support control transfer and bulk transfer in the USB protocol respectively. Then initialize the USB port related drive parameters and try to establish communication with the PC.


3 MP3 player


The VS1003 mainly receives the LPC2148 control commands and MP3 data through the Serial Command Interface (SCI) and Serial Data Interface (SDI). Confirm that the interface is in the transmit state by setting the high and low of the xCS and xDCS pins.
For the VS1003 chip's function control, such as initialization, soft reset, pause, volume control, playback time reading, etc., are implemented by SCI write to a specific register. The DREQ pin signal is used between the two SCI instructions to determine whether the last processing is completed.


The data stream of the MP3 file is transmitted through SDI. SDI can work in two modes: native mode and compatibility mode, which are selected by the SM NEWMODE bit in the register. This system uses native mode, compatibility mode is only for compatibility with previous chips. Figure 7 is a data stream processing procedure. First, the MP3 data transmitted through the SDI is decoded by the decoder, and then the decoded data is sent to the bass and treble booster according to the contents of the SCI BASS register, and then sent to the sound control unit, and then sent to the audio FIFO. The data in the audio FIFO is converted to the same rate by the sample rate and sent to the DAC.

Figure 7 data flow processing flow chart


If the audio FIFO has enough space, the VS1003 will issue a high-level DREQ data request signal to indicate that it can receive at least 32B of data. If the data of the input decoder is invalid or the transfer speed is not enough, the VS1003 chip will automatically perform mute processing.

Conclusion


This MP3 player solution also enables audio file playback in PlusV/WAV/ADPCM/WMA/MIDI format. The experimental results are debugged on the circuit board, and the MP3 music is played smoothly and the sound quality is good. In addition, if the VS1003 upgrade chip VS1033 is used, the system can be directly upgraded to an AAC player without changing the circuit.



:
2 times
Window._bd_share_config = { "common": { "bdSnsKey": {}, "bdText": "", "bdMini": "2", "bdMiniList": false, "bdPic": "", "bdStyle": " 0", "bdSize": "24" }, "share": {}, "image": { "viewList": ["qzone", "tsina", "tqq", "renren", "weixin"], "viewText": "Share to:", "viewSize": "16" }, "selectShare": { "bdContainerClass": null, "bdSelectMiniList": ["qzone", "tsina", "tqq", "renren" , "weixin"] } }; with (document) 0[(getElementsByTagName('head')[0] || body).appendChild(createElement('script')).src = 'http://bdimg.share. Baidu.com/static/api/js/share.js?v=89860593.js?cdnversion=' + ~(-new Date() / 36e5)];

Wall mounted Solar Air

Panel Air Conditioner ,Solar Air,Wall Split Air Conditioner 

Sunflower Renewable Energy Co., Ltd. , http://www.newestsolar.com

Posted on