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

    New v1.20.0 Release candidate v1.20.0.rc7

    Scheduled Pinned Locked Moved Beta Announcements & Development News
    firmwarepymesh
    28 Posts 13 Posters 5.2k Views 13 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.
    • robert-hhR Offline
      robert-hh @tlanier
      last edited by

      @tlanier said in New v1.20.0 Release candidate v1.20.0.rc7:

      machine.reset() does not zero the utime.ticks_ms() counter.

      That does not really matter, since utime.ticks_ms(), utime.tick_us() and utime.ticks_cpu() are not intended as absolute time stamps, but only intended as to be used for time differences in combination with utime.ticks_diff(). These counters overflow anyhow after a while.

      T 1 Reply Last reply Reply Quote 0
      • T Offline
        tlanier @robert-hh
        last edited by tlanier

        @robert-hh
        My bigger concern was that the machine.reset() is not equivalent to pressing the reset button as the manual suggest. There are definite differences. One difference is the utime.ticks_ms() is not zero'ed. Another difference I discovered by accident. In our design we were having trouble with an occasional I2C bus error which was later resolved by adjusting the pull-up resistor values on the I2C bus. What was more concerning is that after the I2C bus error occurred, there seemed to be nothing I could do in software, including doing a machine.reset(), that would resolve the problem. Only a press of the reset button would allow the I2C bus to function normally again.

        The question now is what else is different between a machine.reset() and a reset button press? Is there reason to believe that we should have an external watchdog that pulses the reset line of the processor to be assured that everything is properly reset after a problem occurs?

        Incidentally, there are valid reasons to want the ticks_ms timer to be zero'ed after reset. If you know the program will be restarted before the timer overflows and if the timer is zero'ed after reset as you would expect, a simple subtraction would work for measuring time differences.

        robert-hhR 1 Reply Last reply Reply Quote 0
        • robert-hhR Offline
          robert-hh @tlanier
          last edited by

          @tlanier I agree that machine.reset() is different from pushing the reset button, and pushing the reset button is different to a power cycle. There are obviously states which are not reset by the code running after machine.reset(). I do not know whether this can be fixed. In any case I would use an external watchdog if long term unsupported operation is needed. There are error states where the internal watchdog also fails.

          R 1 Reply Last reply Reply Quote 0
          • R Offline
            reidfo @robert-hh
            last edited by

            @robert-hh Just thinking out loud, and I haven't really looked into it yet, but could you use an output pin to trigger the reset input? If so, it would prevent having to have a separate watchdog chip (though I can also see why that would be useful).

            robert-hhR 2 Replies Last reply Reply Quote 0
            • robert-hhR Offline
              robert-hh @reidfo
              last edited by robert-hh

              @reidfo According to the data sheet, the reset line has to be low at least 50 µs. If you connect reset to a GPIO pin, that cannot be guaranteed, or even the reset may not be released. Different to others, the ESP32 chip does not have a separate reset input. The pin used for that is CHIP_PU, which powers the chip or at least most of it up/down. So you would anyhow need something like a pulse extender to ensure a proper reset signal. And that must be more than a RC circuit.
              Edit: Looking at typical devices, there is a RC circuit at the reset with a time constant of 1 ms (10k & 100nF). So using that might work.

              1 Reply Last reply Reply Quote 0
              • robert-hhR Offline
                robert-hh @reidfo
                last edited by

                @reidfo SO I tried that. The only Pin that worked for that purpose was P23. All other Pins caused a freeze or constant reset loop. And P23 is used for the SD card. The command sequence was like:

                >>> from machine import Pin
                >>> p=Pin("P23", Pin.IN)
                >>> p(1)
                >>> p=Pin("P23", Pin.OUT)
                >>> p(0)
                

                Setting the Pin to IN first and then p(1) ensures, that when switched to OUT mode the value is high.

                R 1 Reply Last reply Reply Quote 0
                • R Offline
                  reidfo @robert-hh
                  last edited by

                  @robert-hh What pin did you connect P23 to? Did it successfully reset your board?

                  robert-hhR 1 Reply Last reply Reply Quote 0
                  • robert-hhR Offline
                    robert-hh @reidfo
                    last edited by

                    @reidfo The connection was between P23 and Reset (what else). And yes, it did reset the board and the board booted in a normal fashion. The board should have an RC lowpass at Reset to suppress bouncing of the push button.

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

                    Pycom on Twitter

                    Pycom