2023-01-27 02:08 PM
2023-01-30 01:40 AM
Hello @FPHIL.1 and welcome to ST Community,
After configuring the Clock tree in stm32Cube and generating the code, you shall find something like this
the RCC_PeriphCLKInitTypeDef PeriphClkInit = {0} functions is used to configure all peripherals clocks settings, such as frequency and prescaler. It is important to understand that all peripherals need to be properly configured to receive the correct clock frequency.
Hope that helps!
To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.
2023-01-30 11:07 AM
Your image is what I get. But I was expecting this as well:
void SystemClock_Config(void)
{
RCC_OscInitTypeDef RCC_OscInitStruct = {0};
RCC_ClkInitTypeDef RCC_ClkInitStruct = {0};
RCC_PeriphCLKInitTypeDef PeriphClkInit = {0};
.
. // whats in your image plus vvvvvv
.
.
PeriphClkInit.PeriphClockSelection = RCC_PERIPHCLK_ADC;
PeriphClkInit.AdcClockSelection = RCC_ADCCLKSOURCE_PLLSAI1;
PeriphClkInit.PLLSAI1.PLLSAI1Source = RCC_PLLSOURCE_HSI;
PeriphClkInit.PLLSAI1.PLLSAI1M = 2;
PeriphClkInit.PLLSAI1.PLLSAI1N = 8;
PeriphClkInit.PLLSAI1.PLLSAI1P = RCC_PLLP_DIV7;
PeriphClkInit.PLLSAI1.PLLSAI1Q = RCC_PLLQ_DIV2;
PeriphClkInit.PLLSAI1.PLLSAI1R = RCC_PLLR_DIV2;
PeriphClkInit.PLLSAI1.PLLSAI1ClockOut = RCC_PLLSAI1_ADC1CLK;
if (HAL_RCCEx_PeriphCLKConfig(&PeriphClkInit) != HAL_OK)
{
Error_Handler();
}
What reference should I use on what to add to the generated code (like this) for other clock configuration details?.
Sincere thanks,
Fred
2023-03-11 11:27 PM
Was it solved? I have the same issue.