Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

method for protecting MCU program from hanging

Status
Not open for further replies.

Vicent Yang

Member level 5
Member level 5
Joined
Dec 31, 1999
Messages
88
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,286
Location
Taiwan
Activity points
697
mcu watchdog problems

I need any book or papers on the methods used to protect MCU programs from hanging during runing.
 

You can just use the watch-dog timer in the MCU.
Look for watchdog in your MCU's datasheet.
The wathdog timer can reset the MCU if it hangs.
 

2 words describe it. Prevention and Cure. Prevention is standard noise supression techniques. Good PCB, wiring, filtering, isolation etc. Cure is a watchdog timer and a CPU supervisor chip like DS1232 from dallas.
 

As said above you should use a watchdog timer (with its own oscillator) and a brownout detector (which should trigger a hardware reset) as many cpu supervisor circuits can do.

I have very good success useing Microchip Pic's and Atmel AVR's (many of their chips have both peripherals integrated).

hope this helps
 

Yes all of the above helps ..! you also have to be aware of static paths specially in portable equipment . Some times if your keyboards are not well isolated, moisture ort just static electricity can find its way to electronic circuitry, zapping it.
I had a design some time ago that it will always give me trouble in winter time . The time where the heating is on . And rugs are electrically charged .
it was very obvious !
 

I have had problems with static as well. But havent figured it out how to protect the keyboards from carrying the static to the circuits. Even if it is plastic (a good insulator), it still carries the static charge all the way to the CPU. I am using AT89C2051 inside a small metal box that has a telephone type keypad on it. it often happens that the chip is either found dead or erased. And it is has happened on many of such units.

eltonjohn, can you shed some light on it.
 

HI Techie friend

Listen in my case i had a monumental problem, i had thousands of handhelds .. and they were failing . But i had been imposed the plastics
keyboard and switches .Every body was pointing at my design .
Until i proved that was a Serious STATIC problem .Also every body new that most of the problems will only happen in winter.
Anyways . The design used a couple of CPUS . One 32 bits where the keyboard was attached and a PIC that was used as a power managment supervisor .And responsable of ADC power related functions and responsable of starting the big CPU . It turns out that a POWER ON switch was also connected to the PIC . The pic will only wake up through a port interrupt by the membrane POWER ON SWITCH ..
Now , i only had the keyboard and a couple of membrane switches . both could be the source of the static path . So i decided to redesign the cheap one at fist .. I used optocouplers in the two membranes switches .
The PROBLEM WENT AWAY! ... FORTUNATLY for me and the COMPANY!.

Listen when you use CMOS devices there is always a chance , keyboards and buttons .might have a path to the circuitry if no serously consider .. Sometimes we designers are so concentrated in the design that we just go trough catalogs and we don't pay attention to the ISOLATION specs of a DEVICE .. Or even worst
SOMEBODY else does it .. Later the products are out there failing We never saw the PROBLEM in the lab ! that can kill a company!
So my advice is see wich one is the most likely path to the circuitry and try to replace the switch device or OPTOISOLATE .
 

Designing a stable and reliable micro based circuit takes a special wisdom. Even if you intend to use an external watchdog timer, even then you have to take care on the way you are going to strobe it. The micro can get stuck in a loop that still strobes the 1232 and nothing will get it out of it. Interrupt vectors can still function even the micro is completely confused.
 

In some cases the software hang and there is a refresh for the internal or the external watch dog. I think there must be a software watch dog. Is there is any book covering this issue.
 

Not every error is due to static and cosmic rays or little men in the chip redirecting the elektrons!

99% of the errors are things you wrote yourself! (and the uCis just acting as it should!). Use of the watchdog and a good programming methods can help but the best solution is probably TESTING!!! (and if it's possible, let someone else test the code you wrote. It's always fun to find bug's in other ppls code ;-) )

Antharax
 

eltonjohn, when you say OPTOISOLATE, you mean that the keypad should be optoisolated by isolators like 4N25. But still we need some active devices to drive the 4N25 inputs. Can you attach some schematic.
 

2 diodes conneccted to circuit input middle to input
others to ground and + power supply culd prevent static damage . Actually there are such diodes inside the mcu , but I suppose they could not drive either the static voltage or static shortcircuit current - there will be damaged . Actully it is better to prevent circuit first ,
becausse in some case damage can also be done by not only static electricity but by let dsay mobile phones placecd closed to your mcu . So even perfectly combined materials will not help , or another method could be to use high impedance resistors discharging the static electricity but not affecting circuit , or zener or other type of protecting
components . Also it iss possible to connect keyboard not directly but through resistors and following them diodes as mentioend above or we can avoid diodes as well - as the input impedance is high resistors will not affect input input signal but will reduce static discharge current and protecting diodes ion mcu chip will be enough to handle discharge current . These methods can be combined to find relevant and cheapest solution .
 

I am not too keen on internal watchdogs, the problem being is that they need to be started again in software. If you get a burst of noise that continues through the startup procedure, the WD will not be intialised again. I would advise that if you do use an external WD chip, you should AND together at least 2 separate CPU signals to that the reset pulse is from more than one simultanious souce. I have had occasions when sufficient activity remains on a pin, even though the program is locked.
 

I am afraid the diodes dont work very well here. For one thing, the diodes have a certain speed limiation whereby the high slewrate of the static discharge reaches sensite part before the diodes begin to bypass it. Resistors etc are also not much help as they are also not fast enough to cope with. Opto isolation seemed like a good idea if eltonjohn can shed some more light on it.
 

But what if we are not retricted in speed , and we can use the 1 order low pass filter , so capsitor value will be more than possible static charge , and this low pass filter will reduce edge rising time so internal builtin diodes will work within expected frequency limits ?

For optoisolation please note that optopairs have limited protection from input to output - about 500-800 V guarrantied but static electricity voltage in most cases is much more high . And those case are dangerous ones leading to damage .
 

I have used before TVS devices from ST for the protection of the Keypad ports from static charges. ST have a good TVs array devices. I think you need to take a look to this devices because its a very effective.
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top