| The Datasheet Archive - 100 Million Datasheets from 7500 Manufacturers. |
Realizing player with LPC2148, using libmad EFSL Rev. April 2007
Top Searches for this datasheetAN10583 Realizing player with LPC2148, using libmad EFSL Rev. April 2007 Application note Document information Info Keywords Content MP3, player, codec, decoder MP3, Layer Layer Layer III, libmad, MAD, EFSL, Embedded File System Library, MMC, card, card This document describes design player using LPC2148 Abstract Semiconductors AN10583 LPC2148 based player Revision history Date 20070418 Description Initial version Contact information additional information, please visit: http://www.nxp.com sales office addresses, please send email salesaddresses@nxp.com AN10583_1 B.V. 2007. rights reserved. Application note Rev. April 2007 Semiconductors AN10583 LPC2148 based player Introduction Thank choosing LPC2000 family your application! This Application Note describes integrate libmad MPEG layer library Embedded File System Library EFSL LPC2148 device realize player. Keil MCB2140 board used test application Rowley CrossStudio been chosen reference tool-chain. player software package available download under title LPC2148-Based Player Software Package. About libmad high-quality MPEG audio decoder library. currently supports MPEG-1 MPEG-2 extension lower sampling frequencies, well facto MPEG format. three audio layers Layer Layer Layer (i.e. MP3) fully implemented. following special features: 24-bit output fixed-point (integer) computation completely implementation based ISO/IEC standards available under terms General Public License (GPL) more information about libmad please refer Although libmad license doesn't mean that algorithm used application without paying fee. Royalties must paid. more info please refer your application needs fully open, non-proprietary, patent-and-royalty-free, generalpurpose codec please consider Vorbis Speex solutions. more info please refer this demo libmad version 0.15.1.b library used. Some specific modifications standard libmad files have been done reach following goals: reduce amount memory used libmad match LPC2148 memory constrain. eliminate dynamic malloc()/free() functions About EFSL EFSL project aims create library filesystems, used various embedded systems. Currently EFSL supports Microsoft filesystems family. library currently supports FAT12/16/32 reading writing SD-cards. EFSL's intent create pure ANSI code that compiles anything that bears name compiler'. Adding code your specific hardware straightforward. Just code that fetches writes 512-byte sector, library will rest. Existing code course used, code only required when have hardware which target exists. example, support secure digital cards mode. EFSL been ported LPC2000 family. more info about EFSL please refer EFSL available under General Public License with exception clause. AN10583_1 B.V. 2007. rights reserved. Application note Rev. April 2007 Semiconductors AN10583 LPC2148 based player About LPC2148 16/32-bit LPC2000 family based ARM7TDMI-S core operating together with wide range peripherals including serial interfaces, 10-bit ADC/DAC converter external options. moment which example written LPC2148 only device suitable realize cost player based free libraries. However, today, powerful device, LPC2888 appearing market. This device used realize cost, high quality player integration stereo high quality 16-bit codec. those applications which audio quality main point, LPC2148 used create mono, cost, single chip player. This example, course, used reference start development LPC2888 device. more detail LPC214x family please refer website more detail LPC2888 please refer website About Keil MCB2140 Keil MCB2140 evaluation board designed Keil, company. Keil MCB2140 evaluation board introduces LPC2140 family allows create test working programs this advanced architecture. Keil MCB2140 evaluation board connects your using serial port (the utility downloaded under title LPC2000 Flash Utility, V2.2.3), JTAG interface. on-chip interface, serial interfaces, speaker, analog input (via potentiometer), eight LEDs make this board great starting point your next project. this demo speaker SD/MMC card connector, interfaced serial port, have been used design player. more detail MCB2140 board please refer Keil site About Rowley CrossStudio CrossStudio complete C/C++ assembly code development system ARM7, ARM9, XScale, Cortex-M3 micro-controllers. based Assembler toolchain from Compiler Collection. this demo Wiggler cost emulator used. schematic emulator available file section Yahoo LPC2000 public site. more info about wiggler commercial emulators refer more info about Rowley CrossStudio refer more info about Yahoo LPC2000 newsgroup refer this demo Rowley CrossStudio v1.6 (with v4.1.0 compiler behind IDE) been chosen. Limitations demo LPC2148 10-bit converter without digital interpolator analog output reconstruction filter. used rendering audio output device. AN10583_1 B.V. 2007. rights reserved. Application note Rev. April 2007 Semiconductors AN10583 LPC2148 based player means that sample rate 10-bit equal sample rate output stream generated decoder. With this approach audio quality only mono channel supported because LPC2148 only DAC, only mono audio channel supported. Because files often created stereo format, need convert them mono version before storing memory card. free license tool MediaCoder possible choice realize this conversion activity. more info MediaCoder please refer must formatted FAT32 FAT16 filesystems. increase audio quality suggest connecting additional external audio LPC2148. Memory requirements EFSL libmad libraries consume memory work. amount memory about: Table Memory requirements player demo [kB] Libmad EFSL Code [kB] Because LPC2148 only user demo requires more than RAM, additional USB/user RAM, fully allocated stack libraries data structures. Therefore user additional (25K User total used) used this demo. rest user reserved user application. these memory values Rowley CrossStudio v1.6 (with 4.1.0 compiler behind IDE) used option selected Additional Compiler Options tab. modules have been compiled 32-bit code mode. [Select Project->Proprietary then chose Compiler finally Additional Compiler Options field Rowley CrossStudio ARM] AN10583_1 B.V. 2007. rights reserved. Application note Rev. April 2007 Semiconductors AN10583 LPC2148 based player General notice This document intended application guideline, this means that some cases depending requirements application there room change some software modules application designer. This program (the module this application that part Libmad EFSL) free software; redistribute and/or modify under terms General Public License published Free Software Foundation; either version License, your option) later version. This program distributed hope that will useful, WITHOUT WARRANTY WITHOUT SUPPORT; without even implied warranty MERCHANTABILITY FITNESS PARTICULAR PURPOSE. rest modules (Libmad EFSL) referred related licenses. General Public License more details. should have received copy General Public License along with this program; not, write Free Software Foundation, Inc., Temple Place, Suite 330, Boston, 02111-1307 AN10583_1 B.V. 2007. rights reserved. Application note Rev. April 2007 Semiconductors AN10583 LPC2148 based player player components Before describing configuration EFSL libmad decoder libraries, following block diagram shows hardware structure player MMC/SD cards Keil MCB2140 board Amplifier ARM7 Speaker LPC2148 Keil MCB2140 board MCB2140 populated small speaker MMC/SD card connector, used hardware platform realize player. additional memory card inserted MMC/SD card connector file storing. firmware player stored LPC2148 embedded flash memory. LPC2148 single channel used convert decompressed stream analog audible mono signal. EFSL library functions dedicated open, read, write files (and much more) stored memory card that been formatted FAT32 FAT16 filesystems. user format card using other appliance, store files (mono version) memory card finally place memory card slot MCB2140 board. specific software driver LPC2000 family available public site. file read from memory card frame pieces (frame length range 1500 this value change depending content file) delivered decoder. output decoder decompressed frame that pushed software FIFO buffer. software FIFO fetched periodically interrupt service routine that sends samples LPC2148 DAC. Setup environment Rowley Cross Studio environment been chosen compile libmad EFSL. Rowley Crosswork V1.6 environment uses compiler V4.1.0. This paragraph shows configure environment also compile libraries using command line compiler. After installing launching Rowley CrossStudio following window appears: AN10583_1 B.V. 2007. rights reserved. Application note Rev. April 2007 Semiconductors AN10583 LPC2148 based player Rowley Cross Studio project file that includes libraries device settings LPC2148 Keil MCB2140 board been created file: MP3Player.hzp Please select File->Open Solution from Rowley CrossStudio select MP3Player.hzp project directory. loads files used MP3Player project. what looks like AN10583_1 B.V. 2007. rights reserved. Application note Rev. April 2007 Semiconductors AN10583 LPC2148 based player player demo project loaded CrossStudio Source files have been grouped different sections. audio Render Driver section contains code related audio render device. modify code, example, include support from external high-quality audio DAC. section Demo Player: shows main module that describe detail later AN10583_1 B.V. 2007. rights reserved. Application note Rev. April 2007 Semiconductors AN10583 LPC2148 based player section EFSL includes modules used manage Embedded File System Library. This library enables demo.c module open read files from external memory card. driver that manage level functions been confined EFSL driver section Excluding configuration settings library EFSL changes have been made file contents this library. libmad section groups module related libmad library mp3_play(&file) only function demo.c main program that access libmad functionalities. Libmad source code changed match goals described AN10583_1 B.V. 2007. rights reserved. Application note Rev. April 2007 Semiconductors AN10583 LPC2148 based player paragraph "About Libmad". According license constraints modifications described follows: module synth.c functions synth_full synth_half have been modified reduce memory requirement cutting output pcm.samples buffer. buffer replaced with direct access audio render FIFO declared module io_lpc.c. This FIFO defined manage only mono-audio signal. Because pcm.samples[ch] buffer store 9216 bytes stereo channel, this change saves 7168 bytes application case mono audio signal managed. reach this target order which "for" cycles executed these functions been swapped. Because synth.c module access directly audio render, function output module midmad became unnecessary, still there because presence output toggle command TOGGLE_LIVE_LED0(). module synth.c function mad_synth_frame been changed insert call When output sample frequency been detected decoder, suddenly this information sent audio render. malloc()/free() functions modules decoder.c stream.c layer3.c have been cancelled replaced with reference static structures always allocated memory. module midmad.c additional mp3_play() function been created hide details (software encapsulation) libmad implementation libmad user. reader should also consider that only SYNC mode feature libmad been implemented this demo. System files used initiate LPC2148 device proper way. System Files grouped System Files section Project Explorer window Configuring compiler linker proper operation Although setting options have been included MP3Player.hzp project file, short walk through settings help developing/porting phase. 3.1.1 Global directories settings Command line tools must find project files include files. following additional paths: $(ProjectDir)/render-driver $(ProjectDir)/libmad $(ProjectDir)/efsl/inc $(ProjectDir)/efsl/conf AN10583_1 B.V. 2007. rights reserved. Application note Rev. April 2007 Semiconductors AN10583 LPC2148 based player Configuring project directories paths have been added User Include Directories field Preprocessor Project Options window both Flash Release Flash Debug profiles. additional DEBUG #undef directive (Preprocessor tab), .hex file creation option (Linker tab), Include Debug Information option (Build tab), have been added only Flash Release profile. DEBUG #undef option blocks JTAG message sending channel when code deployed production (semi-hosting feature debugger disabled). Project Profiles Rowley CrossWork Moving between profiles possible selecting Flash Debug Flash Release options from upper left combo-box CrossStudio IDE. 3.1.2 Configuring compiler code compiled 32-bit mode because amount fixed-point math calculation very high need extended math instruction only available 32-bit mode. Memory used stack allocated there. working default LPC214x must switched standard Philips_LPC210x_startup.s that provided Rowley CrossStudio been changed take account this additional hardware initialization Philips_LPC2148_startup.s file been created placed MP3Player project directory. Philips_LPC2148_startup.s includes small piece code that enables internal RAM, however, programmer should also inform linker stack section memory section placement. Please refer Rowley CrossStudio documentation more information about memory segments placement. AN10583_1 B.V. 2007. rights reserved. Application note Rev. April 2007 Semiconductors AN10583 LPC2148 based player Compiler options accessible selecting Proprietary option MP3Player project Project Explorer Window. indicates options both Flash Release Flash Debug profiles. Configuration settings compiler 3.1.3 Configuring linker linker accessible Project Option window. only difference between options Flash Release Flash Debug profiles additional .hex file created Flash Release section. Please note that stack size placement stack defined flash_placement.xml file. Because standard Rowley flash_placement.xml file changed move stack from Internal SRAM section specific flash_placement.xml been defined imported MP3Player project directory final parameter linker shown AN10583_1 B.V. 2007. rights reserved. Application note Rev. April 2007 Semiconductors AN10583 LPC2148 based player Linker settings Configuring EFSL libmad libraries Libraries must configured proper operation with ARM7 LPC2148. 3.2.1 Configuring libmad files related libmad library have been grouped libmad section Project Explorer window. Libmad library that different platforms, optimized ARM7. complier must aware about environment which library operates. This done using following compiler directives: FPM_ARM SIZEOF_INT=4 SIZE_LONG=4 SIZE_LONG_LONG=8 architecture used Integers data types bytes long Long data types bytes long Long long data types bytes long ASO_IMDCT optimized ARM7 assembly module used calculate DCT*/ AN10583_1 B.V. 2007. rights reserved. Application note Rev. April 2007 Semiconductors AN10583 LPC2148 based player this compiler directive just select libmad folder Project Explorer windows, then right mouse click select Properties menu option, select Preprocessor tab, fill Preprocessor Definitions field. Configuring libmad 3.2.2 Configuring Library files related library have been grouped EFSL section Project Explorer window. debug.h file stored MP3Player\efsl\inc directory been changed support semi-hosting feature debugger. following piece code shows that debug messages will sent, JTAG, terminal windows debugger. debug_printf function provided Rowley library realize that function: #ifdef HW_ENDPOINT_LPC2000_SD #include <_cross_studio_io.h> #define TXT(x) #define DBG(x) debug_printf #define FUNC_IN(x) #define FUNC_OUT(x) #define debug debug_printf keep memory usage minimum level, number buffers EFSL been reduced minimum some definitions file config.h stored \.MP3Player\efsl\conf directory have been changed: #define IOMAN_NUMBUFFER #define IOMAN_NUMITERATIONS #define IOMAN_DO_MEMALLOC byte used LPC2148 following memory cards used application tests: AN10583_1 B.V. 2007. rights reserved. Application note Rev. April 2007 Semiconductors AN10583 LPC2148 based player SunDisk RS-MMC Transcend MMCplus SunDisk card interface connected MMC/SD card slot generate data clock about normal data transfer mode less that during initialization phase (see specs). Configuring system files system files initialize LPC2148 proper operating condition. MP3player demo needs full power LPC2148. Therefore LPC2148 must operate maximum speed MHz) switch configuring PLL. must powered, interrupt must handled manage timer divider small piece assembly code been added Philips_LPC2148_Startup.s assembly module: Activate Additional defined(USE_USB_RAM) =PCONP [R0] #PCONP_Val [R0] #endif Philips_LPC2148_Startup.s must compiled including following preprocessor directives: USE_USB_RAM VECTORED_IRQ_INTERRUPTS VPBDIV_VAL=1 STARTUP_FROM_RESET PINSEL1_VAL=0x000080000 used application Fast management Timer runs with clock Connect output this compiler directives just select Philips_LPC2148_ Startup.s file Project Explorer windows, then right mouse click select Properties menu option, select Preprocessor fill Preprocessor Definitions field with above values shown AN10583_1 B.V. 2007. rights reserved. Application note Rev. April 2007 Semiconductors AN10583 LPC2148 based player Configuring system startup file Compiler batch files compiler batch files have been created available project directory MP3Player. work properly, these batch files assume that following directory structure been created project files Rowley files. Project file directory "C:\ARM_Rowley\MP3Player" Rowley CrossStudio directory "C:\Program Files\Rowley Associates Limited\CrossWorks 1.6" There batch files: build_all_debug.bat Creates JTAG message oriented release build_all_release.bat Produces release version with .hex file release version creates production version project with MP3Player.hex file "C:\ARM_Rowley\MP3Player\ARM Flash Release" directory. your directory structure different always create batch files from Rowley CrossStudio IDE. [Select MP3Player Folder Project Explorer Windows, then mouse right click, then select Build Information menu option, finally copy past content Build Steps windows .bat file replacing "rm" command with "del" command.] AN10583_1 B.V. 2007. rights reserved. Application note Rev. April 2007 Semiconductors AN10583 LPC2148 based player player demo operation main.c file shows demo example works: include include include include include include include include include <stdio.h> <efs.h> <ls.h> <string.h> <targets/lpc214x.h> "lpc_io.h" "mad.h" "debug.h" "midmad.h" EmbeddedFileSystem efs; EmbeddedFile file; DirList list; unsigned char file_name[13]; unsigned size; main() init_IO(); if(efs_init(&efs,"\\")!=0) DBG((TXT("Could open filesystem.\n"))); return(-1); (ls_openDir(&list, &(efs.myFs), "/") DBG((TXT("Could open selected directory.\n"))); return(-2); while (ls_getNext(&list) (list.currentEntry.FileName[8] 'M') (list.currentEntry.FileName[9] 'P') (list.currentEntry.FileName[10] '3') DBG((TXT("Filename: %.11s (%li bytes)\n"), list.currentEntry.FileName, list.currentEntry.FileSize)); format_file_name(file_name, list.currentEntry.FileName); mp3_play(&file); file_fclose(&file); TOGGLE_LIVE_LED1(); else DBG((TXT("Could open file.\n"))); while fs_umount(&(efs.myFs)); return AN10583_1 B.V. 2007. rights reserved. Application note Rev. April 2007 Semiconductors AN10583 LPC2148 based player init_IO()initiates LPC2148 Timer generate periodic interrupts initiates some data-structures. rate periodic interrupts same decoded stream sample rate. This data stored header file. Then EFSL initiated invoking efs_init(&efs,"\\") function. error encountered demo stops execution sends message "Could open filesystem" CrossStudio JTAG interface. Because JTAG interface couldn't connected release standalone version this demo, different profiles have been created. root directory memory card explored while (ls_getNext(&list) while cycle. file name file size each file that extension printed through JTAG interface Debug terminal window CrossStudio Debugger shown Debug Terminal window Rowley CrossStudio messages appear only Flash Debug profile been selected. Finally each file found root directory opened then played invoking mp3_play(&file) function: mp3_play(&file); file_fclose(&file); TOGGLE_LIVE_LED1(); AN10583_1 B.V. 2007. rights reserved. Application note Rev. April 2007 Semiconductors AN10583 LPC2148 based player Output LEDs MCB2140 populated eight LEDs, five which used display status information player. LEDs connected port pins LPC2148 driven, only Flash Debug profile, following macros: #define TOGGLE_LIVE_LED0() #define TOGGLE_LIVE_LED1() #define TOGGLE_LIVE_LED2() #define TOGGLE_LIVE_LED3() #define TOGGLE_LIVE_LED4() #define SET_LIVE_LED4() #define CLR_LIVE_LED4() toggles P1.16 toggles P1.17 toggles P1.18 toggles P1.19 toggles P1.20 switch P1.20 switch P1.20 P1.16 LED0 toggles every decoded output frame. function TOGGLE_LIVE _LED0() placed module midmad.c, mad_flow_output function decoder. P1.17 LED1 toggles after execution each excerpt. function TOGGLE_LIVE _LED1() placed module demo.c, main() function demo. P1.18 LED2 toggles FIFO buffer that receives decoded output stream certain time empty. This means that power enough decode, real time, specific file. function TOGGLE_LIVE_LED2() placed lpc_io.c module function tc0. P1.19 LED3 toggles every time update interrupt service routine called. Because rate interrupt service routine calls equal frequency decoded output stream, example file encoded this frequency, LED2 toggles that frequency. function TOGGLE_LIVE_LED3() placed lpc_io.c module function tc0. P1.20 LED4 used this demo. Average usage usage depends parameters encoded file. most important parameters decoded output stream rate. Furthermore, length decoded output frame block also important: [ms] maximum block decoding time frame, [samples] decoder output block length (usually 1152 samples), [Ksamples/s] decoded stream rate, load CPUload[%] Td[ms] fd[Ksamples/s] /nb[samples] achieve maximum load minimum load testing files different input stream rate output sample rate. this testing following combination input/output stream frequency used: AN10583_1 B.V. 2007. rights reserved. Application note Rev. April 2007 Semiconductors AN10583 LPC2148 based player Table Input/output stream frequency Combination input output stream rate during performance tests Kbit/s input Ksample/s output Kbit/s input Ksample/s output Kbit/s input Ksample/s output Kbit/s input Ksample/s output Kbit/s input Ksample/s output Kbit/s input Ksample/s output Variable rate input (avg 92kbit/s) Ksample/s output Variable rate input (avg 71kbit/s) Ksample/s output Kbit/s input Ksample/s output Kbit/s input Ksample/s output Kbit/s input Ksample/s output Kbit/s input Ksample/s output Kbit/s input Ksample/s output Kbit/s input Ksample/s output Variable rate input (avg 57kbit/s) Ksample/s output Measured conditions are: operating frequency MHz, divisor Memory Accelerator Module switched measure maximum decoding time, output FIFO length been infinite. those conditions decoded output time maximum toggle time LED0 output signal. calculate load following equation used: load fd/nb 100. TOGGLE_LIVE_LED3(); macro tc0() function been deleted. course, audio mono signal used tests. Further development steps Some optimization activities start from this demo. example, tc0() interrupt service routine rewritten assembly language because very critical routine, well some math intensive functions libmad package like synth_half, synth_full, dct32. Libmad well-known library decode files. Libmad also used popular free player, however, last table, porting actual version libmad ARM7 (@60 MHz) loads from power, only audio channel decoded real time. Browsing found interesting alternative represented Helix Decoder suitable decode, real time, stereo stream. Additional audio codec also available, like AAC. these codecs have specific RCSL RPSL license. more info about this codec please refer patents list patents related found here: AN10583_1 B.V. 2007. rights reserved. Application note Rev. April 2007 Semiconductors AN10583 LPC2148 based player Legal information Definitions Draft document draft version only. content still under internal review subject formal approval, which result modifications additions. Semiconductors does give representations warranties accuracy completeness information included herein shall have liability consequences such information. Suitability Semiconductors products designed, authorized warranted suitable medical, military, aircraft, space life support equipment, applications where failure malfunction Semiconductors product reasonably expected result personal injury, death severe property environmental damage. Semiconductors accepts liability inclusion and/or Semiconductors products such equipment applications therefore such inclusion and/or customer's risk. Applications Applications that described herein these products illustrative purposes only. Semiconductors makes representation warranty that such applications will suitable specified without further testing modification. Disclaimers General Information this document believed accurate reliable. However, Semiconductors does give representations warranties, expressed implied, accuracy completeness such information shall have liability consequences such information. Right make changes Semiconductors reserves right make changes information published this document, including without limitation specifications product descriptions, time without notice. This document supersedes replaces information supplied prior publication hereof. Trademarks Notice: referenced brands, product names, service names trademarks property their respective owners. AN10583_1 B.V. 2007. rights reserved. Application note Rev. April 2007 Semiconductors AN10583 LPC2148 based player Contents 3.1.1 3.1.2 3.1.3 3.2.1 3.2.2 Introduction About libmad About EFSL About LPC2148 About Keil MCB2140 About Rowley CrossStudio ARM.4 Limitations demo Memory requirements General notice player components Setup environment.7 Configuring compiler linker proper operation Global directories settings Configuring compiler Configuring linker Configuring EFSL libmad libraries Configuring libmad Configuring Library Configuring system files Compiler batch files player demo operation.18 Output LEDs.20 Average usage.20 Further development steps.21 patents Legal information Definitions.22 Disclaimers.22 Trademarks Contents.23 Please aware that important notices concerning this document product(s) described herein, have been included section 'Legal information'. B.V. 2007. rights reserved. more information, please visit: http://www.nxp.com sales office addresses, email salesaddresses@nxp.com Date release: April 2007 Document identifier: AN10583_1 Other recent searchesW0201005 - W0201005 W0201005 Datasheet SPX1129 - SPX1129 SPX1129 Datasheet MACPES0050 - MACPES0050 MACPES0050 Datasheet M30260M8A-XXXGP - M30260M8A-XXXGP M30260M8A-XXXGP Datasheet LM1084 - LM1084 LM1084 Datasheet CDB4365 - CDB4365 CDB4365 Datasheet BCM5715S - BCM5715S BCM5715S Datasheet B1100 - B1100 B1100 Datasheet
Privacy Policy | Disclaimer |