Hi,all I'm coding the PWMA fault isr .But the ISR can only execute one time.WHy?
i set up the isr by PE.The following is my ISR code.Pls give me some advice.
////////////ISR CODE////////////////
#pragma interrupt saveall
void PWMFAULT_ISR(void)
{
PWMA_FSTS0 |= PWM_FSTS0_FFLAG2;
if(PWMfaultflag==0)
{
mSBStat(OFF);
PWMfaultflag=1;
}
PWMA_FCTRL0 &= ~(4); //disable fault interrupt
}
////////////////Clear isr flag every 3 seconds////////////////////////
if(PWMfaultflag==1){
ui16VsbOVCnt++;
if(ui16VsbOVCnt>=3000)
{
ui16VsbOVCnt=0;
PWMfaultflag=0;
mSBStat(ON);
//PESL(PWMA, PWM_CLEAR_FAULTCH0_FLAG, PWM_FAULT2);
//PESL(PWMB, PWM_CLEAR_FAULTCH0_FLAG, PWM_FAULT0);
PWMA_FCTRL0 |= 4;
}
}
Hi RONG,the test code is below:
#pragma interrupt saveall
void PWMFAULT_ISR(void)
{
PWMA_FSTS0 |= PWM_FSTS0_FFLAG2;
if(PWMfaultflag==0)
{
mSBStat(OFF);
PWMfaultflag=1;
}
//PWMA_FCTRL0 &= ~(4); //disable fault interrupt
//PWMA_FSTS0 |= PWM_FSTS0_FFLAG2;
//PWMB_FSTS0 |= PWM_FSTS0_FFLAG2;
}
/////////////////////////////
if(PWMfaultflag==1){
bDCDC_OnOff=1;
ui16VsbOVCnt++;
if(ui16VsbOVCnt>=3000)
{
ui16VsbOVCnt=0;
PWMfaultflag=0;
mSBStat(ON);
//PESL(PWMA, PWM_CLEAR_FAULTCH0_FLAG, PWM_FAULT2);
//PESL(PWMB, PWM_CLEAR_FAULTCH0_FLAG, PWM_FAULT2);
//PWMA_FSTS0 |= PWM_FSTS0_FFLAG2;
//PWMB_FSTS0 |= PWM_FSTS0_FFLAG2;
//PWMA_FCTRL0 |= 4;
bDCDC_OnOff=0;
}
}
I put GPIOB6(CMPB positive input) with 3.3v and this means CMPB is activated a logic 1 and THERE is always a PWMA_FAULT.The PWMFAULT_ISR can only execute 2 times.Then I put GPIOB6(CMPB positive input) with 0v and The PWMFAULT_ISR can execute again.
In fact ,i need clear PWMFAULT after 3 seconds.If I clear the PWMFAULT vevy quickly(in ISR),the PWM will shutdown very short time and restart.This can not protect the PWM.
Hi,
Can you use the manual fault clearing mode? In the PWMA_Fault ISR, you can set a flag. in the PIT ISR, you can check the flag, if the flag is set, you can count a variable in the PIT ISR, when the variable reaches a fixed value, you can clear FSTS[FFLAGx], clear the flag, then the PWM signal will recover.
BR
Xiangjun Rong
Yes,You are right.THis is also my style to realize this function and it can work.
The key point is that when I put GPIOB6 ON 3.3v,PWMA_Fault ISR can not execute.
Maybe U are confused of my operation.
Hi,
First of all, pls make sure that the PWMA_Fault signal(PWMA_FAULT2) has to happens, in other words, the PWMA_Fault signal must appear periodically so that you enters fault ISR multiple times. You use MC56F84768 with 80 pins package, from the RM of MC56F847xx, there is not dedicated pin PWMA_FAULT2 for 80 pins package, so you have to provide the PWMA_FAULT2 via crossbar via XBAR_OUT31.
Can you tell us how you provide the PWMA_FAULT2 signal?
BR
XiangJun Rong
80 — — GPIOG4 PWMB_3B PWMA_FAULT2
HI, the PWMA_FAULT2 signal is the CMPB output with positive input GPIOB6 and negitave input DAC6bB-output.
Hi, David,
If you comment the line //PWMA_FCTRL0 &= ~(4);, can you enter fault ISR many times assuming the fault signal appears multiple times.
#pragma interrupt saveall
void PWMFAULT_ISR(void)
{
PWMA_FSTS0 |= PWM_FSTS0_FFLAG2;
if(PWMfaultflag==0)
{
mSBStat(OFF);
PWMfaultflag=1;
}
//PWMA_FCTRL0 &= ~(4); //disable fault interrupt
}
BR
XiangJun Rong
Hi RONG,the test code is below:
#pragma interrupt saveall
void PWMFAULT_ISR(void)
{
PWMA_FSTS0 |= PWM_FSTS0_FFLAG2;
if(PWMfaultflag==0)
{
mSBStat(OFF);
PWMfaultflag=1;
}
//PWMA_FCTRL0 &= ~(4); //disable fault interrupt
//PWMA_FSTS0 |= PWM_FSTS0_FFLAG2;
//PWMB_FSTS0 |= PWM_FSTS0_FFLAG2;
}
/////////////////////////////
if(PWMfaultflag==1){
bDCDC_OnOff=1;
ui16VsbOVCnt++;
if(ui16VsbOVCnt>=3000)
{
ui16VsbOVCnt=0;
PWMfaultflag=0;
mSBStat(ON);
//PESL(PWMA, PWM_CLEAR_FAULTCH0_FLAG, PWM_FAULT2);
//PESL(PWMB, PWM_CLEAR_FAULTCH0_FLAG, PWM_FAULT2);
//PWMA_FSTS0 |= PWM_FSTS0_FFLAG2;
//PWMB_FSTS0 |= PWM_FSTS0_FFLAG2;
//PWMA_FCTRL0 |= 4;
bDCDC_OnOff=0;
}
}
I put GPIOB6(CMPB positive input) with 3.3v and this means CMPB is activated a logic 1 and THERE is always a PWMA_FAULT.The PWMFAULT_ISR can only execute 2 times.Then I put GPIOB6(CMPB positive input) with 0v and The PWMFAULT_ISR can execute again.
Hi,
You wrote that "Then I put GPIOB6(CMPB positive input) with 0v and The PWMFAULT_ISR can execute again", does it mean that you have solved your issue?
BR
Xiangjun Rong
Maybe this is a better result,but it can not completely satisfy my requirement. "Then I put GPIOB6(CMPB positive input) with 3.3v and The PWMFAULT_ISR can NOT execute again".WHY?In the real engineer application field, GPIOB6(CMPB positive input) with 3.3v can exist.In this application field,I also hope The PWMFAULT_ISR can normally execute by clear PWMFAULT flag or other means.
In fact, I don’t hope to clear PWMFAULT very quickly.I need PWMA shutdown 3 seconds and then clear PWMFAULT to make PWM restart.
This is my PWM FAULT ISR setting up.