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

    Ping from pybytes

    Scheduled Pinned Locked Moved Support & Troubleshooting
    6 Posts 2 Posters 101 Views 2 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.
    • A Offline
      almeos
      last edited by

      Hello,
      I have connected some Fipy on Pybytes. It sometimes disconnect without any reason, nevertheless "lte.isconnected() = True" and "pybytes.isconnected() =True".
      My question is: Is there a way to ask pybytes to send a response when fipy uses "pybytes.send_ping_message()" so that if there is no response the fipy should reboot.
      Thanks
      Denis

      1 Reply Last reply Reply Quote 0
      • G Offline
        Gijs
        last edited by Gijs

        The Pybytes library itself checks every 10 minutes for a PING message from the Pybytes server. The internal watchdog timer has a timeout of 20 minutes, and will reset the device if it has not received a PING response twice in a row. Though if you manually disabled the watchdog timer, this will not occur.

        At the moment, I can not think of a way that makes detection faster without recompiling the firmware

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

          Hello,
          Thank you for your answer,

          • First, my fipy, as usual, has been here disconnected from pybytes during hours, I finally made a Ctrl C and wrote this:
          >>> alarmCase.pybytes.disconnect()
          Watchdog timeout has been increased to 2147483647 ms
          

          How can the watchod timer increase over 21min?

          • Second point, I made a showphy:
          >>> alarmCase.pretty('AT!="showphy"')
          DL SYNCHRO STATISTICS
          =====================
              Synchro state                         : DRX_SLEEP
              PPU SIB1 ACQ watchdog                 : 2
              Frequency Hypothesis RF  (Hz)         : 0
              RSRP (dBm)                            : -90.44
              RSRQ  (dB)                            : -8.46 
          

          The synchro state is "DRX_SLEEP", I think this is the reason why it is disconnected from Pybytes.
          How can I change DRX state to have "DRX_WAKE_UP"?

          1 Reply Last reply Reply Quote 0
          • G Offline
            Gijs
            last edited by

            How can the watchod timer increase over 21min?

            Once you disconnect from Pybytes, we increase the WDT timeout to the maximum value. It might look like 21 minutes, but actually the timeout is almost 600 hours

            Second point, I made a showphy:

            Sorry, its not totally clear to me what you're getting at, could you perhaps elaborate on what you're trying to achieve here?

            Let me know!

            A 1 Reply Last reply Reply Quote 0
            • A Offline
              almeos @Gijs
              last edited by

              @Gijs Sorry for my poor english language, I will do my best to explain clearly.

              • If the WDT is over 21 minutes, the fipy should try to reconnect to pybytes, shouldn't it?

              • I am trying to find how to reconnect my fipy when it disconnects from pybytes.
                The commands "lte.isconnected()" and "pybytes.isconnected()" do not work: connected or not, it always displays "TRUE"!
                After many many tests, the only way that I found to see if the fipy is realy connected to pybytes (using Atom pymakr), is to type the commmand "lte.send_at_cmd('AT!="showphy"')"
                If the answer is Synchro state: "DRX_SLEEP" : the fipy is not connected to pybytes
                If the answer is Synchro state: "DRX_WAKE_UP_ : the fipy is connected to pybytes

              The solution I finally found is to insert a callback in my code:

              lte.lte_callback(LTE.EVENT_BREAK, lte_cb_handler)
              

              If the callback has been triggered because of a disconnection, then the fipy tries to reconnect to pybytes using

              pybytes.connect()
              

              This the only efficient command that I found. It does work but this solution is not so good: there are too many callback occuring so that the fipy spends much time to reconnect to pybytes.

              1 Reply Last reply Reply Quote 0
              • G Offline
                Gijs
                last edited by

                No worries

                If the WDT is over 21 minutes, the fipy should try to reconnect to pybytes, shouldn't it?

                Yes, though it will take 21 minutes before the reset happens (it will trigger a full system reset, similar to machine.reset()). This is independent of lte.isconnected() or pybytes.isconnected(). As I mentioned before, it will send/receive a PING message from Pybytes every 10 minutes, and when there is no response, it will try again 10 minutes later. If there is still no response, it will trigger the system reset.

                The solution I finally found is to insert a callback in my code:

                lte.lte_callback(LTE.EVENT_BREAK, lte_cb_handler)
                If the callback has been triggered because of a disconnection, then the fipy tries to reconnect to pybytes using

                pybytes.connect()
                This the only efficient command that I found. It does work but this solution is not so good: there are too many callback occuring so that the fipy spends much time to reconnect to pybytes.

                When the callback triggers, you will need to check manually (by for example doing a socket.getaddrinfo() whether the BREAK was caused by a 'permanent' disconnect or something else. We also explain this in the documentation: https://docs.pycom.io/tutorials/networks/lte/#lte-connectivity-loss

                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