@bdub / @peekay123 / @mdma
I believe I have pwm ‘working’ for a motor (fan) application. However I do believe there is an issue with trying to set the PWM frequency - it doesn’t appear to honour the TIM_TimeBaseStructure.TIM_Period setting and just uses the default range of 65536.
This can be observed by setting TIM_Period in the same way as bdub’s original code (https://gist.github.com/technobly/8313449), ie taking a stab at the internal advanced clock frequency (72Mhz is referred to on page 10 of http://www.st.com/web/en/resource/technical/document/application_note/DM00042534.pdf) and then dividing by the desired frequency.
The attached gist on a photon does step a fan (dc-dc regulator circuit) nicely from 0-100% but its not as stable at low speeds as it used to be when I was able to reliably set the PWM frequency to 24Khz. Thoughts?