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.

RTOS/CC2650: PDM microphone

Part Number: CC2650


Tool/software: TI-RTOS

Hi, I used the PDM example in TI-RTOS for CC2650, I want to test how far the mic can sense so I basically test the sound signal's amplitude the mic picks up. I have the following questions:

1). Does pPCMsamples[i] store the raw PCM sound data?

2). I use the following code to test the sound signal amplitude

for (i = 0; i < numOfSamples; i++){

audioAverage=pPCMsamples[i]/numOfSamples;
audioSum=audioSum+audioAverage;
}

which is quiet simple, this block of code is within the function SA_envelopeDetector. I test the sound signal's amplitude by returning the var 'audioSum'.

Am I doing right?

3). What is now confusing me is that in a quiet environment, the audio amplitude can be large while in the noisy environment this amplitude is small. I got this experiment result by setting up breakpoints at the function SA_envelopeDetector, and debug to see the result( I do not have UART hardware)like following,

 current= SA_envelopeDetector((int16_t *)bufferRequest.buffer->pBuffer, AUDIO_BUF_UNCOMPRESSED_SIZE);

I observe tha change of variable current to see the amplitude of the sound signal.

I don't know if this is right for debugging an app based on RTOS?

  • Hello Jason,
    1. Yes, the PCMsample buffer contains PCM samples. The PDM driver takes care in converting PDM to PCM format.

    2. Note that the samples may be positive or negative, you need to take the absolute value to get correct measurement. The SA_envelopeDetector() code does this. Also there may be precision issues because you are dividing by numOfSamples too soon. It is better to accumulate first and then divide esp when working with low signal levels as in your case. To detect the amplitude, I think it is better to stick to using SA_envelopeDetector() code as it smoothens the signal by filtering that gives a better measurement.

    3. This error that you notice must be coming from missing the absolute value as described in 2.

    Regards,
    Prashanth