stm32f4: pwm_init returns wrong value
In cpu/stm32f4/periph/pwm.c pwm_init is returning the requested input value.
It should return a frequency that is calculated based on actual clock and prescaler values.
not sure, but isn't the implementation actually correct? As the STM32F4 has very fine means for defining the actual clock, I think the configured value is the same (or at leas very very close) to the requested value.
but then again - I implemented it and thought this then also, I might be wrong here... Do you maybe have an example where the returned value differs from the value set?
defining the actual clock, I think the configured value is the same (or at leas very very close) to the requested value.
This is integer division. They can't be the same. Except in special cases, when res * freq is a divisor of the clock frequency. The differences are growing with the value of that product.
Ok, forgot what I wrote above, I had some twists in my thoughts, you are completely right!
how about this fix? #4454