关键字: I2S MCLK 主时钟 STM32F412RET 各位大师请教下,我这边使用STM32F412RET+DA7218,需要STM32送出I2S主时钟给DA7218, 目前线路留的是PC9这个GPIO,但我在STM32CubeMX的STM32F412RET的PC9找不到有I2S MCLK选项(如附件截图)。我们在一台客户的对比机STM32F4上面有量到这个脚的PC9有输出I2S MCLK。请教下各位大师,如何配置STM32F412RET 才能从PC9输出I2S MCLK? 先谢谢啦! |
PC9没çå°æI2S MCLKè¾åº
æçClocké ç½®å¾æ¯è¿æ ·çã
感谢回复,我改用PA3的I2S2 MCK如下图设置,以及代码调用如下,但PA3也是没有量到I2S2 MCK主时钟波形输出。是不是我哪里设置错了?
int main(void)
{
......
MX_I2S2_Init();
......
}
static void MX_I2S2_Init(void)
{
/* USER CODE BEGIN I2S2_Init 0 */
/* USER CODE END I2S2_Init 0 */
/* USER CODE BEGIN I2S2_Init 1 */
/* USER CODE END I2S2_Init 1 */
hi2s2.Instance = SPI2;
hi2s2.Init.Mode = I2S_MODE_MASTER_RX;
hi2s2.Init.Standard = I2S_STANDARD_PHILIPS;
hi2s2.Init.DataFormat = I2S_DATAFORMAT_16B;
hi2s2.Init.MCLKOutput = I2S_MCLKOUTPUT_ENABLE;
hi2s2.Init.AudioFreq = I2S_AUDIOFREQ_48K;
hi2s2.Init.CPOL = I2S_CPOL_HIGH;
hi2s2.Init.ClockSource = I2S_CLOCK_PLL;
hi2s2.Init.FullDuplexMode = I2S_FULLDUPLEXMODE_ENABLE;
if (HAL_I2S_Init(&hi2s2) != HAL_OK)
{
Error_Handler();
}
/* USER CODE BEGIN I2S2_Init 2 */
/* USER CODE END I2S2_Init 2 */
}
谢谢回复,我改为PA3输出I2S2 MCLK,但也是没有量到波形,如下是不是我哪里设置错了?有空帮忙检查指导下,再次感谢!
int main(void)
{
......
MX_I2S2_Init();
......
}
static void MX_I2S2_Init(void)
{
/* USER CODE BEGIN I2S2_Init 0 */
/* USER CODE END I2S2_Init 0 */
/* USER CODE BEGIN I2S2_Init 1 */
/* USER CODE END I2S2_Init 1 */
hi2s2.Instance = SPI2;
hi2s2.Init.Mode = I2S_MODE_MASTER_RX;
hi2s2.Init.Standard = I2S_STANDARD_PHILIPS;
hi2s2.Init.DataFormat = I2S_DATAFORMAT_16B;
hi2s2.Init.MCLKOutput = I2S_MCLKOUTPUT_ENABLE;
hi2s2.Init.AudioFreq = I2S_AUDIOFREQ_48K;
hi2s2.Init.CPOL = I2S_CPOL_HIGH;
hi2s2.Init.ClockSource = I2S_CLOCK_PLL;
hi2s2.Init.FullDuplexMode = I2S_FULLDUPLEXMODE_ENABLE;
if (HAL_I2S_Init(&hi2s2) != HAL_OK)
{
Error_Handler();
}
/* USER CODE BEGIN I2S2_Init 2 */
/* USER CODE END I2S2_Init 2 */
}
通过设置MCO2可以输出I2S MCLK了,非常感谢!