View previous topic :: View next topic |
Author |
Message |
lmercor
Joined: 31 May 2007 Posts: 20
|
pic freezing. stop working |
Posted: Wed Sep 19, 2007 10:53 pm |
|
|
hello I have a little problem with a hardware I developed.
I'm using a pic18f4550 is kind a large amount of code, and when the hardware start works great, but after a couple of hours it suddenly stop working. I really don't know why, because it start perfect and works perfect for 3 or 4 hours. I've heard that I can use the watchdog to solve this kind of problems, but i don't really have idea how to set up the watchdog, because I've never used it. as I said before I'm using the pic18f4550 and the compiler version is 4.013 and I also have the 3.249.
please can anyone give me a hand with this.
Thanks |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Wed Sep 19, 2007 11:39 pm |
|
|
There are many possible reasons. It could be:
1. Problems in the crystal oscillator circuit
2. Forgetting to add NOLVP to the #fuses
3. Leaving off the ERRORS directive in the #use rs232() statement
4. Lack of 100 nF capacitors to Ground on each of the PIC's Vdd pins.
5. Over-writing the end of an array.
6. Using "too high" of an #opt level.
7. Also, vs. 4.013 is considered to be an "early" version of the compiler.
It might be too buggy to use for your application. Try using vs. 3.249.
There are really tons of other possible reasons.
This post has links to some more of them:
http://www.ccsinfo.com/forum/viewtopic.php?t=30368&start=1 |
|
|
lmercor
Joined: 31 May 2007 Posts: 20
|
|
Posted: Thu Sep 20, 2007 8:59 am |
|
|
thanks for your reply.
Quote: | 1. Problems in the crystal oscillator circuit |
I don't think that was a cristal problem, because starts work fine for 3 hours but suddenly it stops.
Quote: | 2. Forgetting to add NOLVP to the #fuses |
The fuse is set to NOLVP in the code.
Quote: | 3. Leaving off the ERRORS directive in the #use rs232() statement |
I'm not using RS232 comunication.
Quote: | 4. Lack of 100 nF capacitors to Ground on each of the PIC's Vdd pins. |
My hardware has several capacitors of 100n for filtering and also for the usb, by the way i'm also using the usb in the microcontroller, and works fine too.
Quote: | 5. Over-writing the end of an array. |
Probably, I will check this on the code. But is kind of weird because the hardware and software works perfect at the begining.
Quote: | 6. Using "too high" of an #opt level. |
I'm not using any of this. Do you think this could help?.
Quote: | 7. Also, vs. 4.013 is considered to be an "early" version of the compiler. |
Of course I will use the earlier version 3.249
Thanks again for your quickly reply and I will check the links you posted. |
|
|
SherpaDoug
Joined: 07 Sep 2003 Posts: 1640 Location: Cape Cod Mass USA
|
|
Posted: Thu Sep 20, 2007 9:39 am |
|
|
The watchdog is a poor solution, but an easy one. It is better to find the root of the real problem. In addition to what others have said I would also look hard at ESD (static electricity). Does it fail when you touch something or slide something? _________________ The search for better is endless. Instead simply find very good and get the job done. |
|
|
lmercor
Joined: 31 May 2007 Posts: 20
|
|
Posted: Thu Sep 20, 2007 1:35 pm |
|
|
Quote: | Does it fail when you touch something or slide something? |
The system is working fine, and I have checked every hour and still works, so I leave the system works for all the night and in the morning is freeze, and it does not fail when I toch it it freezes itself. the system is a RFID reader.
thanks |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Thu Sep 20, 2007 1:41 pm |
|
|
Run a very simple program that just flashes an LED. Run it all night.
See if it locks up. If so, there is likely a hardware problem. |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Thu Sep 20, 2007 1:54 pm |
|
|
I think I should revise that. It could also be some software interaction
with the RFID device (or some other external device). It could be polling
some status bit from the RFID device, and perhaps the code gets stuck
in that polling loop forever.
Here's a thread where that apparently was the problem.
http://www.ccsinfo.com/forum/viewtopic.php?t=31335 |
|
|
lmercor
Joined: 31 May 2007 Posts: 20
|
|
Posted: Thu Sep 20, 2007 2:09 pm |
|
|
thank you everyone. I will check everything you have mentioned.
Thank you very much again. |
|
|
L.Belanger Guest
|
|
Posted: Thu Sep 20, 2007 4:23 pm |
|
|
maybe did you put a pull up res on the MCLR pin ?
sounds stupid but actually i forget sometimes ;)
+ Does the Xtal have caps on it ? 22pf on each pin to ground to stabilize it... is recommended |
|
|
lmercor
Joined: 31 May 2007 Posts: 20
|
|
Posted: Thu Sep 20, 2007 7:22 pm |
|
|
I'm using the MCLR pin as input, and of course it has the Xtal capacitors |
|
|
ELCouz
Joined: 18 Jul 2007 Posts: 427 Location: Montreal,Quebec
|
|
Posted: Thu Sep 20, 2007 7:44 pm |
|
|
hmmm seriously if your code is ok ,,, then check for power spikes in your voltage ... IMHO i would try on another PIC18F4550
btw, a watchdog will reset you pic if freezed,,, you don't want to have your pic resetted every 3-4 hours ;) |
|
|
lmercor
Joined: 31 May 2007 Posts: 20
|
|
Posted: Fri Sep 21, 2007 9:59 am |
|
|
Well, I did change the pic for another 4550, but yesterday I tried using a 4455 which is almost the same as the 4550 and I left it all night and until now it still working fine.
Thank you for your help. |
|
|
|