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

    Ctrl + D combined when _thread is in background crashes the Device

    Scheduled Pinned Locked Moved Issues & Bugs
    threadfirmware
    6 Posts 3 Posters 602 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.
    • R Offline
      robi90
      last edited by

      Hello,

      When I try to do a soft reset over REPL, by pressing Ctrl+D, my LoPy4 just crashes. Ctrl+D works for soft reset, when my programm is not running (expl.: when safe booting). I tried a few things and think the crash happens when a _thread is running in the background.

      The following is a minimal example, where at least for me, the LoPy4 always crashes on Ctrl+D:

      import _thread
      import machine
      
      def new_thread():
          while True:
              machine.sleep(1)
      
      _thread.start_new_thread(new_thread, ())
      

      I'm running 1.19.0.b4 Firmware.

      Hope there is a fix at some point. Thanks in advance.

      Kind regards,
      Robert Seidler

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

        @robi90 Why should there be a fix? A soft reset is meant to stop all activities, but not to reset the hardware. A crash ends in a hard reset. In both cases you end up with the normal boot procedure.
        The crash dump looks dramatic, bus is not.

        1 Reply Last reply Reply Quote 0
        • P Offline
          Paul Thornton
          last edited by

          Thanks, this is a known issue at the moment. The same will happen on Ctrl + F. only the main thread is currently stopped. Background threads will continue on.

          A fix is being worked on. but I dont have any timeframe for completion.

          1 Reply Last reply Reply Quote 0
          • P Offline
            Paul Thornton
            last edited by

            @robert-hh whilst not crucial, having it not clean up additional threads is just messy and likely to cause an issue somewhere else down the line.

            1 Reply Last reply Reply Quote 0
            • R Offline
              robi90
              last edited by robi90

              @robert-hh well I mean, it is kinda frustrating right now. if you hit Ctrl+D (or apparently Ctrl+F as well), for whatever reason (I just accidently hit it because I'm used to closing ipython with it :D ), your board gets unreachable. For me this is a problem because I'm working remotely on it. So if the board becomes unresponisiv for whatever reason, I can't just hard reset by myself.

              Considering the nature of the pycom platform with it's low power consumption and wide range of communication features, I guess a lot of people use it out in the field, with no easy way of hard resetting. So in my opinion we should try to minimize the possibility of requiring a hard reset. :)

              An auto reset after crash would work for me aswell, but right now, I don't know if there is a way to do that.

              Maybe fix is the wrong word. Let's call it firmware improvement :D

              greetings,
              robert

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

                @robi90 I misunderstood your first post, assuming a hard crash. I just tried your example and agree, that this is not good and must be fixed, because the device locks up in an unresponsive state.
                I tried that with version 1.20.0.rc4.
                The situation is a little bit better with Ctrl-F, because then the device falls at least back to safe boot, from which it can be restarted with machine.reset(). But only from the USB port. Using telnet is only possible then, if you use the default settings for WiFi.

                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