AnsweredAssumed Answered

24khz audio output

Question asked by Matti Sillanpää on Oct 16, 2017
Latest reply on Oct 17, 2017 by Matti Sillanpää

Hi.

 

 

I'm trying to output 24khz mono pcm data over SAI to wm8994 codec. 16khz mono seems to work OK, but 24 is not supported by ST by default. I've made some changes for the support to codec and sai init. Now I wonder what else needs to be changed.

 

As baseline I've let the clock configurators use same clock paths as 48khz (44 vs 48 khz domains). Slot number and stereo mode from sai perspective is also handled in SAI init:

if (channels == 1) {
   haudio_out_sai.Init.MonoStereoMode = SAI_MONOMODE;
   haudio_out_sai.SlotInit.SlotNumber = 2;
}else {
   haudio_out_sai.Init.MonoStereoMode = SAI_STEREOMODE;
   haudio_out_sai.SlotInit.SlotNumber = 4;
}

in wm8994.c -> init function I added 24khz selection to output path according to cirrius wm8994 spec (v.4.5).

 

case AUDIO_FREQUENCY_24K:
   /* AIF1 Sample Rate = 24.000 (KHz), ratio=256 */
   counter += CODEC_IO_Write(DeviceAddr, 0x210, 0x0053);
break;

 

CubeMX doesn't give the option to configure the SAI into 24khz mode. Is there some limitation or is this just left out? is there any other things I should consider when enabling the 24Khz mode?

Outcomes