Dear all,
I configured analog comparators for UV and OV protection. Analog comparators works properly. Also interrupts of a comparators were configured. During my tests, I observed PWM outputs and FAULTMUXINTSTAT and FAULTMUXRAWSTAT. When the fault occurs, PWMs are shut down. However, there is no change on FAULTMUXINTSTAT or FAULTMUXRAWSTAT.
I know reading FAULTMUXINTSTAT clears that bit, therefore I thought that FAULTMUXINTSTAT register may not be observed for this reason. To overcome this problem, corresponding interrupt software in below is used:
#pragma INTERRUPT(standard_interrupt,IRQ)
void standard_interrupt(void)
{
if (CimRegs.IRQIVEC.all == 26) //interrupt source is analog comparators.
{
D_T1 = 1; //Initialized as 0. If analog comparator interrupt occurs, D_T1 is 1
switch (fault_status)
{
case (No_Fault):
if(FaultMuxRegs.FAULTMUXINTSTAT.bit.ACOMP_B == 1 ) //If interrupt source is comp B, change fault_status as V1_OV
fault_status = V1_OV;
else if(FaultMuxRegs.FAULTMUXINTSTAT.bit.ACOMP_C == 1 ) //If interrupt source is comp C, change fault_status as V1_UV
fault_status = V1_UV;
}
}
D_T2 = fault_status;
}
In this interrupt routine, D_T1 is seen as 1 in the memory debugger but D_T2 variable does not change. I am sure there is no other analog comparators enabled. If there is another way to detect which comparator starts interrupt routine, I would be appreciated if you help me.
Thanks
Regards
Merih