i have 2 questions about the advanced timers of the STM32F3.
first: how du i correctly setup the 144MHz Timer Clock with the STM running on 72MHz. The 2.6.x implementation in pwm_lld.c uses
STM32_TIMCLK2 define as Clock for the Timer.
but this code from hal_lld.h for STM32F30x says:
Code: Select all
/**
* @brief TIM1 frequency.
*/
#if STM32_TIM1SW == STM32_TIM1SW_PCLK2
#define STM32_TIM1CLK STM32_PCLK2
#elif STM32_TIM1SW == STM32_TIM1SW_PLLX2
#define STM32_TIM1CLK (STM32_PLLCLKOUT * 2)
#else
#error "invalid source selected for TIM1 clock"
#endif
If i set STM32_TIM1SW_PLLX2 in mcuconf as timer 1 clock source i get 144MHz.
So do i have a bug here that line 413 in pwm_lld.c which is:
Code: Select all
pwmp->clock = STM32_TIMCLK2;should be
Code: Select all
pwmp->clock = STM32_TIM1CLK;and so for TIM8 as well.
So how can i get 144MHz base clock for my PWM on TIM1.
my second question is: how is center aligned pwm correctly configured with the pwm driver? normaly the PWM driver uses PWM Mode 1.
I need this mode for my 3 phase pwm to save switching losses and being able to sample the ADC in the middle of the high time of the dutycycle.
If this mode is not implemented jet i would write a patch using a define like STM32_PWM_USE_CENTER_ALIGNED to activate this mode.
Thanks
Tec