View previous topic :: View next topic |
Author |
Message |
Seth Guest
|
PIC18F2620 watchdog issue |
Posted: Tue Jan 17, 2006 3:46 pm |
|
|
Interesting problem. I set the fuses on the chip to WDT128 and then as I enter my code segment I say setup_wdt(WDT_OFF). In the simulator, this sets WDTCON to 0 in the watch window. When I call setup_wdt(WDT_ON) WDTCON shows a 01 implying that the WDT is on. However, when I download this same code to the target, the unit resets under a watchdog recovery condition as if the setup_wdt(WDT_OFF) was never called. Any suggestions? Seems as if this is a compilier issue and I may have to inline some assembler to resolve it. |
|
![](templates/subSilver/images/spacer.gif) |
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Tue Jan 17, 2006 3:54 pm |
|
|
Post a small but complete test program and post your compiler version. |
|
![](templates/subSilver/images/spacer.gif) |
Seth Guest
|
|
Posted: Tue Jan 17, 2006 5:18 pm |
|
|
I was just reading the 18F2620 spec and it says the following note about the WDTCON register :
bit 0 SWDTEN: Software Controlled Watchdog Timer Enable bit(1)
1 = Watchdog Timer is on
0 = Watchdog Timer is off
Note 1: This bit has no effect if the configuration bit, WDTEN, is enabled.
Notice Note 1. This seems to suggest to me that if you use the fuse WDT128 that the configuration bit will be set and software will have no control over this register. This implies to me that I would have to do NOWDT as my configuration setting and then somehow set the speed of the WDT elseswhere which is not possible with the way the CCS compiler is set up. I will keep looking. |
|
![](templates/subSilver/images/spacer.gif) |
Seth Guest
|
another work around not working right |
Posted: Tue Jan 17, 2006 6:08 pm |
|
|
So I'm manually trying to set the watchdog configuration bit so I can work around this watchdog issue. I turned to the write_configuration_memory function and did the following:
int addr[3];
addr[0] = 0x01; //XT osc
addr[1] = 0x19; // power up timer disabled brown out disabled
addr[2] = 0x0E; // disabled WDT 128
// set the configuration bytes
write_configuration_memory(addr, 3);
Problem is is that the target now stalls completely. Any suggestions? |
|
![](templates/subSilver/images/spacer.gif) |
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Tue Jan 17, 2006 9:36 pm |
|
|
Post a small but complete test program that shows the problem
and post your compiler version. |
|
![](templates/subSilver/images/spacer.gif) |
|