Part Number: TMS320F280025C
Other Parts Discussed in Thread: DRV8300
Hi,
I try to figure out in the universal motor control lab from the motorcontrol SDK on how to limit the PWM duty cycle.
I'm using a DRV8300 with a bootstrap circuit and I would like to limit the PWM duty cycles to 98%, so that the
bootstrap circuit will always work reliable. I found the following function, where the PWM is applied, but I could not yet
figure out, how to limit it without changing the behaviour.
static inline void
HAL_writePWMData(HAL_MTR_Handle handle, HAL_PWMData_t *pPWMData)
{
HAL_MTR_Obj *obj = (HAL_MTR_Obj *)handle;
float32_t period = (float32_t)(EPWM_getTimeBasePeriod(obj->pwmHandle[0]));
uint16_t pwmCnt;
for(pwmCnt=0; pwmCnt<3; pwmCnt++)
{
// compute the value
float32_t V_pu = -pPWMData->Vabc_pu.value[pwmCnt]; // Negative
float32_t V_sat_pu = __fsat(V_pu, 0.5f, -0.5f); // -0.5~0.5
float32_t V_sat_dc_pu = V_sat_pu + 0.5; // 0~1.0
pPWMData->cmpValue[pwmCnt] = (int16_t)(V_sat_dc_pu * period); //
if(pPWMData->cmpValue[pwmCnt] < pPWMData->minCMPValue)
{
pPWMData->cmpValue[pwmCnt] = pPWMData->minCMPValue;
}
// write the PWM data value
EPWM_setCounterCompareValue(obj->pwmHandle[pwmCnt],
EPWM_COUNTER_COMPARE_A,
pPWMData->cmpValue[pwmCnt]);
EPWM_setCounterCompareValue(obj->pwmHandle[pwmCnt],
EPWM_COUNTER_COMPARE_B,
pPWMData->cmpValue[pwmCnt]);
}
return;
} // end of HAL_writePWMData() function
So, it seems the minimum duty cycle is already limited, but not the maximum, right? How can I do that without changing the behaviour until full load?
I already tried to use: float32_t V_sat_pu = __fsat(V_pu, 0.49f, -0.49f);, but this seems still to shift my whole period, probably because of calibration.
Edit:
When I observe the PWM duty cycle it looks like actual duty cycle is at 2500 (for 20kHz) and goes down for more power. So does pPWMData->minCMPValue (in hal.h, line 3256 in the universal motor control example) limit already the maximum duty cycle, so that the bootstrap will always work?