cancel
Showing results for 
Search instead for 
Did you mean: 

Do STM32CubeIDE generate correct System Clock Configuration code for Nucleo-F767ZI?

Adam_K
Associate II

I'm using Nucleo-F767ZI, I am configuring the 25 kHz PWM signal on pin PD14, TIM4_CH3.

I set up clock source HSI RC 16MHz, HCLK 216 MHz , APB1 peripheral clocks 54 MHz, TIM4 PSC = 0 ARR = 2159 CKD = No Division.

As a result, I get PWM with a frequency of 50 kHz.

When I change  RCC_OscInitStruct.PLL.PLLM = 8; on  RCC_OscInitStruct.PLL.PLLM = 16; in main.c file the frequency is correct 25 kHz.

Is STM32CubeIDE generating bad code or did I make a mistake somewhere?

Regards, Adam.

2 REPLIES 2

0693W000001pL8WQAU.png0693W000001pL8bQAE.png

JW

Adam_K
Associate II

This means that APB Timer clocks should be used to calculate PWM and not APB peripheral clocks.

Many thanks, Adam.