Dynamically change the dead time in 6PWM mode #450
Replies: 3 comments 4 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.
-
So, for ESP32, the following snippet should work (I haven't compiled this snippet, so there may be some small errors to solve): Again, dead_zone is the dead time as a proportion of the PWM period, so 0.02 = 2% of the period is dead-time. In a fortunate coincidence, this code also shows you how you might change the active-high behavior on ESP32 on the fly - it is configured via the same structure as the dead-time :-) You'll have to #include the right headers in the cpp file where you add this code. Try with:
|
Beta Was this translation helpful? Give feedback.
-
I’m truly thankful for your support! I will try the snippets you've sent ASAP.
We are repairing industrial and railway equipment. My team are specialized in the high power stuff and are dealing with A LOT of inverter. Sometimes, equipment doesn't come with the controller that generate the required signals to make the 3 phases motor turn. So we use our in-house solution that are functionnal but always adequate to drive big motors (our 100hp is one of them). Here comes your awesome librairy that help us generate those signals. SPWM, adjustable dead-time and selectable "active on H/L level" are the most usefull features for this kind of test. Making it dynamically adjustable helps us testing every unit with every combination of settings required for it. Thanks again! |
Beta Was this translation helpful? Give feedback.
-
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