• AVR Freaks

Harmony 3, PIC32MX174, Watchdog question [SOLVED]

Author
yp66
Starting Member
  • Total Posts : 28
  • Reward points : 0
  • Status: offline
2020/09/26 20:02:41 (permalink)
0

Harmony 3, PIC32MX174, Watchdog question [SOLVED]

I'm using an PIC32MX147256B under Harmony V3 and FreeRTOS and am trying to setup the watchdog and have run into a couple of issues.
 
PROBLEM 1 
=======
First, I tried to enable the watchdog in Harmony configurator as follows:
1) Select "System" in the project graph 
2) Under device & Project Configuration -> PIC2MX174F256B Device Configuration -> DEVCFG1
2a) WDTPS is set to PS2048  (2 second interval)
2b) WDTSPGM is ON 
2c) WINDIS is OFF 
2d) FWDTEN is ON
2f) FWDTWINSZ is WINSZ_25 (default, not relevant as WINDIS is OFF)
 
After generating the code, the plib_wdt.h and plib_wdt.c files are included in the project but trying to compile it generates a syntax error in plib_wdt.c:
 
../src/config/default/peripheral/wdt/plib_wdt.c:73:15: error: '__WDTCONbits_t' has no member named 'WDTCLR'
 
PROBLEM 2 
=======
Next, I am trying to do it in software, so I set the Harmony settings to disable the watchdog.
Under device & Project Configuration -> PIC2MX174F256B Device Configuration -> DEVCFG1
FWDTEN is now OFF
 
I can now activate the watchdog by placing the following in the code.
    WDTCONSET = 0x8000;
As expected, if I do nothing else, the system reboots every two seconds or so (the WDTPS is set to PS2048)
To reset the watchdog, I use this line
WDTCONSET = 0x01;
However, the system continuously reboots and RCON properly indicates the reboot was due to the watchdog.  I am positive the line supposed to reset the watchdog executes as it is flanked by blinking LED code.
 
Any idea on either how to coax Harmony to enable the watchdog in a functional way, or to reset the watchdog when enabled in software?
 
 
 
post edited by yp66 - 2020/09/26 20:44:05
#1

1 Reply Related Threads

    yp66
    Starting Member
    • Total Posts : 28
    • Reward points : 0
    • Status: offline
    Re: Harmony 3, PIC32MX174, Watchdog question 2020/09/26 20:43:37 (permalink)
    4 (2)
    Answering my own question here, as I fell into the Harmony trap again (where I assume) Harmony will "take care" of this so I don't have to dig into the spec sheets.
     
    To clear the watchdog, one needs to write the pattern 0x5743 onto the WDTCLRKEY bits of the WDTCON register and as the device file already includes a structure mapping the register, the statement to reset the watchdog is:
     
        WDTCONbits.WDTCLRKEY = 0x5743;
     
    #2
    Jump to:
    © 2020 APG vNext Commercial Version 4.5