2020-05-23 01:34 PM
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.
2020-05-23 02:15 PM
JW
2020-05-23 02:50 PM
This means that APB Timer clocks should be used to calculate PWM and not APB peripheral clocks.
Many thanks, Adam.