|
|
View previous topic :: View next topic |
Author |
Message |
Gon Guest
|
PIC failure ? |
Posted: Tue Feb 28, 2006 10:07 am |
|
|
Hello,
i wanted to know if it was possible for a PIC (a 18F my case) to fail but not its interrupts ?
I mean, if i have a programm on this PIC, and its interrupts handle a LED, would the PIC will still make blink the LED, and doesn't mind that the PIC failed or not ?
I putted some watchdog that sould reset the whole thing, if it fails, but it seems that sometimes, the led is still blinking but the PIC is not 'working' anymore...
Another question :
Is it possible that a PIC fails because of another component, i mean, if on one of its pin, the PIC receive a high level or a low level, is it possible that this component could make the PIC fail ?
Any explanations would be welcome.
Please let me know.
Many thanks.
Best regards. |
|
|
iso9001
Joined: 02 Dec 2003 Posts: 262
|
|
Posted: Tue Feb 28, 2006 11:01 am |
|
|
I have no idea what you are talking about. Try being a little more specific. What is failing ?
If the LED is blinking you pic is running. (Assuming its not one of those dumb blinking leds)
nm: just read watchdog as PCM pointed out
Last edited by iso9001 on Tue Feb 28, 2006 3:37 pm; edited 1 time in total |
|
|
Humberto
Joined: 08 Sep 2003 Posts: 1215 Location: Buenos Aires, La Reina del Plata
|
|
Posted: Tue Feb 28, 2006 11:06 am |
|
|
To assume that a microcontroller can fail is not a good way to begin. Respecting the good
arts of the hardware design + a simple and safe code is the best combination for a
reliable system.
I do not know a single case where one can suppose that a microcontroller works bad, in
the 99,9999% of the cases always is an external cause that produces it, assuming as
external cause a wrong code or wrong hardware or both.
Quote: |
Is it possible that a PIC fails because of another component, i mean, if on one of its pin, the PIC receive a high level or a low level, is it possible that this component could make the PIC fail ?
|
It depends of what do you mean with high level /low level. Microcontrollers
work with voltages that are within an allowed range and that in most of the cases are
between 0V and 5V. Being these logic levels high and low respectively and only the
permissible ones being impossible cause of bad operation.
Humberto |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Tue Feb 28, 2006 12:52 pm |
|
|
Quote: | I putted some watchdog that sould reset the whole thing, if it fails, but it seems that sometimes, the led is still blinking but the PIC is not 'working' anymore... |
This is very likely because the Watchdog Timer is timing out and
causing the PIC to reset. So your LED turns on, and stays on for
the duration of the watchdog timer period. Then when the PIC
resets, the LED goes off. So it looks like it is blinking.
You shouldn't use the Watchdog when you are first beginning to
use PICs and CCS. You should try a very simple program
that blinks an LED, such as the one in this link:
http://www.ccsinfo.com/forum/viewtopic.php?t=23106&start=4 |
|
|
Gon Guest
|
|
Posted: Wed Mar 01, 2006 3:11 am |
|
|
Thank you for the answers.
It is just a small part of my programm to understand what was wrong because it seems to be a bug that comes up once without any reason.
And the only thing i could visualize is the LED, so i try to understand what was wrong in all the hardware or software.
Is it possible that a pic that fails just when a led is on and then, let it switched on although there is a watchdog ?
Is it possible to have a watchdog that fails as well ?
In my case, the PIC is not doing what it should do anymore. But when it failed the led was on and it didn't reset with the watchdog, i don't know why.
I assume that if the pic failed, after the watchdog duration, it should have reset itself...
Quote: | It depends of what do you mean with high level /low level. Microcontrollers
work with voltages that are within an allowed range and that in most of the cases are
between 0V and 5V. Being these logic levels high and low respectively and only the
permissible ones being impossible cause of bad operation. |
Reading this, it may be possible to have a external component that gives not the good level, and i have seen that it had make my pic failed but i am not quite sure because it was linked to a software problem. And in this case i didn't have any watchdog yet.
Now i have a watchdog but it seems to not reset in that strange case and i know it is resetting for other things, because i made it work.
I hope it is more clearer.
Many thanks. |
|
|
rberek
Joined: 10 Jan 2005 Posts: 207 Location: Ottawa, Canada
|
|
Posted: Wed Mar 01, 2006 7:27 am |
|
|
Anything is possible. Microcontrollers can be complex beasts and the failure modes are many. It could fail in thousands of different ways. But is it likely? No. The things that you just did (i.e. firmware, hardware, board layout, construction technique) are most likely the cause.
These are rather open ended questions you are asking, so an exact explanation is NOT possible. Without much in the way of extra detail from you, we can only shrug our shoulders and say "maybe". However, if we had all said, "its the PIC for sure!", what would you do?
You'd have to do this - replace the PIC. If you put in a new device, and the behaviour has not changed, your firmware or the other hardware are at fault. This is where your debuging skills will have to save the day for you.
Debugging firmware will involve code inspection, simulation (in MPLAB or other) or in circuit debugging.
If the hardware is at fault, then you may also have to simulate it, if you have the resources, or get the oscilloscope/logic analyzer out and isolate the offending part.
All the best _________________ The difference between genius and stupidity is that genius has its limits... |
|
|
asmallri
Joined: 12 Aug 2004 Posts: 1634 Location: Perth, Australia
|
Re: PIC failure ? |
Posted: Wed Mar 01, 2006 8:08 am |
|
|
Gon wrote: | Hello,
i wanted to know if it was possible for a PIC (a 18F my case) to fail but not its interrupts ? |
Sounds like a typical software bug to me. Your mainline code appears to go somewhere it is not supposed to go or, more likely, gets in an endless loop. When an interrupt occurs the PIC is correctly passing control to the interrupt handler. At the end of the handler routine the PIC is returning control to the endless loop.
One way I have used to debug these problems is to add a switch on an interrupt input (can be INTx or Interrupt on change). When I see the PIC has crashed I push the button which passes control to the interrupt handler that dumps the contents of the stack. By analysing the stack contents you can determine where the program is looping and, if your lucky enough, the calling routine that passed control to the code sengment with the endless loop. _________________ Regards, Andrew
http://www.brushelectronics.com/software
Home of Ethernet, SD card and Encrypted Serial Bootloaders for PICs!! |
|
|
|
|
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
|