Associate II
July 4, 2022
Solved
Missing code during Code Generation - STM32CubeIDE version 1.9.0
- July 4, 2022
- 3 replies
- 1782 views
Hi, I am using the STM32CubeIDE version 1.9.0 Code Generator feature (via the CubeMX graphical interface) and wanted to generate the 96 MHz sample clock for the I2S codec. Unfortunately, I found that the code generated under sub "void SystemClock_Config(void)" missing the I2S clock setting which supposed to look something like below:
//all these are not generated by the CubeMX code generator
RCC_PeriphCLKInitTypeDef PeriphClkInitStruct = {0};
...
PeriphClkInitStruct.PeriphClockSelection = RCC_PERIPHCLK_I2S;
PeriphClkInitStruct.PLLI2S.PLLI2SN = 192;
PeriphClkInitStruct.PLLI2S.PLLI2SR = 2;
if (HAL_RCCEx_PeriphCLKConfig(&PeriphClkInitStruct) != HAL_OK)
{
Error_Handler();
}My question is:
1) Am I missing anything while setting the CubeMX?
2) What will be the way out other than copy the code above into my project main.c file?
NOTE: I am comparing my code with respect to sample code given by other person then I know that the CubeMX Code Generator of my work lack of the above codes. I attached the photos of my CubeMX graphically setting and the code it produced (see attachment)
Thanks