Pic32MZ Watchdog clearing

General discussion on mikroBasic PRO for PIC32.
Post Reply
Author
Message
Rusty73
Posts: 1
Joined: 17 Jun 2022 02:21

Pic32MZ Watchdog clearing

#1 Post by Rusty73 » 17 Jun 2022 03:37

I have written a project for Pic32MZ0512EF and am just trying to finalize the project.
Turning on the Watchdog timer, the watchdog does what it is supposed to resets the processor after the time out.


Using ClrWdt() does not work, it is just setting bit0 of the WDCON register which is for PIC32MX not the PIC32MZ. In the PIC32MZ in fact it turns on window mode.

I am having issues clearing the WDTCLRKEY, I cant work out how to write 0x5743 to the upper 16bits of WDCON "in a single 16 bit write operation" (as per the datasheet for this processor).

I have tried a lot of different ways to do this with no success.

I created - Dim WDTCONKEYCLR as word absolute 0xBF80080A sfr (being the WDCON register is 0xBF800800, with WDCONSET being 0xBF8000808, so by creating at 0xBF80080A should be the upper word

and periodically - set
WDTCONKEYCLR = 0x5743

but this does not seem to work. if I look at the lst file for the command for this instruction -

;ProjectA.mbas, 490 :: WDTCONKEYCLR = 0x5743 'reset the watchdog timer
0x9D01A25C 0x34025743 ORI R2, R0, 22339
0x9D01A260 0x3C1EBF80 LUI R30, 49024
0x9D01A264 0xA7C2080A SH R2, 2058(R30)

the code looks alright the only issue I see is that this is a 32 bit write and the data sheet states must be a single 16 bit write operation. But how can I get a 16 bit write with a 32 bit command set?

Can anyone help to guide on what I am doing wrong? or a sample of Pic32MZ watchdog clearing in MikrobasicPro for pic32

Post Reply

Return to “mikroBasic PRO for PIC32 General”