CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to CCS Technical Support

override restart_wdt

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
freeman3020



Joined: 23 Oct 2015
Posts: 7

View user's profile Send private message

override restart_wdt
PostPosted: Fri Oct 23, 2015 3:45 am     Reply with quote

hi all

I have embedded system that control AC line with relay. All things ok,
this system is run 24/7, the problem is some time every few days 3 to 4,
uC is latch-up and internal WDT not restart.

I got idea to make external wdt, but my code has a lot of delay_ms.
I need internal function restart_wdt > to trigger external WDT ?
Can I do?
Ttelmah



Joined: 11 Mar 2010
Posts: 19553

View user's profile Send private message

PostPosted: Fri Oct 23, 2015 4:43 am     Reply with quote

Before starting, I'd be fixing what is causing the latch up.

It sounds as if almost certainly you have something inductive (probably the relay coil), that is not having it's flyback energy when you switch it off properly trapped. You have to remember that the energy needs to go _somewhere_, and if some of it goes through the pins of the PIC, you can be talking voltages and currents that will hang the chip, and if left unhandled, after a longer period will _destroy_ the chip. Every time it is hung like this it probably implies that the FET's have become reverse biased. This will result in their eventual destruction.....

Put a snubber on the relay.
temtronic



Joined: 01 Jul 2010
Posts: 9246
Location: Greensville,Ontario

View user's profile Send private message

PostPosted: Fri Oct 23, 2015 5:27 am     Reply with quote

Another possible problem is the EMI created by the relay contacts when switching on the AC load.
Contacts that are gold plated are much better that the standard silver plated ones though they cost a little more.
You can eliminate that source by using an SSR (Solid State Relay).
The other source of EMI is the actual AC load, be it a motor or FL lighting.

It might even be something 'nearby', say an arc welder,grinder,cell phone, ???. Maybe record when the PIC fails, if possible, and see what was happening in the area.

Without knowing more about your project it is hard to say where this EMI is
coming from but you do need to track down the source and get rid of it.

Jay
guy



Joined: 21 Oct 2005
Posts: 297

View user's profile Send private message Visit poster's website

PostPosted: Fri Oct 23, 2015 3:33 pm     Reply with quote

Quote:
I need internal function restart_wdt > to trigger external WDT ?
Can I do?

If you are using your own restart_wdt() call you might be able to replace it with a function that does something else. The restart that's built into delay_ms (code created by the compiler) cannot be replaced.
newguy



Joined: 24 Jun 2004
Posts: 1909

View user's profile Send private message

PostPosted: Fri Oct 23, 2015 4:25 pm     Reply with quote

guy wrote:
Quote:
I need internal function restart_wdt > to trigger external WDT ?
Can I do?

If you are using your own restart_wdt() call you might be able to replace it with a function that does something else. The restart that's built into delay_ms (code created by the compiler) cannot be replaced.


Code:
void my_delay_ms(unsigned int16 delay) {
   unsigned int16 i;

   for (i = 0; i < delay; i++) {
      // "pet" your external watchdog IC here
      delay_ms(1);
   }
}


Use the same approach to implement a delay based on delay_us().
freeman3020



Joined: 23 Oct 2015
Posts: 7

View user's profile Send private message

PostPosted: Sat Oct 24, 2015 12:20 am     Reply with quote

thanks all

For latch-up I tried all method to isolate EMI effect,
I use uln2003 and all pin have 1 Nano cap.

I will try newguy suggestion.
Ttelmah



Joined: 11 Mar 2010
Posts: 19553

View user's profile Send private message

PostPosted: Sat Oct 24, 2015 1:16 am     Reply with quote

First thing, where does the pin on the ULN, that traps the flyback connect to?. How much capacitance is on this?. How does the rail connect?.
Then you talk about a 1nF capacitor. Look instead at the snubber network I've already mentioned. This wants to be across the relay coil. A simple capacitor on the output, does not give the trapping effect that an RC across the actual coil gives.
Then look at the possibility of RF effects. An undriven pin for example, is a classic easy way to cause problems.
The point is that if the chip locking, it is a sure sign that significant energy is going somewhere. There are solutions to possibly control an external WDT, but you _must_ cure the problem first. A watchdog should be a 'last resort' to catch that 'one in a million' thing that is not being handled otherwise. I'd not use a watchdog, _until_ I have a circuit that runs 99.99% of the time perfectly without it.

