DSPRelated.com
Forums

distorted output on 512 point stereo buffer

Started by mark...@yahoo.com November 8, 2009
Dear Richard and Jeff,

Thank you for your reply,

Today I will change the program into interrupt based as both of you suggested. I hope it will solve the problem.

But one thing is interesting from Richard's post. It's about keeping all the buffer inside the L2 memory. How to set that actually?

Again thank you for your concerns and helps.

Marko Kanadi
Mitsuhashi laboratory
UEC, Tokyo, Japan

_____________________________________
Dear everyone,

I have done what were suggested to me for applying FFT but it seems that the maximum buffer size I can use is only 32 point. If the buffer size is 64, only signals of the left channel appears at the earphone and if more than that the signals of both channels are terribly distorted. The input is a song from an MP3 player (just for testing) and actually I can still guess what song is being played but it's harshly distorted.

Due to this I am willing to use double buffering technique or widely known as ping-pong buffering technique.

I have understood the concept of the technique which if one buffer is filled the other is being processed. But I don't know what I should do with my source code. Some posts give some keywords about modification about McBsP, etc. Unfortunately I am new to DSP and haven't understood the detail architecture of the DSP.

I hope any of you would help giving me any explanation and guidance about the next step I should do. Any advice will be really appreciated.

Thank you very much.

Marko Kanadi

_____________________________________
Marko,

the following pseudo code is not necessarily correct, however; it should give you an idea of what is involved in using a ping-pong buffer technique.

I would suggest using DMA for both the output operation and possibly also the input operation to free up the CPU for the processing of actual data.

You may also want to enable L2 cache to help minimize the number of external memory references.

Do you have an interrupt handler for the incoming data?

Within the interrupt handler...
extern char cReceiveBuffer[MAX_BUFFERS][MAX_INDEX];
extern enum enumPingPongIndex; // with enums PING and PONG
extern boolean bReceiveReadyFlag;
static int iBufferIndex = 0;

// step to next data receive point index
iBufferIndex++;

// when receive buffer is full
if (MAX_INDEX == iBufferIndex)
// then
// change to other data receive buffer
if (ePING = enumPingPongIndex)
then
enumPingPongIndex = ePONG;
else
enumPingPongIndex = ePING;
endif //(PING)

// reset receive buffer index
iBufferIndex = 0;

// set flag that a full receive buffer is ready to process
bReceiveReadyFlag = TRUE;
endif //(MAX_INDEX

cReceiveBuffer[ enumPingPongFlag ][iBufferIndex ] =

// clear interrupt pending flag
....

return;
======================
from main processing loop

if( true == bReceiveReadyFlag ) // indicates another input buffer ready to process
then
// reset receive buffer ready flag
bReceiveReadyFlag = false;

// process the buffer not indicated by enumPingPong
...

// indicate output buffer ready
bTransmitReadyFlag = true;
endif

// check if prior transmit completed
if( ???? ) // prior transmit completed?
then

if( true == bTransmitReadyFlag) // another output buffer ready?
then
// reset transmit buffer ready flag
bTransmitReadyFlag = false;

// tell output to start with buffer just processed
...
endif; // buffer ready to transmit
endif; // prior transmit completed

return;
=====================
R. Williams

---------- Original Message -----------
From: m...@yahoo.com
To: c...
Sent: Tue, 24 Nov 2009 04:39:17 -0500
Subject: [c6x] Re: distorted output on 512 point stereo buffer

>
>
> Dear everyone,
>
> I have done what were suggested to me for applying FFT but it seems that the maximum buffer size I can use is only 32 point. If the buffer size is 64, only signals of the left channel appears at the earphone and if more than that the signals of both channels are terribly distorted. The input is a song from an MP3 player (just for testing) and actually I can still guess what song is being played but it's harshly distorted.
>
> Due to this I am willing to use double buffering technique or widely known as ping-pong buffering technique.
>
> I have understood the concept of the technique which if one buffer is filled the other is being processed. But I don't know what I should do with my source code. Some posts give some keywords about modification about McBsP, etc. Unfortunately I am new to DSP and haven't understood the detail architecture of the DSP.
>
> I hope any of you would help giving me any explanation and guidance about the next step I should do. Any advice will be really appreciated.
>
> Thank you very much.
>
> Marko Kanadi
------- End of Original Message -------