Dynamically change the dead time in 6PWM mode #450
SnifMyBack
started this conversation in
Ideas
Replies: 1 comment 2 replies
-
Hey, you're the first person to ask for this, I think. I agree, we should make both frequency and dead-time dynamically settable. At the moment it is not possible using SimpleFOC functions. But, I think you can use the following code to set the dead time directly, bypassing the library (in this snippet dead_zone is the desired dead-time in terms of the total duty cycle, so dead_zone = 0.02 means 2% dead-time): HardwareTimer *HT = ((STM32DriverParams*)driver.params)->timers[0];
uint32_t dead_time_ns = (float)(1e9f/PWM_freq)*dead_zone;
uint32_t dead_time = __LL_TIM_CALC_DEADTIME(SystemCoreClock, LL_TIM_GetClockDivision(HT->getHandle()->Instance), dead_time_ns);
if (dead_time>255) dead_time = 255;
if (dead_time==0 && dead_zone>0) {
dead_time = 255; // LL_TIM_CALC_DEADTIME returns 0 if dead_time_ns is too large
SIMPLEFOC_DEBUG("STM32-DRV: WARN: dead time too large, setting to max");
}
LL_TIM_OC_SetDeadTime(HT->getHandle()->Instance, dead_time); // deadtime is non linear! |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi!
I'm currently working on a "custom" V/Hz controller with an ESP32 in 6PWM mode. I'm facing a problem where I need to be able to change the deadtime value even after the driver has been initialized. It is critical because I will be driving different IGBT module where the timming is not always the same.
I though of deleting the instance of the driver and starting again but it doesn't seems to possible (with the little knowledge in programming that I have at least).
Is there an alternative or do I need to wait for a possible update that will implement this kind of feature?
Thanks!
Beta Was this translation helpful? Give feedback.
All reactions