Hi,
I have been having difficulty setting up interrupts on the UCD3138 digital power controller. I am trying to set up a Fault pin (Fault 2 pin) to trigger a fast interrupt. However, I have not been able to set up the fault to trigger in the FIQ interrupt routine.
My goal is to set up the Fault 2 pin to generate a gate driver interrupt routine, and shut down PWM's immediately.
Can someone please help me with this issue?
Here's My code initialization ( I also have a PWM 2 interrupt set up)
GioRegs.FAULTIN.bit.FLT2_IN =0; //Set up Faul2 pin for Gate Driver Fault input
MiscAnalogRegs.GLBIOVAL.bit.FAULT2_IO_VALUE = 2;
FaultMuxRegs.EXTFAULTCTRL.bit.FAULT2_POL = 1; // Fault 2 Detected on falling Edge
FaultMuxRegs.EXTFAULTCTRL.bit.FAULT2_INT_EN = 1;
FaultMuxRegs.EXTFAULTCTRL.bit.FAULT2_DET_EN = 1; //FAULT[2] Pin Detection Enable
disable_interrupt();
disable_fast_interrupt(); //make sure fast interrupt is disabled
write_reqmask(CIMINT_ALL_DPWM2 | CIMINT_ALL_PWM2_COMP | CIMINT_ALL_FAULT_PIN); //enable pwm2cmp and DPWM0 interrupt(End of 16th period)(int-priority29)
write_firqpr (CIMINT_ALL_DPWM2 | CIMINT_ALL_FAULT_PIN); // DPWM0 interrupt(End of 16th period) is mapped to FIQ
enable_fast_interrupt();
enable_interrupt();
void fast_interrupt(void)
{
register int32 fiq_number, interrupt_bits;
fiq_number = CimRegs.FIQIVEC.all; // Clear on read
interrupt_bits = FaultMuxRegs.FAULTMUXINTSTAT.all; // Clear on read
/*
volatile Uint32 read_scrap;
*/
GateDriveFault = 1;
if(fiq_number == 30) // Fault Pin Interrupt
{
if(interrupt_bits & 0x400) // If FAULT2
{
MiscAnalogRegs.GLBIOEN.all |= 0xFF;
GateDriveFault = 1;z
}
}