2019-01-14 07:59 AM
Hello together,
I want to record a microphone with the Audio_back_and_record that I can operate at 48kHz and 3MHz.
Only the variant 16kHz with 2MHz or 16kHz with 3MHz works, but unfortunately not.
According to the Application Note AN5027 different clocks have to be set. Only the examples for the clock setting in the AN5027 are not identical with the example Audio_playback_and_record.
Here is the clock setting of the audio_backback_and_record example:
RCC_PeriphCLKInitTypeDef rcc_ex_clk_init_struct;
HAL_RCCEx_GetPeriphCLKConfig(&rcc_ex_clk_init_struct);
/* Set the PLL configuration according to the audio frequency */
if((AudioFreq == AUDIO_FREQUENCY_11K) || (AudioFreq == AUDIO_FREQUENCY_22K) || (AudioFreq == AUDIO_FREQUENCY_44K))
{
/* Configure PLLSAI prescalers */
/* PLLSAI_VCO: VCO_429M
SAI_CLK(first level) = PLLSAI_VCO/PLLSAIQ = 429/2 = 214.5 Mhz
SAI_CLK_x = SAI_CLK(first level)/PLLSAIDIVQ = 214.5/19 = 11.289 Mhz */
rcc_ex_clk_init_struct.PeriphClockSelection = RCC_PERIPHCLK_SAI1;
rcc_ex_clk_init_struct.Sai1ClockSelection = RCC_SAI1CLKSOURCE_PLLI2S;
rcc_ex_clk_init_struct.PLLI2S.PLLI2SN = 429;
rcc_ex_clk_init_struct.PLLI2S.PLLI2SQ = 2;
rcc_ex_clk_init_struct.PLLI2SDivQ = 19;
HAL_RCCEx_PeriphCLKConfig(&rcc_ex_clk_init_struct);
}
else /* AUDIO_FREQUENCY_8K, AUDIO_FREQUENCY_16K, AUDIO_FREQUENCY_48K, AUDIO_FREQUENCY_96K */
{
/* SAI clock config
PLLSAI_VCO: VCO_344M
SAI_CLK(first level) = PLLSAI_VCO/PLLSAIQ = 344/7 = 49.142 Mhz
SAI_CLK_x = SAI_CLK(first level)/PLLSAIDIVQ = 49.142/1 = 49.142 Mhz */
rcc_ex_clk_init_struct.PeriphClockSelection = RCC_PERIPHCLK_SAI1;
rcc_ex_clk_init_struct.Sai1ClockSelection = RCC_SAI1CLKSOURCE_PLLI2S;
rcc_ex_clk_init_struct.PLLI2S.PLLI2SN = 344;
rcc_ex_clk_init_struct.PLLI2S.PLLI2SQ = 7;
rcc_ex_clk_init_struct.PLLI2SDivQ = 1;
HAL_RCCEx_PeriphCLKConfig(&rcc_ex_clk_init_struct);
Any Ideas?
Best Regards