Home/Support/Support Forum/machine.reset_cause() not working

machine.reset_cause() not working

0 votes
Hi,

I am attempting to utilize both the watchdog feature and the machine.reset_reason() without any luck.

I am initializing the watchdog based on the documentation and this is working properly:
dog = machine.WDT(timeout=5000, response=machine.HARD_RESET)

In my test I am triggering a watchdog event after a few seconds. Upon reboot, I read out the reset cause like so:
reset_reason = machine.reset_cause()
print("reset reason: " + str(reset_reason))

As a result, reset_reason is always printing 0 even when it is a triggered watchdog event.

I found the list of constants that the machine.reset_cause returns, and I would thing I would return a 4 or a 5 if the cause was a watchdog reset.

https://www.digi.com/resources/documentation/digidocs/90002219/Default.htm#reference/r_constants_reset.htm?TocPath=Machine%2520module%257CReset-cause%257C_____1

Am I doing something wrong that is causing machine.reset_cause() to not return the correct value?

I am operating XB3-24 Digimesh 300B

Thank you.
asked May 17 in XBee3 DigiMesh by backpacker87 New to the Community (46 points)

Please log in or register to answer this question.

1 Answer

0 votes
I suspect you have not implemented one of the needed functions.

import machine
help(machine)
answered Jun 22 by mvut Veteran of the Digi Community (14,352 points)
...