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

    Pytrack i2c causes system to freeze

    Scheduled Pinned Locked Moved Expansion Board
    6 Posts 3 Posters 211 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.
    • P Offline
      Peter Ehses
      last edited by

      Hi,
      I'm trying to connect a GPy to a Pytrack, check GPS and battery, run some other code, then turn the pytrack and gpy off.
      Half of the time I'm getting I2c errors, garbage GPS output and battery readings, but those I can try/catch.
      The problem I can't wrap my head around are random freezes when initializing the pytrack.
      Those cause the entire board to cease function with only a reset returning it to working condition.

      This is the code that causes the freeze. I try to initialize as shown in the documentation with an added try / catch / repeat if there are i2c errors which is the case most of the time.
      This is ~10s after starting, since waiting to init i2c helped for others. I also tried to reinstall the pytrack firmware, gpy firmware and tried a wipy and another gpy instead, all with the code freshly uploaded.

      
      def initPyCoProc():
          global py
          pydone = False # is the init successful and done?
          while not pydone:
              try:
                  print("try")
                  py = Pytrack() # init happens here, freeze also.
                  pydone = True
                  print("pytrack init success")
              except Exception as e: # try to catch whatever causes the connection to fail
                  print(e)
                  time.sleep(2) # try again after 2 seconds
          py.gps_state(gps=True) # unrelated function added to pycoproc lib to turn gps on / off independently. No effect on freeze behavior if removed
      

      The only thing that can stop the freeze is a manual reset or one through a WDT. I'd like to not have to add WDT code through my entire codebase.

      Are there any known solutions for this apart from the somewhat hacky watchdog timer reset? Is there any known reason for this behavior?
      Ideally, I'd like my code to run reliably...

      1 Reply Last reply Reply Quote 0
      • C Offline
        crumble
        last edited by

        Since version 1.20.1(r1)? my communication problems between LoPy and pytrack are gone.

        There is only one left, which seems to be related to the L76. Init fails sometimes. In this case I have to reboot the L76. Cause you cannot communicate with the chip, you have to cut the power supply . Either manually or by calling the pytracks deepsleep method with GPS parameter.

        P 1 Reply Last reply Reply Quote 0
        • P Offline
          Peter Ehses @crumble
          last edited by

          @crumble the lastest firmware I see in the pycom firmware update tool (dev builds enabled or not) is 1.20.0rc13
          I don't see a newer version here either.
          My Pytrack is on firmware 0.0.8 which seems to be the latest.
          Did you flash from a file or would this be due to differences between lopy and gpy?

          C 1 Reply Last reply Reply Quote 0
          • C Offline
            crumble @Peter Ehses
            last edited by

            @Peter-Ehses

            This is not the latest one. You will get 1.20.1(r1) only if you choose the pybytes option.

            Version 1.20.0.x is based on IDF 3.1, version 1.20.1 on IDF 3.2.
            IDF is the development environment from Xtensa for its ESP32 microcontroler. Version 3.2 fixed a lot of issues regarding i2c. With 1.20.0.x I got a lot of garbage from the L76 as well.

            You will get 1.20.1 from pycom only when you select pybytes. No account needed.
            Not all users liked the pybyte behaviour and compiled their own firmware. @andreas hosts some of them.

            P 1 Reply Last reply Reply Quote 0
            • P Offline
              Peter Ehses @crumble
              last edited by

              @crumble Thanks, it seems to be more stable with the new firmware. Pybytes is a whole new rabbit hole of problems though. I might try @andreas firmware later.

              It would be really nice to have more documentation from pycom regarding the versions and differences, as well as all functions of their various libraries while we're at it.

              1 Reply Last reply Reply Quote 0
              • K Offline
                kiro
                last edited by

                This post is deleted!
                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