Is there an example for enabling the HWVAD on the RT117x? I see the API in the PDM driver, but I'm unable to get an interrupt to fire using the recommended settings defined in fsl_pdm.h. Assuming the clocks and channels are already configured (I can capture properly with PDM EDMA transfer) My thought was something like this:
void AudioTask::HandleEnableVoiceDetection(SetCallbackRequest& set_callback) {
const pdm_hwvad_config_t hwvadConfig = {
.channel = 0,
.initializeTime = 10U,
.cicOverSampleRate = 0U,
.inputGain = 0U,
.frameTime = 10U,
.cutOffFreq = kPDM_HwvadHpfBypassed,
.enableFrameEnergy = false,
.enablePreFilter = true,
};
const pdm_hwvad_noise_filter_t noiseFilterConfig = {
.enableAutoNoiseFilter = false,
.enableNoiseMin = true,
.enableNoiseDecimation = true,
.enableNoiseDetectOR = true,
.noiseFilterAdjustment = 0U,
.noiseGain = 7U,
};
PDM_SetHwvadInEnvelopeBasedMode(PDM, &hwvadConfig, &noiseFilterConfig, nullptr, 0);
PDM_EnableHwvadInterrupts(PDM, kPDM_HwvadInterruptEnable | kPDM_HwvadErrorInterruptEnable);
voice_callback_ = set_callback.callback;
voice_callback_param_ = set_callback.callback_param;
}
This seems to match what the reference manual says looking into the SetHwvadInEnvelopeBasedMode function. Am I missing something obvious? Is there a driver example of this in action?
Thanks,
Michael