hi。
i have some questions about the dead-time compensation?my mcu is s12ZVML128,
I tried the current zero crossing detection compensation and register detection compensation method, the effect is not good, request help, thank you
Thanks!
void pmf_init(void)
{
PMFCFG2_REV0 = 1; // 01 PWM generator A generates reload event.
PMFCFG2_REV1 = 0;
PMFMODA = 2500; // pwm frequency to be 20 kHz
PMFDTMA = MOS_DEAD_TIME; // dead time of pmf to be 0.75 us
PMFCCTL_ISENS = 0x10; // 死区补偿方法
PMFVAL0 = PMFMODA >> 1; // set the output duty to be 50%
PMFVAL2 = PMFMODA >> 1;
PMFVAL4 = PMFMODA >> 1;
PMFENCA_LDOKA = 1; // apply PMF Modulo value
PMFICCTL_PECx = 0x7; // Enable Double Switching
PMFCINV = 0x15;
PMFCFG2_MSK = 0x3F; // Disable PWM at the output
PMFENCA_PWMENA = 1; // Enable PWM
PMFENCA_PWMRIEA = 1; // Reload Interrupt - Used for sampling period generation
PMFENCA_GLDOKA = 1; // 0 = Local LDOKA controls buffered registers / 1 = external Load OK controls buffered registers
PMFFQCA_LDFQA = 1; // Reload every TWO PWM, 10KHZ,page588
}
Hello,
I believe there is a mistake in the assignment:
PMFCCTL_ISENS = 0x10; // assigning hex number of 0x10, leading to 0b000010000 being assigned to two-bit fieldIf you
If your intention is to use mode 10 (Current status sample correction on inputs IS0, IS1, and IS2 during deadtime), please use
PMFCCTL_ISENS = 0b10;
or
PMFCCTL_ISENS = 0x02;
or
PMFCCTL = 0x20;
instead.
Let me know if it works for you.
Best regards,
Matej
/* 死区补偿 -寄存器换向标志位检测换向 */
if(PMFDTMS_DT0 == 0)//正电流
{
f16pwm->f16Arg1 = MLIB_AddSat_F16(f16pwm->f16Arg1, DeadTime_H);
}
if(PMFDTMS_DT1 == 1)//负电流
{
f16pwm->f16Arg1 = MLIB_SubSat_F16(f16pwm->f16Arg1, DeadTime_L);
}
if(PMFDTMS_DT2 == 0)//正电流
{
f16pwm->f16Arg2 = MLIB_AddSat_F16(f16pwm->f16Arg2, DeadTime_H);
}
if(PMFDTMS_DT3 == 1)//负电流
{
f16pwm->f16Arg2 = MLIB_SubSat_F16(f16pwm->f16Arg2, DeadTime_L);
}
if(PMFDTMS_DT4 == 0)//正电流
{
f16pwm->f16Arg3 = MLIB_AddSat_F16(f16pwm->f16Arg3, DeadTime_H);
}
if(PMFDTMS_DT5 == 1)//负电流
{
f16pwm->f16Arg3 = MLIB_SubSat_F16(f16pwm->f16Arg3, DeadTime_L);
}