CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to CCS Technical Support

dsPIC33EP512GP506 WDT and Configuration Bit??

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
Tom-H-PIC



Joined: 08 Sep 2003
Posts: 105
Location: New Castle, DE

View user's profile Send private message

dsPIC33EP512GP506 WDT and Configuration Bit??
PostPosted: Wed Jun 14, 2017 7:59 am     Reply with quote

I'm working with the dsPIC33EP512GP506, CCS 5.072 and CCSLoad 5.42.
I'm really confused I thought I was in the know on how the WDT work but that is turning out to delusion! Ha
Ok so first things I'm using CCSLoad and a ICD-64U.
In the old CCSload software there was a way to read the configuration bits.
But now all I can find is the “File” tab and “Configuration/ID” ok so that shows the config on the left and the hex for the config bits on the right.
But I'm totally confused how I link the 1L,1H,2L,2H,etc to the address in the Microchip manual for this. (Table on page 380)
The information on the left side of the window is just wrong.
I also don’t see a way of read the bits to check them.
What am I missing?

So on the WDT I'm trying to set it to ~1s.
This is the config fuses I have set.

Code:

#use delay(clock=140MHz,crystal=16MHz)
//#use delay(clock=140MHz,crystal=16MHz,restart_wdt)

//#FUSES NOWINDIS         //Watch Dog Timer in Window mode
#FUSES WPRES32          //Watch Dog Timer PreScalar 1:32
//#FUSES WPOSTS9          //Watch Dog Timer PostScalar 1:256 = 256ms
#FUSES WPOSTS11         //Watch Dog Timer PostScalar 1:1024 = 1s
#FUSES WDT              //Watch Dog Timer
#FUSES CKSFSM           //Clock Switching is enabled, fail Safe clock monitor is enabled
#FUSES NOJTAG           //JTAG disabled


I have the following in my startup code.
Code:

setup_wdt(WDT_32MS);
setup_wdt(WDT_OFF);


Then below in other code I turn it on with the “WDT_ON”

So all of this is not giving me the 1s I think that it should.
The only way I can get anything to work at all is to set fuses “WPOSTS11” to” WPOSTS16”.

Would someone please explain how this WDT works to me?

Tom
Ttelmah



Joined: 11 Mar 2010
Posts: 19546

View user's profile Send private message

PostPosted: Wed Jun 14, 2017 9:07 am     Reply with quote

First thing is you need the fuse NOWDT!.....

On these chips, once you configure the watchdog with the fuses, this overrides the software control. So the setup_wdt functions can't turn off the watchdog if it is enabled in the fuses. This is Note2, on the RCON register in the data sheet.

So NOWDT.

Then in your code:
Code:

setup_wdt(WDT_1S);
setup_wdt(WDT_ON);

Remember if you are using the ICD, the watchdog will be turned off. Has to be for ICD operation.

'L' and 'H' are simply the high and low words of the 32bit configuration word. The easiest place to look is the end of the .lst file generated when you compile. This has the fuses both in 'word' form, and in text. So:
Code:

Configuration Fuses:
   Word  1L: 365F   WPOSTS16 WDT128 WINDIS NOWDT ICSP2 DEBUG NOWRT NOPROTECT NOJTAG
          H: 0000 
   Word  2L: 9318   EC DISUVREG IOL1WAY OSCIO CKSFSM PR_PLL PLL2 IESO
          H: 0000 
   Word  3L: FFFF   WPFP WPDIS NOWPCFG WPEND
          H: 0000 
   Word  4L: 0000 
          H: 0000 
Tom-H-PIC



Joined: 08 Sep 2003
Posts: 105
Location: New Castle, DE

View user's profile Send private message

PostPosted: Wed Jun 14, 2017 11:14 am     Reply with quote

Thanks Ttelmah!
All working and have a better understanding.
Tom
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
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