DSPRelated.com
Forums

on ADSP BF537 EZ kit lite Audio Codec

Started by isni...@gmail.com August 12, 2008
Hello,
I am working with Analog Devices Blackfin BF537 EZ Kit Lite board. I am
storing the 16 bit audio samples of a PCM .wav file in the memory.
My implementation is as follows
.
1) I store the Audio samples in the SDRAM memory by performing memory allocation.

2) Perform Adio reset in the beginning
void Audio_Reset(void)
{
int i;
// give some time for reset to take affect
for(i = 0; i< delay;i++){};
// set port f set register
*pPORTFIO_SET = PF12;
}

3)Initialize SPORT interface.
void Init_Sport0(void)
{
*pSPORT0_TCLKDIV=0xA9;
*pSPORT0_TFSDIV = 0x000F;
*pSPORT0_TCR1 = TFSR | TCKFE | ITFS |ITCLK ;
*pSPORT0_TCR2 = SLEN_24 | TSFSE;
}
4)Initialize DMA

void Init_DMA(void)
{
// Configure DMA4
// 32-bit transfers, Autobuffer mode
*pDMA4_CONFIG = WDSIZE_16| FLOW_1|DI_EN;

*pDMA4_START_ADDR = iTxBuffer1;
// DMA loop address increment
*pDMA4_X_MODIFY = 2;

*pDMA4_X_COUNT = 2;

}
5) Enable DMA and SPORT
Void Ena_DMA_SPORT( ){

*pDMA4_CONFIG = (*pDMA4_CONFIG | DMAEN);
*pSPORT0_TCR1 = (*pSPORT0_TCR1 | TSPEN);
}

6) On receiving the interrupt I update DMA with next samples as shown
EX_INTERRUPT_HANDLER(Sport0_TX_ISR)
{
// confirm interrupt handling
*pDMA4_IRQ_STATUS = 0x0001;
while(count
iTxBuffer1[0] = *(sample + count);
iTxBuffer1[1] = 0;
count++;
}
if(count==(dataLen){
dma_done=1;
}
}

The problem I am facing Is as follows
* The Audio data which was supposed to play for 13 seconds is finishing in 1 second.
* I had adjusted TFSDIV and TSCLKDIV based on the sampling frequency of the wavefile
* Other doubt I have is can I generate TSCLK0 and TFS internally.
* I an example you have given "Audio Talkthrough C" I dont see any sampling frequency adjustments.??
* How can I play audio with above mentioned method??

Regards,
Nithin K S
Hai Nithin ,

what is the core clock and system clock ?


with regards,

S.Nagaraju
09962553485
--- On Mon, 11/8/08, i...@gmail.com wrote:

From: i...@gmail.com
Subject: [adsp] on ADSP BF537 EZ kit lite Audio Codec
To: a...
Date: Monday, 11 August, 2008, 9:50 AM

Hello,
I am working with Analog Devices Blackfin BF537 EZ Kit Lite board. I am
storing the 16 bit audio samples of a PCM .wav file in the memory.
My implementation is as follows
.
1) I store the Audio samples in the SDRAM memory by performing memory allocation.

2) Perform Adio reset in the beginning
void Audio_Reset( void)
{
int i;
// give some time for reset to take affect
for(i = 0; i< delay;i++){} ;
// set port f set register
*pPORTFIO_SET = PF12;
}

3)Initialize SPORT interface.
void Init_Sport0( void)
{
*pSPORT0_TCLKDIV= 0xA9;
*pSPORT0_TFSDIV = 0x000F;
*pSPORT0_TCR1 = TFSR | TCKFE | ITFS |ITCLK ;
*pSPORT0_TCR2 = SLEN_24 | TSFSE;
}
4)Initialize DMA

void Init_DMA(void)
{
// Configure DMA4
// 32-bit transfers, Autobuffer mode
*pDMA4_CONFIG = WDSIZE_16| FLOW_1|DI_EN;

*pDMA4_START_ ADDR = iTxBuffer1;
// DMA loop address increment
*pDMA4_X_MODIFY = 2;

*pDMA4_X_COUNT = 2;

}
5) Enable DMA and SPORT
Void Ena_DMA_SPORT( ){

*pDMA4_CONFIG = (*pDMA4_CONFIG | DMAEN);
*pSPORT0_TCR1 = (*pSPORT0_TCR1 | TSPEN);
}

6) On receiving the interrupt I update DMA with next samples as shown
EX_INTERRUPT_ HANDLER(Sport0_ TX_ISR)
{
// confirm interrupt handling
*pDMA4_IRQ_STATUS = 0x0001;
while(count< dataLen){

iTxBuffer1[0] = *(sample + count);
iTxBuffer1[1] = 0;
count++;
}
if(count==(dataLen) {
dma_done=1;
}
}

The problem I am facing Is as follows
* The Audio data which was supposed to play for 13 seconds is finishing in 1 second.
* I had adjusted TFSDIV and TSCLKDIV based on the sampling frequency of the wavefile
* Other doubt I have is can I generate TSCLK0 and TFS internally.
* I an example you have given "Audio Talkthrough C" I dont see any sampling frequency adjustments. ??
* How can I play audio with above mentioned method??

Regards,
Nithin K S