我使用的是28035,想用TZ停止电机,用软件触发TZ锁死pwm输出,但是使用了
EPwm1Regs.TZFRC.bit.OST = 1;
EPwm2Regs.TZFRC.bit.OST = 1;
EPwm3Regs.TZFRC.bit.OST = 1;
之后,还是有PWM输出
TZ是这样初始化的
EALLOW;
// CPU Halt Trip
EPwm1Regs.TZSEL.bit.CBC6=0x1;
EPwm2Regs.TZSEL.bit.CBC6=0x1;
EPwm3Regs.TZSEL.bit.CBC6=0x1;
EPwm1Regs.TZSEL.bit.OSHT1 = 1; //enable TZ1 for OSHT
EPwm2Regs.TZSEL.bit.OSHT1 = 1; //enable TZ1 for OSHT
EPwm3Regs.TZSEL.bit.OSHT1 = 1; //enable TZ1 for OSHT
// What do we want the OST/CBC events to do?
// TZA events can force EPWMxA
// TZB events can force EPWMxB
EPwm1Regs.TZCTL.bit.TZA = TZ_FORCE_HI; // EPWMxA will go high
EPwm1Regs.TZCTL.bit.TZB = TZ_FORCE_HI; // EPWMxB will go high
EPwm2Regs.TZCTL.bit.TZA = TZ_FORCE_HI; // EPWMxA will go high
EPwm2Regs.TZCTL.bit.TZB = TZ_FORCE_HI; // EPWMxB will go high
EPwm3Regs.TZCTL.bit.TZA = TZ_FORCE_HI; // EPWMxA will go high
EPwm3Regs.TZCTL.bit.TZB = TZ_FORCE_HI; // EPWMxB will go high
EDIS;
// Clear any spurious OV trip
EPwm1Regs.TZCLR.bit.OST = 1;
EPwm2Regs.TZCLR.bit.OST = 1;
EPwm3Regs.TZCLR.bit.OST = 1;