高中生
最后登录1970-1-1
在线时间 小时
注册时间2017-7-13
|
楼主 |
发表于 2017-9-5 14:29:16
|
显示全部楼层
void BSP_AUDIO_OUT_ClockConfig(I2S_HandleTypeDef *hi2s, uint32_t AudioFreq, void *Params)
{
RCC_PeriphCLKInitTypeDef RCC_ExCLKInitStruct;
HAL_RCCEx_GetPeriphCLKConfig(&RCC_ExCLKInitStruct);
/* Set the PLL configuration according to the audio frequency */
if((AudioFreq == I2S_AUDIOFREQ_11K) || (AudioFreq == I2S_AUDIOFREQ_22K) || (AudioFreq == I2S_AUDIOFREQ_44K))
{
/* Configure PLLSAI prescalers */
/* PLLI2S_VCO: VCO_429M
SAI_CLK(first level) = PLLI2S_VCO/PLLSAIQ = 316/7 = 45 Mhz
SAI_CLK_x = SAI_CLK(first level)/PLLI2SDivQ = 45/4 = 11.25 Mhz */
RCC_ExCLKInitStruct.PeriphClockSelection = RCC_PERIPHCLK_I2S;
RCC_ExCLKInitStruct.Sai2ClockSelection = RCC_I2SCLKSOURCE_PLLI2S;
RCC_ExCLKInitStruct.PLLI2S.PLLI2SP = 0;
RCC_ExCLKInitStruct.PLLI2S.PLLI2SN = 316;
RCC_ExCLKInitStruct.PLLI2S.PLLI2SR = 7;
RCC_ExCLKInitStruct.PLLI2S.PLLI2SQ = 4;
RCC_ExCLKInitStruct.PLLI2SDivQ = 1;
HAL_RCCEx_PeriphCLKConfig(&RCC_ExCLKInitStruct);
}
else /* AUDIO_FREQUENCY_8K, AUDIO_FREQUENCY_16K, AUDIO_FREQUENCY_48K), AUDIO_FREQUENCY_96K */
{
/* SAI clock config
PLLI2S_VCO: VCO_344M
SAI_CLK(first level) = PLLI2S_VCO/PLLSAIQ = 344/7 = 49.142 Mhz
SAI_CLK_x = SAI_CLK(first level)/PLLI2SDivQ = 49.142/1 = 49.142 Mhz */
RCC_ExCLKInitStruct.PeriphClockSelection = RCC_PERIPHCLK_I2S;
RCC_ExCLKInitStruct.Sai2ClockSelection = RCC_I2SCLKSOURCE_PLLI2S;
RCC_ExCLKInitStruct.PLLI2S.PLLI2SP = 0;
RCC_ExCLKInitStruct.PLLI2S.PLLI2SN = 344;
RCC_ExCLKInitStruct.PLLI2S.PLLI2SR = 7;
RCC_ExCLKInitStruct.PLLI2S.PLLI2SQ = 1;
RCC_ExCLKInitStruct.PLLI2SDivQ = 1;
HAL_RCCEx_PeriphCLKConfig(&RCC_ExCLKInitStruct);
}
}
火哥,这个函数在746里面有什么作用????移植过来发现这个函数不通? |
|