H bridge control - Hish15/DustSucker GitHub Wiki
The motors are driven by the H bridge L6203
PWM is used on the STM32H7 MCU at 200kHz. To achieve such frequency the prescalar value is computed as follow :
To get TIM4 counter clock at 120 MHz, the prescaler is computed as follows:
Prescaler = (TIM4CLK / TIM4 counter clock) - 1 = 240 / 120 -1 = 1
To get TIM4 output clock at 100 KHz, the period (ARR)) is computed as follows:
ARR = (TIM4 counter clock / TIM4 output clock) - 1 = 120e6/100e3 - 1 = 1199