I am having a fight with the SC589 EZ-KIT.
I am trying to process audio on the floating point domain but I can't get the incoming data from the ADC to be ranged between [-1, 1) as one would expect.
This is what I'm doing to covert the integer samples from the ADC into a float buffer:
inBufferSplitMono [ i ] = __builtin_conv_RtoF(inSample[ NUM_CHANNELS*i ]);
But then, when plotting that buffer this is what I get for a 0.65Vpeak 1KHz sine tone:
As can be seen there, values are very little. So, I went all the way down to verifying that the samples coming from the ADC (ADAU1977) are correct and found that things are a bit strange down there. This is what the DMA'd memory region looks like:
I'm not sure why the 4th byte is 0xFF for the third channel.
So, is there anything obvious that I am missing here?
Looking forward to hearing from you.
Thanks in advance!
Hello,We have taken SC-589 audio talk through example and observed similar kind of results. In I2S mode, adi_sport_ConfigData() API word width has been set as 24bit. While analyzing the ADC data, the MSB bytes are filled with extended sign byte. When we change the word width from 23u to 31u in adi_adau1979.c at line:409, we observed that the extended sign byte has been shifted out and we are getting better floating point data after applying built in fix to fractional conversion function. We have given 4k sine tone with 0dB as input and set the volume as maximum and observed that these signed byte has been shifted out. Could you please change the configuration and let us know how you are getting on.If you still facing issues, please share us the sample project. That will help us assist you better.Best regards,Santha kumari.K
thank you very much for your quick reply.
I have been able to fix the issue by removing the DC offset of the samples by writing 0x0F to ADI_ADAU1979_REG_DC_HPF_CAL.
I also multiplied and divide the samples by 256 in order to covert from 24 to 32-bit while keeping the sign bit:
inBufferSplitMono [ i ] = __builtin_conv_RtoF(inSample[ NUM_CHANNELS*i ] * 256);
*outSample++ = __builtin_conv_FtoR(inBufferSplitMono[ (0 * numSamples) + i ]) / 256;
Let me know if something doesn't make sense to you.
Thank you so much for your reply. Hope you are also splitting the incoming Source ADC data into L1,R1,L2,R2 channels. I have tried this step also. But this will increase the noise level when we are not passing any audio input. Have you verified this step.
hello,where can I find the example about split the incoming source ADC data into L1,R1 L2 R2? thanks
Hello,Please find the attached Example Audio playback project for SC-589 ezkit which de-interleave the received channel data from ADC 0, 1, 2, 3 into four buffers. Kindly check the de-interleaved from the attached imageIn this example project, we are using ADAU1979 ADC and ADAU1962A DACHere we are converted the source data from real to float if you want to process the data further for example applying filtering logic and in destination buffer we are converted it back to realBest Regards,Santha kumari.K
ADC DAC Audio Playback (SC589 SHARC).zip
Thank you very much! It help me a lot . I hava some doubt, for this AUDIO_BUFFER_SIZE/(NUM_CHANNELS*4u), I understand that 4u is 4 byte,
now, I want to modify
/* Macro to set buffer size */#define AUDIO_BUFFER_SIZE (SAMPLES_PER_PERIOD * NUM_CHANNELS * SAMPLE_SIZE * 4u)
to #define AUDIO_BUFFER_SIZE (1u * NUM_CHANNELS * SAMPLE_SIZE ), because I need the four buffers length is one . dose it fit? I think minimal buffer can be set one, but it dose not have output for ADC 0 1 2 3
Please note that ADC Output Data Bit Width is configured for 24-bit and the SPORT data width is configured for 32-bit (4Bytes). Each ADC channel data size is 32-bit (4-Bytes) in received SPORT buffer. If you are trying to store 32-bit data into 8-bit buffer, remaining bits will be truncated (if you declared *pSrc in 32-bit).
If this is not your requirement, please explain in detail and share us the code. This will be helpful for us to assist you better.
hello， thanks. I add FIR filter to ADC DAC PLACKBACK, the filter only work once. I look the example project: low pass filter , I see the filter only work once，if I want FIR filter work contiue in ADC_DAC PLACKBACK, could you give me some advince ?thanks
Hello,Could you please let us know where did you apply your filtering logic?Please write your logic in a function and call it after splitting the source data to four channel buffers. After completing this process convert the individual data from float to real and store it in a destination buffer.Please refer the below help path which contains information about run-time library functionsCrossCore® Embedded Studio> SHARC® Development Tools Documentation > C/C++ Library Manual for SHARC® Processors > DSP Run-Time Library > DSP Run-Time Library Reference > firIf this is not helpful, please share us the project that you have tried.This will be helpful for us to assist you further. Best Regards,Santha kumari.K