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

    Loses of downlinks when receiving data from TTN using LoPy4 nanogateway

    Scheduled Pinned Locked Moved LoPy
    16 Posts 4 Posters 141 Views 4 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.
    • J Offline
      jg_spitfire @robert-hh
      last edited by

      @robert-hh said in Loses of downlinks when receiving data from TTN using LoPy4 nanogateway:

      Is that behavior somehow repeating in time periods, like every 71, 35 or 17 seconds?

      I don't think so, because I send uplinks every 20 or 40 secs and try to receive successive downlinks and sometimes works but sometimes does not works, it is a random behavior, for example yesterday I could get 7 successive downlinks with uplinks every 20 or 40 seconds (I reconfigure the uplink period of time with the downlink message) but then the 8th downlink failed, I restarted the node frame counter and started a new test but then the first 4 attempts of downlinks failed, later they worked

      If the error occurs, does it affect a single message or a series of messages.

      it affects to a serie of messages

      From boot time of the nanogateway, is there a certain period where it works well, and then starts to fail?

      No, sometimes the downlinks work ok from the start of the test, sometimes works ok after several uplinks, it is a random behavior

      the strange is that I made this project in 2019 and I do not remember that I had issues with downlinks, maybe it was a bad idea to update the firmware?

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

        @jg_spitfire For further analysis, please change line 416 of nanogateway.py from:

                                t_us = tmst - utime.ticks_cpu() - 15000
        

        into

                                t_us = utime.ticks_cpu()
                                print("tmst = ", tmst, ", t_us = ", t_us)
                                t_us = tmst - t_us - 15000
        

        and post the result for good and bad cases.

        J 2 Replies Last reply Reply Quote 0
        • G Offline
          Gijs
          last edited by

          You say the project worked fine in 2019, do you remember the time/firmware version and are you able to downgrade it? In the meantime, lots of new features were added, which might have disturbed the critical timing window of a downlink message. I am not sure, but let me know if downgrading helps with your problem.
          The idea by @robert-hh can help here as well!
          Best

          J 1 Reply Last reply Reply Quote 0
          • J Offline
            jg_spitfire @Gijs
            last edited by

            @Gijs Hi, no, unfortunately I lost all that files and I don't have the firmware that I used by that time

            1 Reply Last reply Reply Quote 0
            • J Offline
              jg_spitfire @robert-hh
              last edited by

              @robert-hh Hi, this is what I got:

              Downlink OK:
              downlink ok 1.jpg

              downlink error 1
              downlink error 1.jpg

              dowlink error 2
              downlink error 2.jpg

              downlink error 3
              downlink error 3.jpg

              downlink ok 2
              downlink ok 2.jpg

              all this results are from the same test and I got them in that order

              the lines of code you told me to change are just for debug no?, because at the end I see that t_us is in function of the same parameters

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

                @jg_spitfire Thank you for the log data. It indicates the reason.
                tmst is sent by the TTN host and is the time at which the gateway shall forward the downlink message. The clock scale for tmst is the gateways µs-clock, in this case ticks_us. The required relation is tmst < t_us. That is true for the good case, and false for the error cases. For error1, the downlink message arrives more that 9 seconds late, for error2 and error3 it is more than 4 seconds.

                So there are most likely large delays in the downlink between the TTN server and your gateway. Maybe a busy WiFi network, maybe problems in the internet connection, maybe issus at the TTN server.

                J 1 Reply Last reply Reply Quote 0
                • J Offline
                  jg_spitfire @robert-hh
                  last edited by

                  @robert-hh I just want to know if this behavior is expected or it should not be this kind of loses in downlinks, you say:

                  The timing of the xxPy device is not very precise, and the LoRa requirements are strict.

                  so if it is an issue proper of the device there is no an official fix right?, I mean, I would be more concerned if someone told me that he is using a lopy4 nano gateway and he does not have this kind of behavior, I have read some of your posts but I did not understand if the issue was 100% resolved, did you have the same issue and could you fixed it permanently?

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

                    @jg_spitfire The errors you demonstrated are most likely not related to the LoPy4 and Microypthon/nanogateway software.

                    The timing of the xxPy device is not very precise, and the LoRa requirements are strict.

                    This sentence is related to timing errors intrinsic to the nanogateway + xxPy device. But the magnitude of the error is much smaller. With that error, timing is (or was) off by <200 ms. It happens more rarely with the Lopy than the LoPy4. The LoPy4 with the SPIRAM is a little bit less responsive. See also this thread: https://forum.pycom.io/topic/2676/abp-mode-and-frame-counters
                    and this thread:
                    https://forum.pycom.io/topic/2924/not-solved-lora-timing-of-lopy-and-fipy/4?_=1593150795069

                    After having that issue nailed down a little bit, the nanogateway was pretty reliable on up- an downlinks. Actually I am not using a nanogateway for TTN any more. After a few initial tests, I decided to go for a full blown RPI based gateway with the same chipset than the one PyCom announced recently. The reason is the full channel coverage.
                    I still have a Lopy with nanogateway running in the Loriot network, and that one is running since March, but with almost no traffic. And the only reason it stopped in the last year was for firmware updates and removing the power.
                    The TTN gateway has some traffic besides mine. Like 200 packets/day. Not overly busy.

                    1 Reply Last reply Reply Quote 1
                    • J Offline
                      jg_spitfire @robert-hh
                      last edited by

                      @robert-hh Hi, why do you say that for the good case tmst < t_us?

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

                        @jg_spitfire We might refer to different code. tmst is the intended time for transmission. When a packet arrives, tmst must be larger than the actual value of ticks_cpu(). So t_us is the calculated as:
                        t_us = tmst - utime.ticks_cpu() - 15000
                        That will be the time for the alarm handler, which then actually sends the downlink. The net time tmst - utime.ticks_cpu() is reduced by anther 15 ms to take in account the software needs for setting up the alarm and starting the scheduled function.

                        In the change I suggested for analysis there was the first lines:

                        t_us = utime.ticks_cpu()
                        print("tmst = ", tmst, ", t_us = ", t_us)
                        

                        in that printout, indeed tmst > t_us is the good case. So you were right asking.

                        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