Audio file playback based on embedded microprocessor S3C44B0X

Publisher:YudieLatest update time:2009-08-01 Source: EDN ChinaKeywords:S3C44B0X Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

S3C44B0X is a cost-effective microprocessor launched by Samsung for embedded systems. It is a 16/32-bit RISC processor based on the ARM7TDMI core and has a main frequency of 66MHz. In order to reduce costs and save product development cycles, S3C44BO0X provides a wealth of built-in components, including: internal SRAM, LCD controller, 8-channel 10-bit ADC, IIC bus interface, IIS bus interface, etc. Among them, the S3C44B0X IIS interface can be used to connect an external 8/16-bit stereo sound decoder. CS4334 is a series of audio decoding chips launched by CIRRUS. Their working principles and applications are discussed in detail in the literature [1,2,3].

This paper studies the connection between S3C44B0X IIS bus interface and CS4334 in detail, and builds an embedded work platform based on the two. The playback of WAVE audio files is realized on this platform, and a test program is given.

1IIS bus structure

The S3C44B0X IIS (Inter-IC Sound) interface provides DMA transfer mode instead of interrupt mode for FIFO access. It can send and receive data at the same time or only send or only receive.

As shown in Figure 1, the bus interface FIFO control includes the bus interface, internal registers and state machine, which control the bus interface logic and FIFO access; the 3-bit dual divider includes one as the IIS bus master clock generator and the other as the external encoder clock generator; the master serial bit clock generator (master mode) divides the master clock to get the serial bit clock; the channel generator and state machine generate and control IISCLK and IISLRCK, and control the reception and transmission of data; the 16-bit shift register converts the data from parallel to serial when sending data, and does the opposite when receiving data.

The IIS bus can use three transmission modes: normal transmission mode, DMA transmission mode and simultaneous transmission and reception mode.

2 Audio digital-to-analog conversion chip CS4334

CS4334 is an audio digital-to-analog conversion chip produced by CIRRUS Semiconductor. It has the characteristics of simple interface, stable performance and easy operation, and is widely used in embedded systems. In addition, since the WAVE digital audio is weak after being converted into analog audio by CS4334, an audio power amplifier needs to be added. This article uses the PHILIPS company's TDA7050 low-level mono/stereo power amplifier.

Figure 1 IIS bus structure diagram

Figure 2 Connection diagram of S3C44B0X, CS4334 and TDA7050

Connection between 3S3C44B0X, CS4334 and TDA7050

The S3C44B0X IIS bus interface and the CS4334 module are both highly versatile and can be easily connected. The connection method is: connect the S3C44B0X ports PF6 (IISDO), PF8 (IISCLK), PF5 (IISLRCK), and PE8 (END/AN) to the CS4334 pins 1, 2, 3, and 4 respectively. When connecting the CS4334 to the TDA7050, simply connect the CS4334 output to the corresponding input pin of the TDA7050. The specific connection method is shown in Figure 2.

4 Programming

The program design assumes that the S3C44B0X has been successfully started. Here we focus on the main function of playing WAVE files:

Playwave().IIS_Init() is the function to initialize the IIS interface, and BDMA0_Done() is the BDMA0 interrupt processing function. They are introduced as follows. [page]

4.1 IIS interface initialization

The code is as follows:

void IIS_Init(void){

rPCONF = 0x24900a; //Set I/O port PF to make port PF5~8 work in IIS state

Init_4334(); //Initialize CS4334 chip}

4.2 Play WAVE audio file function

Before the Playwave() function is run, it will prompt you to download the wave audio file to the specified RAM area. The function will calculate the file size and prompt whether to play it or not, and finally return.

void Playwave (U32 addr, U32 size){

unsigned char *pWave;

U32 samplesize; //WAVE file length

U32 save_PLLCON;

save_PLLCON = rPLLCON;

rPLLCON= x69<<12)|(0x17<<4)|0;

SerialChgBaud(115200);

pISR_BDMA0=(unsigned)BDMA0_Done;

rINTMSK=~(BIT_GLOBAL|BIT_BDMA0); //interrupt setting

pWave=(unsigned char *)addr; //wave file data address

pWave+=0x28; //point to wav sampling length

samplesize=*(pWave+0) | *(pWave+1)<<8 | *(pWave+2)<<16 | *(pWave+3)<<24;

pWave+=4; //point to wav data

samplesize=(samplesize>>1)<<1;

printf(\\nsample start:0x%x,pWave);

printf(\\nsamplesize:0x%x,samplesize);

Init_4334();

/****** IIS Initialization******/

rIISCON=0x22; //Enable DMA, receive idle, enable frequency division

rIISMOD=0x89; //Main mode, IIS format, 16-bit data, 256fs, 32fs

rIISPSR=0x33; //Division factor

rIISFCON=0xa00; //Receive and send DMA mode, enable FIFO

/****** BDMA0 initialization******/

rBDISRC0=(1<<30)+(1<<28)+(U32)pWave; //DMA source; 16-bit data, growth mode

rBDIDES0=(1<<30)+(3<<28)+((U32)rIISFIF); //DMA destination: M2IO, internal module

rBDICNT0=(1<<30)+(1<<26)+(3<<22)+(1<<21)+(0<<20)+samplesize;

rBDICNT0 |= (1<<20); //Set DMA request source to IIS, interrupt mode, manual reload, enable DMA

rBDCON0 = 0x0<<2;

printf(\\nNow play the wave file ...);

printf(\\nPush any key to exit!!!);

rIISCON |= 0x1;

while(!getkey()); //Press any key to return}

5 Summary

This paper uses the built-in IIS bus of S3C44B0X and the audio digital-to-analog conversion chip CS4334 to build a working platform with the two as the core, and discusses in detail the method of playing WAVE audio files based on this platform. Since the S3C44B0X and CS4334 modules have strong versatility, the implementation method and program given in this paper are simple to use, stable in operation, and easy to transplant.

The author's innovation lies in the detailed design of a WAVE audio file playback platform based on the embedded microprocessors S3C44B0X and CS4334, which combines the advantages of ARM processors' low power consumption, portability, high code execution efficiency and good sound quality of WAVE audio files, and gives a detailed connection method. The designed program has been successfully run on the hardware platform.

References:

[1] Li Yan, Rong Panxiang. Principles and applications of embedded uClinux system based on S3C44B0X[M]. Beijing: Tsinghua University Press, 2005.

[2] Jiang Junhui. Embedded system hardware design based on ARM[J]. Microcomputer Information, Vol. 21, No. 7-2, 2005, p. 120.

[3] Ma Zhongmei. ARM Embedded Processor Architecture and Application Foundation[M]. Beijing: Beijing University of Aeronautics and Astronautics Press, 2002.

[4] Du Chunlei. ARM Architecture and Programming[M]. Beijing: Tsinghua University Press, 2003.

Keywords:S3C44B0X Reference address:Audio file playback based on embedded microprocessor S3C44B0X

Previous article:TV-specific microprocessor ST6388 with screen display output
Next article:Design and implementation of embedded media player based on MiniGUI

Recommended ReadingLatest update time:2024-11-16 20:30

Application of uC/OS-II in GPRS Terminal System
The real-time embedded operating system uC/OS-II is aimed at small and medium-sized embedded applications. The kernel including all functional modules is about 10KB, and the amount of RAM used is mainly related to the number of tasks in the system. GPRS is a data service developed on the basis of the currently
[Microcontroller]
Application of uC/OS-II in GPRS Terminal System
Latest Mobile phone portable 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号