This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

PCM3060: Issues running DSP on data

Part Number: PCM3060

Hello,

I am new to the world of audio codecs and DSP, I have been able to do it with simple on board microcontroller ADC / DAC. I am trying to use the PCM3060 on my new design, I am able to pass the signal through with no issue. The PCM3060 is configured to mute the right channel completely (both ADC and DAC) and run the DAC in single-ended mode. It uses the standard 24-bit I2S data mode into an STM32 microcontroller. The controller I am using does not offer full duplex i2s, so I am using two different i2s channels set to the same settings: 48kHz I2S Phillips. One being Master Transmit and the other being Master Recieve. I know this is not the recommended setup but it works with a sine wave. 

The function I use to interpret the data is below:

float audio_stream::convert_input_audio_signal(int32_t val){

val >>= 8;

return (float)val / 8388608;

}

int32_t audio_stream::convert_output_audio_signal(float val){

val *= 8388608;

int32_t int_val = (int32_t)val;

return (int_val << 8) & 0xFFFFFF00;

}

I have tried a handful of things, this is just the current state - but a simple clipping function (below) is not working right at all.

if(val > thresh) val = thresh; 

if(val < -thresh) val = -thresh;

Using the debugger and a simple amplitude function, I seem to be getting data within the expected range (-8388608 to 8388608)

My questions are what else could be causing this? Does anyone know why this could be? How am I supposed to get good values in the signed 24 bit data range? I have attached scope pictures, one is the straight-through sine wave with no DSP and one with the clipping function. Yellow is the ~100Hz sine wave (~1Vp) and Blue is the output.  I have tried inverting the data both via PCM registers and in the code. I have tried running other simple algorithms I have found, and the output looks very distorted seemingly no matter what I do. 

Any help on this topic is greatly appreciated! Looking through online forums has not offered any solutions thus far.   Thank you!