56f84786 pwm fault isr

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

56f84786 pwm fault isr

2,869 Views
david_lin
Contributor II

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;
}
}

Tags (1)
0 Kudos
Reply
13 Replies

2,821 Views
david_lin
Contributor II

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.

0 Kudos
Reply

2,820 Views
david_lin
Contributor II

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.

0 Kudos
Reply

2,776 Views
xiangjun_rong
NXP TechSupport
NXP TechSupport

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

xiangjun_rong_0-1618987994552.png

 

0 Kudos
Reply

2,767 Views
david_lin
Contributor II

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.

0 Kudos
Reply

2,847 Views
xiangjun_rong
NXP TechSupport
NXP TechSupport

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

 

 

xiangjun_rong_0-1618816094931.png

 

 

80 — — GPIOG4 PWMB_3B PWMA_FAULT2

0 Kudos
Reply

2,840 Views
david_lin
Contributor II

HI, the PWMA_FAULT2 signal is the CMPB output with positive input GPIOB6 and negitave input DAC6bB-output.

0 Kudos
Reply

2,825 Views
xiangjun_rong
NXP TechSupport
NXP TechSupport

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

0 Kudos
Reply

2,819 Views
david_lin
Contributor II

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.

0 Kudos
Reply

2,793 Views
xiangjun_rong
NXP TechSupport
NXP TechSupport

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

0 Kudos
Reply

2,783 Views
david_lin
Contributor II

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. 

Tags (1)
0 Kudos
Reply

2,818 Views
david_lin
Contributor II

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.

0 Kudos
Reply

2,834 Views
david_lin
Contributor II

CMPB  trigger PWMAFAULT ISRCMPB trigger PWMAFAULT ISR

0 Kudos
Reply

2,865 Views
david_lin
Contributor II

20210417101512.jpg

This is my PWM FAULT ISR setting up.

0 Kudos
Reply