Part Number:TMS320F28035
想请问一下目前TripZone功能使用上碰到点问题
目前在TZ中断里面去清TZCLR[CBC],却不见效果(确实有进入中断)
只能等CTR=zero 去CLEAR
有叫出Expressions去看内部站存器没有发生变化
请问这有办法解决吗
Green Deng:
你好,我看你的程序应该是根据例程的基础修改的?例程中pwm1的配置是单次触发模式,不知道你的程序中有没有做相应的更改?或者,你的程序有做过其他修改吗?
,
Zhao Bosheng:
我是从这份例程去进行修改的Example_2803xEPwmDCEventTripComp想把OST改成CBC模式
有对程式做出一些修改目前一定要等CTR=zero才能清除,没办法手动清除
下面是目前TZ部分的程式码
EALLOW;
// Define an event (DCAEVT1) based on TZ1 and TZ2EPwm1Regs.DCTRIPSEL.bit.DCALCOMPSEL = DC_COMP1OUT; // DCAL = Comparator 1 output
// EPwm1Regs.TZDCSEL.bit.DCAEVT2 = TZ_DCAL_LOW; // DCAEVT2 = DCAL low(will become active as Comparator output goes low)
EPwm1Regs.DCACTL.bit.EVT2SRCSEL = DC_EVT2; // DCAEVT2 = DCAEVT2 (not filtered)EPwm1Regs.DCACTL.bit.EVT2FRCSYNCSEL = DC_EVT_ASYNC; // Take async path
EPwm1Regs.TZSEL.bit.DCAEVT2 = 1;
EPwm1Regs.TZCTL.bit.TZA= TZ_FORCE_LO; // EPWM1A will go highEPwm1Regs.TZCTL.bit.TZB = TZ_NO_CHANGE; // EPWM1B will go low
EPwm1Regs.TZEINT.bit.CBC = 1;
EPwm2Regs.DCTRIPSEL.bit.DCALCOMPSEL = DC_COMP1OUT; // DCAL = Comparator 1 output
EPwm2Regs.TZDCSEL.bit.DCAEVT1 = TZ_DCAL_LOW; // DCAEVT2 = DCAH low(will become active as Comparator output goes low)
EPwm2Regs.DCACTL.bit.EVT2SRCSEL = DC_EVT2; // DCAEVT1 = DCAEVT2 (not filtered)EPwm2Regs.DCACTL.bit.EVT2FRCSYNCSEL = DC_EVT_ASYNC; // Take async path
EPwm2Regs.TZSEL.bit.DCAEVT2 = 1;
EPwm2Regs.TZCTL.bit.TZA = TZ_FORCE_LO; // EPWM2A will NO CHANGEEPwm2Regs.TZCTL.bit.TZB = TZ_NO_CHANGE; // EPWM2B will NO CHANGE
EPwm3Regs.DCTRIPSEL.bit.DCALCOMPSEL = DC_COMP1OUT; // DCAH = Comparator 1 outputEPwm3Regs.TZDCSEL.bit.DCAEVT2 = TZ_DCAH_LOW; // DCAEVT2 = DCAH low(will become active as Comparator output goes low)EPwm3Regs.DCACTL.bit.EVT1SRCSEL = DC_EVT2; // DCAEVT2 = DCAEVT2 (not filtered)EPwm3Regs.DCACTL.bit.EVT1FRCSYNCSEL = DC_EVT_ASYNC; // Take async path
EPwm3Regs.TZSEL.bit.DCAEVT2 = 1;
EPwm3Regs.TZCTL.bit.TZA = TZ_FORCE_LO; // EPWM3A will NO CHANGEEPwm3Regs.TZCTL.bit.TZB = TZ_NO_CHANGE; // EPWM3B will NO CHANGE
EDIS;
,
Aiden zhang:
我觉得这个现象是正常的,因为 CBC Latch只能在 CTR = ZERO时自动清除。而你通过TZCLR[CRC]清除的只是TZFLG,当CTR还没到ZERO时,CBC Latch是依然存在的,就算你通过TZCLR[CRC]清除了是一下TZFLG,马上又会置1,所以你看到操作不成功是正常的。
记住:CBC Latch这个事件锁存只有在外部TZ条件已经消失,CTR=ZERO才会被自动解锁。