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

    Detect if REPL is connected

    Scheduled Pinned Locked Moved Guides
    replhelp
    5 Posts 5 Posters 1.2k Views 5 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.
    • tobzT Offline
      tobz
      last edited by

      How do you detect if there is a console connection present?
      Use case is I don't want my device to go into deepsleep if I'm working on it.

      robert-hhR 1 Reply Last reply Reply Quote 0
      • philwilkinsonP Offline
        philwilkinson
        last edited by

        I have found myself stuck a few times with ESP8266 as well as ESP32 with exactly the same issue!

        The Pyboard has a useful USB_VCP.isconnected method which does exactly the function you are after. However, I am not sure if ESP32 offers that function. Perhaps a Pycom github enhancement request?

        As an interim measure I now put in a 30 second delay on a hard reset ( using machine.RESET_CAUSE) allowing me time to interrupt the script.
        Not very elegant, but it works.

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

          @tobz If you have the chance to connect one of the modem control signals like RTS to a GPIO port, then you can use that one.

          1 Reply Last reply Reply Quote 0
          • T Offline
            timh
            last edited by

            I had a similiar situation where I wish to disable WDT when using console.
            I put a jumper cable in between ground and a pin. The check for it on bootup and then if pulled to ground will not start the WDT.

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

              I am using a W01 module connected via P0, P1 (the standard Rx/Tx lines of the serial REPL) to a FT232R serial-USB-interface. The FT232R is powered from USB.
              By defining P0 (i.e. Rx) as input with pull down activated, it is possible to dectect if REPL (i.e. the USB) is connected (P0=1=yes)
              It may be interesting to note that UART operation is not affected by having Rx(P0) declared as digital input simultaneously.

              By this method, the module detects a serial console during boot and continues in REPL mode. If there is no active serial connection detected, it autostarts its application.

              I am not sure if this works with a Wipy since the serial-USB interface may be powered from the Wipy, possibly making the status of Rx independent of the USB cable connection.

              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