2025-05-04 11:39 PM
Hi, I have one question about this library STM32CubeExpansion_MEMSMIC1_V5.7.0 and PDM module
In the example, I tried to find a conversion rate between audio gain and SPLs or Pa. I only found this snippet of code that refers to the amplification factor, which by default is 1.
scr/audio_application.h
#define AUDIO_VOLUME_INPUT 64U
scr/audio_application.c
void Init_Acquisition_Peripherals(uint32_t AudioFreq, uint32_t ChnlNbrIn, uint32_t ChnlNbrOut)
{
MicParams.BitsPerSample = 16;
MicParams.ChannelsNbr = ChnlNbrIn;
MicParams.Device = AUDIO_IN_DIGITAL_MIC;
MicParams.SampleRate = AudioFreq;
MicParams.Volume = AUDIO_VOLUME_INPUT;
MicParams.Tech_MIC= TYPE_SENSOR;
if (CCA02M2_AUDIO_IN_Init(CCA02M2_AUDIO_INSTANCE, &MicParams) != BSP_ERROR_NONE)
{
Error_Handler();
}
}
scr/usbd_audio_if.c
/* Private functions ---------------------------------------------------------*/
/* This table maps the audio device class setting in 1/256 dB to a
* linear 0-64 scaling used in pdm_filter.c. It is computed as
* 256*20*log10(index/64). */
const int16_t vol_table[65] =
{
0x8000, 0xDBE0, 0xE1E6, 0xE56B, 0xE7EB, 0xE9DB, 0xEB70, 0xECC7,
0xEDF0, 0xEEF6, 0xEFE0, 0xF0B4, 0xF176, 0xF228, 0xF2CD, 0xF366,
0xF3F5, 0xF47C, 0xF4FB, 0xF574, 0xF5E6, 0xF652, 0xF6BA, 0xF71C,
0xF778, 0xF7D6, 0xF82D, 0xF881, 0xF8D2, 0xF920, 0xF96B, 0xF9B4,
0xF9FB, 0xFA3F, 0xFA82, 0xFAC2, 0xFB01, 0xFB3E, 0xFB79, 0xFBB3,
0xFBEB, 0xFC22, 0xFC57, 0xFC8C, 0xFCBF, 0xFCF1, 0xFD22, 0xFD51,
0xFD80, 0xFDAE, 0xFDDB, 0xFE07, 0xFE32, 0xFE5D, 0xFE86, 0xFEAF,
0xFED7, 0xFF00, 0xFF25, 0xFF4B, 0xFF70, 0xFF95, 0xFFB9, 0xFFD0,
0x0000
};
Is there any documentation regarding this example, related with digital (pdm) data to Pa or spl conversion (MP34DT06J, AOP = 122.5 dBSPL)?
Additionally, is there any update for the microphone driver for STM32? I remember integrating it from complex a little based on the example
Kind regards, TC