LibreSolar / charge-controller-firmware

Firmware for Libre Solar MPPT/PWM charge controllers
https://libre.solar/charge-controller-firmware/
Apache License 2.0
144 stars 71 forks source link

Use edge-aligned PWM for MCUs with advanced timer TIM1 #106

Closed martinjaeger closed 4 years ago

martinjaeger commented 4 years ago

This increases the resolution of the PWM duty cycle of the DC/DC converter by a factor of 2, which helps to set the ratio between input and output voltage for the MPPT algorithm more precisely.

For TIM3 (as used in STM32L0) it is necessary to use center-aligned PWM mode, as this timer does not feature a dead-time generator. Thus, the dead-time between high-side and low-side MOSFET on-states has to be added manually, which is not possible in edge-aligned mode (as far as I know).