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

WDT times correct for only half the settings

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
2xhp



Joined: 14 Jan 2019
Posts: 39

View user's profile Send private message

WDT times correct for only half the settings
PostPosted: Thu Jan 21, 2021 11:35 am     Reply with quote

Hi,

I'm using a dsPIC33EP64GS804 with compiler 5.100. I get the correct WDT response for half the settings tried. Looks like the ones with a 1 in the LSB are using the next higher time. Results:

WDT_16MS: 32 ms reset
WDT_32MS: 32 ms reset
WDT_64MS: 128 ms reset
WDT_128MS: 128 ms reset
WDT_256MS: 512 ms reset
WDT_512MS: 512 ms reset
WDT_1S: 2000 ms reset
WDT_2S: 2000 ms reset
WDT_4S: 8000 ms reset
WDT_8S: 8000 ms reset

Wondering if this might be a compiler bug or if I'm missing something in the WDT setup somehow.

Thanks in advance.
temtronic



Joined: 01 Jul 2010
Posts: 9246
Location: Greensville,Ontario

View user's profile Send private message

PostPosted: Thu Jan 21, 2021 3:50 pm     Reply with quote

You should post compiler version as well as the list of fuses ( btm of the listing)...

Those that use that PIC can easily figure it out....
2xhp



Joined: 14 Jan 2019
Posts: 39

View user's profile Send private message

PostPosted: Thu Jan 21, 2021 5:59 pm     Reply with quote

temtronic wrote:
You should post compiler version as well as the list of fuses ( btm of the listing)...

Those that use that PIC can easily figure it out....



    Configuration Fuses:
    Word 1L: FFFF NOWRTB NOBSS NOBS NOWRT NOPROTECT NOWPCFG NOPROTECT_CFG NOAIVT
    H: 0000
    Word 2L: FFFF
    H: 0000
    Word 3L: FFFF
    H: 0000
    Word 4L: FFFF
    H: 0000
    Word 5L: FFFF
    H: 0000
    Word 6L: 7FFF
    H: 0000
    Word 7L: FFF8 FRC IESO
    H: 0000
    Word 8L: FF7A HS OSCIO IOL1WAY CKSNOFSM PLLWAIT
    H: 0000
    Word 9L: FFC9 WPOSTS10 WPRES32 WDT_SW WINDIS WDTWIN_25%
    H: 0000
    Word 10L: FFFF
    H: 0000
    Word 11L: FFDE ICSP2 NOJTAG NODEBUG NOBTSWP
    H: 0000
    Word 12L: FFF7 PWMLOCK ALTI2C1 NOALTI2C2 NODBCC
    H: 0000
    Word 13L: FFFF ALTWREG1=NO ALTWREG2=NO
    H: 0000


Compiler version is 5.100.
temtronic



Joined: 01 Jul 2010
Posts: 9246
Location: Greensville,Ontario

View user's profile Send private message

PostPosted: Thu Jan 21, 2021 6:16 pm     Reply with quote

Looks like Word #9 has the watchdog settings ?
Though I don't use that PIC, it looks like the watchdog has pre and post scalers as well as a 'window' range ?? Also can be enabled by software ?
I don't see any obvious 'wdt-value-ms' settings, so does the compiler take your xxxms and convert into pre/post values ?
If so, that may be how the times get messed up.
Again I don't know, just thinking of possible things to look at.
dsPICs are mighty powerful, beyond me...18's are challenging enough for this dinosaur !
2xhp



Joined: 14 Jan 2019
Posts: 39

View user's profile Send private message

PostPosted: Thu Jan 21, 2021 6:22 pm     Reply with quote

temtronic wrote:
Looks like Word #9 has the watchdog settings ?
Though I don't use that PIC, it looks like the watchdog has pre and post scalers as well as a 'window' range ?? Also can be enabled by software ?
I don't see any obvious 'wdt-value-ms' settings, so does the compiler take your xxxms and convert into pre/post values ?
If so, that may be how the times get messed up.
Again I don't know, just thinking of possible things to look at.
dsPICs are mighty powerful, beyond me...18's are challenging enough for this dinosaur !


I thought maybe it was a pre or postscaler. I did try various fuse options for that and no change. But the fact that half the times are correct and the other aren't (and they are adjacent times that are identical) leads me to think it's something outside of my control (i.e. compiler related). But I'm new to the dsPICs, so could very well just be missing something.

Thanks for the thoughts.
Ttelmah



Joined: 11 Mar 2010
Posts: 19553

View user's profile Send private message

PostPosted: Fri Jan 22, 2021 1:23 am     Reply with quote

On all to these chips, the watchdog 'timing' specified in setup_wdt, has to
be translated into fuses. On most of the chips, MicroChip give a table of
the equivalent timings for the prescaler/postscaler combinations. On this
one they don't.
If you look, they use bit 0 for the WDT ON/OFF flag, then have the count
values. They correctly start these at 2. What you have to do is not use the
WDT_ON flag.

Basically:

setup_wdt(WDT_1S);

Without using the WDT_ON flag, does correctly configure one second.

You only use the WDT_ON or WDT_OFF flag "on it's own", to enable or
disable the watchdog. Don't 'OR' this into the value being used.

A quick check, shows the above line gives:
Quote:

Word 9L: FFCA WPOSTS11 WPRES32 WDT_SW WINDIS WDTWIN_25%


Which gives (32000/32)/(2^10) = almost exactly 1 second

Using:
setup_wdt(WDT_2S);
gives
Quote:

Word 9L: FFCB WPOSTS12 WPRES32 WDT_SW WINDIS WDTWIN_25%


The correct 2 second setting.

Generally where flags are to be or'ed in, they do tell you this in the
header file. This one does not say to do this....
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