|
|
View previous topic :: View next topic |
Author |
Message |
Prefekt
Joined: 21 Oct 2010 Posts: 85
|
18F46K22 slow |
Posted: Fri May 13, 2016 7:37 am |
|
|
Hello,
I have two identical pcb with PIC18F46K22. One board is running fine. But the pic on the other board is very very slow.
I send over UART232 with delay_ms(1000), incorrect data came every 30 seconds!
Code: |
#include <18F46K22.h>
#device ADC=10
#fuses WDT, WDT512, NOPROTECT, BROWNOUT, PUT, NOLVP, PLLEN
#use delay(crystal=10mhz, clock=40mhz, restart_wdt)
|
|
|
|
ezflyr
Joined: 25 Oct 2010 Posts: 1019 Location: Tewksbury, MA
|
|
Posted: Fri May 13, 2016 8:09 am |
|
|
Hi,
The most likely issue is that the primary oscillator is not starting on the problem board, and the chip is falling back to one of the internal oscillators. To test this theory, add the Fuse 'NOFCMEN' and see if the board stops working completely....
If that's the problem, check the board carefully for solder whiskers, the wrong crystal, the wrong crystal caps, etc., etc. _________________ John
If it's worth doing, it's worth doing in real hardware!
Last edited by ezflyr on Fri May 13, 2016 8:10 am; edited 1 time in total |
|
|
temtronic
Joined: 01 Jul 2010 Posts: 9226 Location: Greensville,Ontario
|
|
Posted: Fri May 13, 2016 8:09 am |
|
|
1) NOT a complete program so we can't copy/paste/test....
2) get rid of the WDT ! NOT necessary for 99.999% of program
3) since 1 of 2 PICs works fine, swap PICs onto other PCBs.
IF ( PIC #1 works on PCB #2) THEN PCB #1 is faulty ELSE PIC#2 if faulty
Jay |
|
|
Ttelmah
Joined: 11 Mar 2010 Posts: 19510
|
|
Posted: Fri May 13, 2016 9:28 am |
|
|
I agree with ezflr.
You can prove this instantly, by programming with NOFSCM. If the chip then does nothing, you know that the primary oscillator is not starting.
Probably something like a whisker, or a faulty crystal.
The default here will be 1Mhz, so 1/40th what the chip is expecting, so I'd expect the output to be at 40sec intervals.
Agree then with Temtronic, especially for people who then add 'restart_wdt' to the timing code.....
Understand that a watchdog, is used to handle code that is still running, but not doing what it should. If you scatter 'restart_wdt' operations throughout the code, this stops the watchdog doing anything useful at all!...
Programming a watchdog to actually be useful, requires you spend significant time designing the code, so it can only reach the restart_wdt instruction if the code is running correctly. This requires careful programming. Otherwise get rid of it. |
|
|
Prefekt
Joined: 21 Oct 2010 Posts: 85
|
|
Posted: Fri May 13, 2016 12:44 pm |
|
|
I found the mistake.
I use the TQFP44 case and as a connection between two pins was. Difficult to measure, but after the use of solder wick, the PIC runs without problems ...
What is the meaning of the fuse NOFCMEN?
Thanks
Volker |
|
|
ezflyr
Joined: 25 Oct 2010 Posts: 1019 Location: Tewksbury, MA
|
|
Posted: Fri May 13, 2016 12:49 pm |
|
|
Hi,
Good news! QFP packages can be a bit of a challenge for hand work, so it's always good to have some solder wick on hand!
NOFCMEN = No Failsafe Clock Monitor Enabled. The failsafe clock monitor is used to detect whether the primary oscillator is running or not. If not, and the feature is enabled, the chip will start running on one of the internal oscillators. _________________ John
If it's worth doing, it's worth doing in real hardware! |
|
|
|
|
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
|