Design of embedded MP3 player based on embedded file library

Publisher:SereneHarmonyLatest update time:2016-09-19 Source: eefocus Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere
0 Preface

In recent years, with the development of digital technology, people's requirements for MP3 players have become more and more diversified. Manufacturers have made a lot of efforts and designed a variety of solutions in the selection, design, development, additional functions and application fields of MP3 players. With the trend of faster and faster processors and larger storage capacities, the storage organization form and memory settings of data in products need to be managed efficiently and reasonably, which is exactly the function of the file system.

The open source software project Embedded File System Library (EFSL) is very suitable for solving the problems of storage space management and function expansion of small microcontrollers as an embedded file system due to its advantages such as small memory requirements, simple porting, and being completely free. This paper designs a new embedded MP3 player based on the EFSL file system and the ARM platform, which has certain practical value. At the same time, it provides a feasible reference solution for the microcontroller to break free from the constraints of the operating system and realize the multimedia application of the microcontroller.

1 Hardware Design

The hardware structure diagram of the system is shown in Figure 1. The entire hardware system uses the LPC2148 of the PHILIPS ARM7-TMDI core as the core processor, which controls the VS1003 decoding module, SD card interface module, USB interface module and human-computer interaction function module respectively. Figure 1 Hardware structure diagram of the MP3 player

1.1 Main control chip

LPC2148 is a 16/32-bit ARM7TDMI-S microcontroller that supports real-time simulation and embedded tracing. It has an embedded 512 KB high-speed FLASH memory. Its powerful functions 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. The decoding module VS1003 integrates VS_DSP processor, stereo audio DAC and stereo headphone amplifier driver. Since the decoding and control chips are separated, the sound quality is good and the control is relatively simple. LPC2148 controls VS1003 through its SPI interface.

1.2 Display Module

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

1.3 Storage Module

The SD card is used as the storage medium, which has the advantages of large capacity, small size and vibration resistance. All songs are stored in the SD card, which works in SPI mode. The SSP of LPC2148 is connected to the SD card by setting it to SPI function. At the same time, the other two I/O ports of the chip are set to the detection pins for whether the card is fully inserted into the card holder and whether the card is write-protected.

2 Software Design

The player uses a four-layer structure to implement its functions. The software hierarchy is shown in Figure 2. The main purpose of modularization is to facilitate module portability. Figure 2 Player software hierarchy

2.1 Development Environment Construction

The development environment is mainly based on The Rowley Cross StudioIDE for EFSL compilation. CrossWorks for ARM1.6 uses the GCC 4.1 compiler. Install CrossWorks forARM 1.6 software and import the MP3Player.hzp project file. The project file already contains the files in the motherboard and the device configuration file.

After Rowley Cross Studio IDE automatically loads all files, all major folders will be displayed: Audio Render Driver folder (contains DAC audio processing related code), Demo Player folder (main module, which can be configured and modified as needed), EFSL folder (stores the EFSL embedded file system, through which the player software can read and write MP3 files in the MMC storage card), EFSL Driver folder (stores the basic read and write operation driver of the storage device), Libmad folder (main encoding file, the relevant code can be changed as needed to meet the Libmad configuration requirements).

2.2 File system configuration and compilation function module

The file system configuration and compilation function module performs software configuration and file system compilation.

2.2.1 Set the project file path

Use the command line tool to find the project file and include files. The path is: Add the MP3Player project to the preprocessing tab configuration file in the ARM Flash Release and ARM Flash Debug Option windows.

2.2.2 Compiler Configuration

Since the fixed-point digital calculation requirements are very high and the extended digital instruction set can only run on 32 bits, the code compilation also needs to be compiled in a 32-bit environment, and the USB memory RAM and its stack allocation need to be used [5]. USB RAM generally does not run in the LPC214X environment, but the Rowley Cross Studio IDE has provided initialization for this hardware device. Philips_LPC2148_startup.s is created and placed in the MP3 player project directory to support the USB RAM device. It is also necessary to add stack allocation code to the memory part of the USB DMARAM in the code.

2.2.3 Libmad file configuration

Libmad can run a library on different platforms and provide better optimization for ARM7. Its compiler also needs to set the system running environment variables.

2.2.4 Configuring EFS Files

The debug.h file in the MP3Playerefslinc directory supports semihost debugging. All debug messages can be set and displayed through the I/O terminal window of the JTAG debugger. The RAM memory usage level and buffer size can be set through the config.h configuration file in the MP3Playerefslconf directory.

2.2.5 Configuring system files

Since the file initialization requires a good LPC2148 operating environment, it is necessary to increase the LPC2148 to its maximum performance (60Hz), and at the same time, it is necessary to enable the PLL function, set the IRQ interrupt management timer to 0 and the VPB divider to 1. At the same time, Philips_LPC2148_Startup.s must include relevant preprocessor compilation instructions. To set the compiler instructions in the IDE, just select the Philips_LPC2148_Startup.s file in the project browser window, then select the Preprocessor tab, and fill in the Preprocessor Definition property.

2.2.6 Compiling batch files

To compile batch files, you need two files, one is the project file MP3Player, and the other is the RowleyCross Studio file for ARM Rowley Associates Limited. The Cross-Works for ARM 1.6 file can batch process files by itself:

build_all_debug.bat,build_all_release.bat.

3 System Process

After the system starts, the hardware module is initialized first. LPC2148 reads some basic information of the SD card, such as capacity, sector size, FAT table, and the starting sector where the root directory is located. After obtaining this information, it is possible to find out whether the SD card has music files that can be played. If there are music files, the microprocessor will read the audio information of the file through the SPI bus, and send the song's code stream information to the VS1003 chip. Through the decoding of the VS1003 chip and its built-in high-quality stereo DAC and headphone drive circuit, the MP3 song playback function is realized. The software system flow chart is shown in Figure 3. Figure 3 Software system flow chart

4 Debugging

The Main.c file (source code omitted) shows the working process of the MP3 player. The init_IO() function initializes the LPC2148 timer 0, generates periodic interrupts, and starts some data structures. The periodic interrupt rate must be the same as the decoder data stream, and then efs_init (&efs, "") calls the MP3 file. If the file cannot be found, the "Could not open filesystem" parameter will be passed to the CrossStudio IDE through the JTAG interface, otherwise the file information will be displayed normally. The file processing result is shown in Figure 4. The debugging display information shows that the file information can be displayed normally. In addition, after physical production and testing, this MP3 player can play MP3 files in the SD card smoothly, which verifies that this design is correct and feasible. Figure 4 Debug terminal display information

5 Conclusion

This paper designs an MP3 player based on the open source software project EFSL, introduces the hardware and software architecture of the player system, and the porting and modification of EFSL related code sources. The feasibility of the design is verified through CrossWorks for ARM 1.6 software debugging. The entire design reflects the advantages of simple porting and convenient configuration of EFSL code sources.

Reference address:Design of embedded MP3 player based on embedded file library

Previous article:Design of video intercom system based on Android platform
Next article:Design and implementation of LED dot matrix screen based on STM32

Latest Microcontroller Articles
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号