I want to use one shot software force trip zone to do overcurrent protection. I use software to force the flag setting, but not sure if I still need to set the trip zone source, like TZ1,2,3 or others. Can anyone give some hints? My code is shown below,
PWM setting part:
EALLOW;
EPwm4Regs.TZCTL.bit.TZA = 1; // EPWM4A forces to high
EPwm4Regs.TZSEL.bit.OSHT5 = 1; // /TZ5 is used as one shot trip source, but actually software trip
EPwm4Regs.TZCLR.bit.OST = 1; // clear trip zone flags
EDIS;
EALLOW;
EPwm5Regs.TZCTL.bit.TZA = 1; // EPWM5A forces to high
EPwm5Regs.TZSEL.bit.OSHT5 = 1; // /TZ5 is used as one shot trip source, but actually software trip
EPwm5Regs.TZCLR.bit.OST = 1; // clear trip zone flags
EDIS;
protection part:
void protection(float input, float max)
{
if (input > max)
{
EALLOW;
EPwm4Regs.TZFRC.bit.OST = 1;
EPwm5Regs.TZFRC.bit.OST = 1; // inductor is disconnected from source and load, now connected to GND
EDIS;
}
}