Welcome to the Pycom forum Forum
    • \[\[global:header.categories\]\]
    • \[\[global:header.recent\]\]
    • \[\[global:header.tags\]\]
    • \[\[global:header.popular\]\]
    • Login

    Explore Pybytes | Official Documentation | Report a Firmware Bug/Issue | GitHub

    Documentation: pycom module 'machine'

    Scheduled Pinned Locked Moved Comments & Feedback
    6 Posts 3 Posters 474 Views 3 Watching
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • G Offline
      goldfishalpha
      last edited by

      Just trying to understand the reset conditions for the machine and noticed that the docs are incomplete in relation to reset causes.
      When I run print(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. is machine.HARD_RESET correspond to both machine.reset() and a button push?

      Thank you for your time

      1 Reply Last reply Reply Quote 0
      • A Offline
        alexpul
        last edited by alexpul

        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_RESET

        If 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

        G 1 Reply Last reply Reply Quote 1
        • C Offline
          Colateral
          last edited by

          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?

          G 1 Reply Last reply Reply Quote 1
          • G Offline
            goldfishalpha @alexpul
            last edited by

            @alexpul Thank you. It appears as if counting starts from 0 though.
            To confirm, I spotted that one can run help(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

            A 1 Reply Last reply Reply Quote 0
            • G Offline
              goldfishalpha @Colateral
              last edited by

              @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 returns 0 on a machine.reset_cause().
              Will keep testing as I go along.

              1 Reply Last reply Reply Quote 0
              • A Offline
                alexpul @goldfishalpha
                last edited by

                @goldfishalpha You're right! Sorry for the confusion and good catch (I'll edit my previous post so as not to confuse future readers)

                1 Reply Last reply Reply Quote 0

                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
                • 1 / 1
                • First post
                  Last post

                Pycom on Twitter

                Pycom