Documentation: pycom module 'machine'
-
Just trying to understand the reset conditions for the machine and noticed that the docs are incomplete in relation to reset causes.
When I runprint(machine.reset_cause())I am returned an interger value. The list at Reset Causes does not have reset listed against their correspoding integer values AND there is no explanation of the the 'methods'; e.g. ismachine.HARD_RESETcorrespond to bothmachine.reset()and abutton push?Thank you for your time
-
If you do
machine.reset_cause()then the numbers correspond to the reset causes list
0 - machine.PWRON_RESET
1 - machine.HARD_RESET
2 - machine.WDT_RESET
3 - machine.DEEPSLEEP_RESET
4 - machine.SOFT_RESET
5 - machine.BROWN_OUT_RESETIf you do
machine.wake_reason()then the numbers correspond to the wake reasons list
0 - machine.PWRON_WAKE
1 - machine.PIN_WAKE
2 - machine.RTC_WAKE
3 - machine.ULP_WAKE -
machine.HARD_RESET never happens: nor at push button(POWER RESET) and never on machine.reset() (that actually is tided to WDT_RESET)
When this cause is happening?
-
@alexpul Thank you. It appears as if counting starts from
0though.
To confirm, I spotted that one can runhelp(machine)to get a list..
PWRON_RESET -- 0
HARD_RESET -- 1
WDT_RESET -- 2
DEEPSLEEP_RESET -- 3
SOFT_RESET -- 4
BROWN_OUT_RESET -- 5
PWRON_WAKE -- 0
PIN_WAKE -- 1
RTC_WAKE -- 2
ULP_WAKE -- 3 -
@Colateral Thank you for your response. I am just thinking along the lines of logging reset reasons for my device.
e.g. If I get a WDT reset at a certain time, check and save the reason on restart of system. Would be handy for analysing software/system stability.
However, I have just noticed that a reset button press returns0on amachine.reset_cause().
Will keep testing as I go along. -
@goldfishalpha You're right! Sorry for the confusion and good catch (I'll edit my previous post so as not to confuse future readers)
Hello! It looks like you're interested in this conversation, but you don't have an account yet.
Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.
With your input, this post could be even better 💗
Register Login