casainho
10 GW
- Joined
- Feb 14, 2011
- Messages
- 6,058
Correct!!stancecoke said:With this we should get a PWM frequency of 20.833 kHz (16Mhz / (2*384) = 20.833kHz)
Code:TIM1_TimeBaseInit(0, // TIM1_Prescaler = 0 TIM1_COUNTERMODE_CENTERALIGNED1, (384 - 1), // clock = 16MHz; counter period = 384; PWM freq = 16MHz / (384*2) = 20.833kHz; //(BUT PWM center aligned mode needs twice the frequency) 1); // will fire the TIM1_IT_UPDATE at every PWM period
And after you need to verify what is the used time on the PWM cycle code -- I do that using debug_pin_set() and debug_pin_reset(), placing set at begin of interrupt code and reset at the end, then measure on oscilloscope.
We may think that a controller with a STM32Fxxx would have advantage here, but the ones like Lishui does work sensorless and they must implement sensorless algorithm that is heavy math done every PWM cycle code, so in the end, there is also no free time. Also maybe to go from 16khz to 32khz, the hardware may need to change on the mosfets power stage, so it is a really different controller.
I think direct drive motors have low ERPM while geared motors seems to have high ERPM...