It's like the guy with a car that veers right, so he puts a weight on the left hand side of the steering wheel......
freeman3020



Joined: 23 Oct 2015
Posts: 7

View user's profile Send private message

PostPosted: Sat Oct 24, 2015 4:55 am     Reply with quote

Ttelmah wrote:
First thing, where does the pin on the ULN, that traps the flyback connect to?. How much capacitance is on this?. How does the rail connect?.
Then you talk about a 1nF capacitor. Look instead at the snubber network I've already mentioned. This wants to be across the relay coil. A simple capacitor on the output, does not give the trapping effect that an RC across the actual coil gives.
Then look at the possibility of RF effects. An undriven pin for example, is a classic easy way to cause problems.
The point is that if the chip locking, it is a sure sign that significant energy is going somewhere. There are solutions to possibly control an external WDT, but you _must_ cure the problem first. A watchdog should be a 'last resort' to catch that 'one in a million' thing that is not being handled otherwise. I'd not use a watchdog, _until_ I have a circuit that runs 99.99% of the time perfectly without it.

It's like the guy with a car that veers right, so he puts a weight on the left hand side of the steering wheel......


do you have any idea or circuit for snubber network if the relay switch big 220v 10A transformer ?
asmboy



Joined: 20 Nov 2007
Posts: 2128
Location: albany ny

View user's profile Send private message AIM Address

PostPosted: Sat Oct 24, 2015 6:31 am     Reply with quote

Quote:

any idea or circuit


post your schematic and we may be able to help
guy



Joined: 21 Oct 2005
Posts: 297

View user's profile Send private message Visit poster's website

PostPosted: Sat Oct 24, 2015 8:32 am     Reply with quote

If you trigger a relay that triggers a big transformer it's almost certainly EMI since you have double the interference during switching. Eventually it could kill the PIC regardless of the watchdog.
Ttelmah



Joined: 11 Mar 2010
Posts: 19553

View user's profile Send private message

PostPosted: Sun Oct 25, 2015 2:39 am     Reply with quote

As it stands, you _will_ destroy your relay contacts quite quickly....

You need three separate pieces of suppression.

First an X rated capacitor, in series with a resistor, across the relay contacts (say 0.1uF X2), in series with a 120R (mains rated) 1W resistor.
This serves to help rapidly kill the arc across the relay contacts, when they 'break', while not introducing too much current through the contacts when they make.
This on it's own will be quite an improvement, but I'd then add a MOV across the actual transformer coil. This limits the maximum voltage that can be generated by the coil when the drive switches 'off'. Because of the suppression already introduced by the RC, you can use a higher voltage varistor, than would normally be used on it's own. Perhaps about 320v. This reduces the heating effect on the varistor. You'd need to choose a power rating based on how often the contacts are going to switch.
Then the trap diodes on the ULN driver, need to trap into a power rail that has sufficient capacitance to absorb the energy here without rising too much. You might want to consider using a separate rail from the 'supply' at this point, perhaps a simple rail fed from the local supply by a 50R resistor, with it's own capacitor to ground of a 100uF, in parallel with a 0.1uF ceramic. This provides a filter path 'back' to the local supply, reducing the coupling of the trapped energy into the rail.

As a 'comment', beware slightly of the suggestion to use an SSR. Look at this:
<http://www.te.com/commerce/DocumentDelivery/DDEController?Action=srchrtrv&DocNm=13C3206_AppNote&DocType=CS&DocLang=EN>

There are special SSR's designed to handle this, but it is a 'caveat' that it is important to be aware of....
temtronic



Joined: 01 Jul 2010
Posts: 9246
Location: Greensville,Ontario

View user's profile Send private message

PostPosted: Sun Oct 25, 2015 5:35 am     Reply with quote

QUENCHARC
Only took me 2 days to remember the name. Must be getting old !
It's a combination resistor/capacitor used like Mr. T's 2 part solution.Made by Cornell-Dublier(sp), easy enough to Google it though.

also
a zero cross optotriac SSR might help. I designed my own 25 years ago to control gas furnaces in large industrial plants. Think of LOTS of unshielded wires to 5-6 overhead 250,000 BTU furnaces. I never ,ever lost a PIC in any of the controllers.

Jay
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group