View previous topic :: View next topic |
Author |
Message |
stoyanoff
Joined: 20 Jul 2011 Posts: 375
|
dsPIC30F5015 FAULT pin activation problem |
Posted: Sat Dec 27, 2014 7:34 am |
|
|
Greatings! dsPIC30F5015 has FAULT pins. I`ve connected a RC group on FAULTB. This RC group is driven by pwm pulses - the idea is if there is a problem with the pwm the controller to be shutted down. Here is the problem on power-up when I activate the FAULTB-
Code: |
ENABLE_INTERRUPTS(INTR_GLOBAL);
enable_interrupts(INT_FAULTB);
|
it seems it causes somekind of glitch on the pin, discharging the C and imitating a fault condition. At this moment I`ve passed this problem as I added a software blockage for a few ms after the fault is enabled-
Code: |
#INT_FAULTB
void FAULTB()
{
if(FaultBActive==0) return;
//code
}
|
I have a proper delay on power-up(1s) and after that I`m enabling the fault. I really don`t like this solution. Can you tell me what`s going on? On some reason I think PIN_D9 goes low on enable_interrupts(INT_FAULTB); for short period of time. Can you give me an adive how to bypass it without this software blockage?
Thanks! |
|
|
Ttelmah
Joined: 11 Mar 2010 Posts: 19540
|
|
Posted: Sat Dec 27, 2014 9:42 am |
|
|
Enabling the interrupts won't directly affect anything.
However you have to remember, that the RC, will be discharged on power on, and if the fault pin is low, the fault will trigger. This _will_ have happened during power on, and the interrupt will be latched.
You need to read the fault pin in code, until it goes high.
Then clear the interrupt.
Then enable it. |
|
|
stoyanoff
Joined: 20 Jul 2011 Posts: 375
|
|
Posted: Sat Dec 27, 2014 10:44 am |
|
|
I have 1s power-up delay. So the capacitator is charged! I`ll try to clear the interrupt, before enabling it! |
|
|
Ttelmah
Joined: 11 Mar 2010 Posts: 19540
|
|
Posted: Sat Dec 27, 2014 11:23 am |
|
|
As I said, the interrupt will be latched.
Why wait one second?. Wait for the pin(s) to go high, then you know that the fault is OK. |
|
|
|