Part Number: TMS320F28054F
Tool/software: Code Composer Studio
I'm trying to use my 3 current sensing ADC inputs (A1, A3, B1) to implement over current protection (shut down the PWM when current gets too high). I want to use CTRIPM1 as the input to the digital compare submodule, and from there generate a trip in TZ and set all of the ePWM signals low. I can force a trip and cause the pwm to shut off successfully, but cannot generate one from the analog comparators at the ADC pins. Information seems to be pretty scattered on this topic, so any help is appreciated. Thanks.
Here's my relevant code (only working on ePWM 1 right now for simplicity's sake):
AnalogSubsysRegs.ADCINSWITCH.bit.ADCINA1SEL = 0; //Set switch to connect A1 to A1
AnalogSubsysRegs.ADCINSWITCH.bit.ADCINB1SEL = 0; //Set switch to connect B1 to B1
AnalogSubsysRegs.PGAEN.bit.AMPA1EN = 1; // Enable gain amplifier on A1
AnalogSubsysRegs.PGAEN.bit.AMPA3EN = 1; // Enable gain amplifier on A3
AnalogSubsysRegs.PGAEN.bit.AMPB1EN = 1; // Enable gain amplifier on B1
AnalogSubsysRegs.AMPM1_GAIN.all = 0; // Set gain amplifier on A1, A3, B1 (gain of 3 = 0, 6 = 1, 11 = 2)
// Settings for DAC
AnalogSubsysRegs.DACEN.bit.DAC1EN = 1; // enable DAC
AnalogSubsysRegs.DAC1CTL.bit.DACVAL = 32; // 6-bit (/64)
// Settings for analog comparator
AnalogSubsysRegs.COMPEN.bit.COMPA1EN = 1;
AnalogSubsysRegs.COMPEN.bit.COMPA3EN = 1;
AnalogSubsysRegs.COMPEN.bit.COMPB1EN = 1;
// CTRIP
AnalogSubsysRegs.CTRIPA1ICTL.bit.COMPHINPEN = 1;
AnalogSubsysRegs.CTRIPA1ICTL.bit.COMPLINPEN = 1;
AnalogSubsysRegs.CTRIPA3ICTL.bit.COMPHINPEN = 1;
AnalogSubsysRegs.CTRIPA3ICTL.bit.COMPLINPEN = 1;
AnalogSubsysRegs.CTRIPB1ICTL.bit.COMPHINPEN = 1;
AnalogSubsysRegs.CTRIPB1ICTL.bit.COMPLINPEN = 1;
AnalogSubsysRegs.CTRIPM1OCTL.bit.CTRIPA1EN = 1;
AnalogSubsysRegs.CTRIPM1OCTL.bit.CTRIPA3EN = 1;
AnalogSubsysRegs.CTRIPM1OCTL.bit.CTRIPB1EN = 1;
// Settings for trip zone
EPwm1Regs.TZSEL.bit.DCAEVT1 = 1; // enable DC event trip
EPwm1Regs.TZSEL.bit.DCBEVT1 = 1;
EPwm1Regs.TZCTL.bit.DCAEVT1 = 2; // set low on trip
EPwm1Regs.TZCTL.bit.DCBEVT1 = 2;
EPwm1Regs.TZEINT.bit.DCAEVT1 = 1; // enable DC force in TZ
EPwm1Regs.TZEINT.bit.DCBEVT1 = 1;
EPwm1Regs.DCTRIPSEL.bit.DCAHCOMPSEL = 8; // CTRIPM1 input
EPwm1Regs.DCTRIPSEL.bit.DCALCOMPSEL = 8;
EPwm1Regs.DCTRIPSEL.bit.DCBHCOMPSEL = 8;
EPwm1Regs.DCTRIPSEL.bit.DCBLCOMPSEL = 8;
EPwm1Regs.DCACTL.bit.EVT1SRCSEL = 1; // filtered
EPwm1Regs.DCACTL.bit.EVT1FRCSYNCSEL = 1; // asynch
EPwm1Regs.DCBCTL.bit.EVT1SRCSEL = 1;
EPwm1Regs.DCBCTL.bit.EVT1FRCSYNCSEL = 1;


