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

    Pygate does not receive after downlink

    Scheduled Pinned Locked Moved Issues & Bugs
    16 Posts 7 Posters 226 Views 7 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.
    • G Offline
      Gijs
      last edited by Gijs

      Hi,
      Sorry, I meant to respond here yesterday but did not get to it. I have not seen something like this occur before, great you're willing to take a deeper look. You can adjust the debug info here: https://github.com/pycom/pycom-micropython-sigfox/blob/Dev/esp32/pygate/lora_pkt_fwd/trace.h#L43, though Im not sure if it will give that much more output. You might have to compile with additional printf() statements in order to find the culprit The actual forwarding happens here: https://github.com/pycom/pycom-micropython-sigfox/blob/Dev/esp32/pygate/lora_pkt_fwd/lora_pkt_fwd.c

      I did think about how this could occur, and I can only think of a single relation at the moment. Receiving LoRaWAN packets runs on a separate thread from sending the packets so receiving should continue even if sending is stuck. Perhaps we dont correctly reset the LoRa radio IC to receiving mode? Though I have not seen this behaviour before..

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

        Hi all,

        I spent quite bit of time to try to fix.

        I am not quite understand that part of the code, but I managed to fix it. Now, the Pygate continues to rx after tx. There is no more lock up seems. I will continue testing the long term, but so far so good.

        My environment:

        • PyGate 915
        • GPY
        • LTE-M1 network with public ip
        • chirpstack-gateway-bridge 3.11.0

        My software:

        • Ubuntu 20.04 VM
        • https://github.com/pycom/pycom-micropython-sigfox v1.20.2.r4 code base Dev branch a37510c092bcec00671c924accb97dcdfa2f4b5d

        My changes:

        Basically, disable gateway reset/restart after tx.

        Date: Fri, 25 Jun 2021 12:00:45 +1000
        Subject: [PATCH] fix tx lockup
        
        ---
         esp32/pygate/concentrator/cmd_manager.c | 14 +++++++-------
         1 file changed, 7 insertions(+), 7 deletions(-)
        
        diff --git a/esp32/pygate/concentrator/cmd_manager.c b/esp32/pygate/concentrator/cmd_manager.c
        index dba7ce511..8c119efb1 100644
        --- a/esp32/pygate/concentrator/cmd_manager.c
        +++ b/esp32/pygate/concentrator/cmd_manager.c
        @@ -324,7 +324,7 @@ int cmd_manager_DecodeCmd(uint8_t *BufFromHost) {
                         }
         
                         /* Switch off SX1308 correlators to reduce power consumption during transmit */
        -                esp_lgw_reg_w(LGW_CLKHS_EN, 0);
        +                //esp_lgw_reg_w(LGW_CLKHS_EN, 0);
         
                         /* Send packet */
                         SX1308.txongoing = 1;
        @@ -333,7 +333,7 @@ int cmd_manager_DecodeCmd(uint8_t *BufFromHost) {
                         if (x < 0) {
                             //pc.printf("lgw_send() failed\n");
                         }
        -                
        +
                         /* In case of TX continuous, return the answer immediatly */
                         esp_lgw_reg_r(LGW_TX_MODE, &txcontinuous); // to switch off the timeout in case of tx continuous
                         if (txcontinuous == 1) {
        @@ -359,16 +359,16 @@ int cmd_manager_DecodeCmd(uint8_t *BufFromHost) {
                         }
         
                         /* reset Sx1308 */
        -                sx1308_dig_reset();
        +                //sx1308_dig_reset();
         
                         /* Switch SX1308 correlators back on  */
        -                esp_lgw_reg_w(LGW_CLKHS_EN, 1);
        +                //esp_lgw_reg_w(LGW_CLKHS_EN, 1);
         
                         /* restart SX1308 */
        -                x = esp_lgw_start();
        -                if (x < 0) {
        +                //x = esp_lgw_start();
        +                //if (x < 0) {
                             //pc.printf("lgw_start() failed\n");
        -                }
        +                //}
         
                         /* Send command answer */
                         BufToHost[0] = 'f';
        -- 
        2.25.1
        
        

        Since I do not see other people report this issue, so I will just leave this fix here and not PR to Github.

        I hope it will be useful to someone.

        Cheers,
        Paul

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

          Great you were able to make something work!

          I'd still like you to submit a PR on our repo and we can take a look at it somewhere in the future, it allows for better tracking than leaving it here on the forum, and to give you credit where credit is due :). It might just be an undiscovered issue.

          Thanks!

          P 1 Reply Last reply Reply Quote 0
          • P Offline
            pauldeng @Gijs
            last edited by

            @Gijs

            PR created at https://github.com/pycom/pycom-micropython-sigfox/pull/561

            Thanks.

            1 Reply Last reply Reply Quote 1
            • N Offline
              netskink @pauldeng
              last edited by netskink

              @pauldeng I have a problem where I noticed I also have errors where the pygate does not receive packets after transmit. I tried to update my firmware and now the device works but lora no longer works whatsoever. I'll try this and see if this fix works. It seems you are building your own version of the firmware code from git.

              FWIW, here is where I reported the issue and my process for updating pygate and gpy. https://forum.pycom.io/topic/7238/pygate-gpy-and-lora-failures

              1 Reply Last reply Reply Quote 0
              • N Offline
                netskink @pauldeng
                last edited by

                @pauldeng I have this problem. I pulled the same revision of the code you did. At least I think I did. in the pycom-micropython-sigfox directory, I did $ git checkout a37510c092bcec00671c924accb97dcdfa2f4b5d then I made you changes.

                diff --git a/esp32/pygate/concentrator/cmd_manager.c b/esp32/pygate/concentrator/cmd_manager.c
                index dba7ce511..13b032934 100644
                --- a/esp32/pygate/concentrator/cmd_manager.c
                +++ b/esp32/pygate/concentrator/cmd_manager.c
                @@ -324,7 +324,7 @@ int cmd_manager_DecodeCmd(uint8_t *BufFromHost) {
                                 }
                 
                                 /* Switch off SX1308 correlators to reduce power consumption during transmit */
                -                esp_lgw_reg_w(LGW_CLKHS_EN, 0);
                +                //JFDesp_lgw_reg_w(LGW_CLKHS_EN, 0);
                 
                                 /* Send packet */
                                 SX1308.txongoing = 1;
                @@ -359,16 +359,16 @@ int cmd_manager_DecodeCmd(uint8_t *BufFromHost) {
                                 }
                 
                                 /* reset Sx1308 */
                -                sx1308_dig_reset();
                +                //JFDsx1308_dig_reset();
                 
                                 /* Switch SX1308 correlators back on  */
                                 esp_lgw_reg_w(LGW_CLKHS_EN, 1);
                 
                                 /* restart SX1308 */
                -                x = esp_lgw_start();
                -                if (x < 0) {
                +                //JFDx = esp_lgw_start();
                +                //JFDif (x < 0) {
                                     //pc.printf("lgw_start() failed\n");
                -                }
                +                //JFD}
                 
                                 /* Send command answer */
                                 BufToHost[0] = 'f';
                

                Aftewards, I built the code with:

                make BOARD=GPY clean
                make BOARD=GPY TARGET=boot
                make BOARD=GPY TARGET=app
                make BOARD=GPY ESPSPEED=115200 ESPPORT=/dev/ttyACM0 flash
                

                Afterwards, I use the atom IDE to upload the pygate example which has main.py and config.json for connecting the pygate/gpy combo to the things network (ttn).

                Sadly line 25 of main.py now has an error with this line:

                machine.callback(trigger = (machine.PYGATE_START_EVT | machine.PYGATE_STOP_EVT | machine.PYGATE_ERROR_EVT), handler=machine_cb)
                

                It appears this version of the firmware does not have a machine.callback() routine.

                Any advice is appreciated.

                J 1 Reply Last reply Reply Quote 1
                • J Offline
                  jcaron @netskink
                  last edited by

                  @netskink I believe you need to specify VARIANT=PYGATE in your make options to build the Pygate version.

                  N 2 Replies Last reply Reply Quote 1
                  • N Offline
                    netskink @jcaron
                    last edited by

                    @jcaron Your response makes me extremely happy. Many thanks.

                    At the moment, I am building the pycome-micropython-sigfox git repo on tip of development branch. If I can get it to build and run with similar results as the stock version, I will resume with Deng's pull and patch. With your suggestion I am doing this now:

                    $ make BOARD=GPY VARIANT=PYGATE clean
                    $ make BOARD=GPY TARGET=app VARIANT=PYGATE
                    $ make BOARD=GPY TARGET=boot VARIANT=PYGATE
                    $ make VARIANT=PYGATE BOARD=GPY ESPSPEED=115200 ESPPORT=/dev/ttyACM0 flash
                    

                    This indeed builds and flashes the GPY in the PYGATE expansion board. As for results, when I see the GPY/PYGATE console, I see that it appears to run normally as with the stock image. I don't see it failing with "concentrator" message. However, I don't see messages from the node being relayed through the GPY/PYGATE to TTN. As far as the node is concerned, it delivered a loraWAN message though.

                    ##### 2021-09-01 15:31:43 GMT #####
                    ### [UPSTREAM] ###
                    # RF packets received by concentrator: 0
                    # CRC_OK: 0.00%, CRC_FAIL: 0.00%, NO_CRC: 0.00%
                    # RF packets forwarded: 0 (0 bytes)
                    # PUSH_DATA datagrams sent: 1 (111 bytes)
                    # PUSH_DATA acknowledged: 0.00%
                    ### [DOWNSTREAM] ###
                    # PULL_DATA sent: 3 (100.00% acknowledged)
                    # PULL_RESP(onse) datagrams received: 0 (0 bytes)
                    # RF packets sent to concentrator: 0 (0 bytes)
                    # TX errors: 0
                    # TX rejected (collision packet): 0.00% (req:1, rej:0)
                    # TX rejected (collision beacon): 0.00% (req:1, rej:0)
                    # TX rejected (too late): 0.00% (req:1, rej:0)
                    # TX rejected (too early): 0.00% (req:1, rej:0)
                    ### [JIT] ###
                    [jit] queue is empty
                    ### [GPS] ###
                    # GPS sync is disabled
                    ##### END #####
                    [2717698799] LORAPF_WARN_:[up  ] ignored out-of sync PUSH_ACK packet buff_ack[0:38] != token[0:39]
                    [2717698851] LORAPF_WARN_:[up  ] PUSH_ACK recieve timeout 1
                    

                    hmm. afterwards I noticed it reconnected to wifi then these are in message log:

                    2717771645] LORAPF_INFO_:[main] report
                    ##### 2021-09-01 15:32:56 GMT #####
                    ### [UPSTREAM] ###
                    # RF packets received by concentrator: 1
                    # CRC_OK: 0.00%, CRC_FAIL: 100.00%, NO_CRC: 0.00%
                    # RF packets forwarded: 0 (0 bytes)
                    # PUSH_DATA datagrams sent: 0 (0 bytes)
                    # PUSH_DATA acknowledged: 0.00%
                    ### [DOWNSTREAM] ###
                    # PULL_DATA sent: 3 (100.00% acknowledged)
                    # PULL_RESP(onse) datagrams received: 0 (0 bytes)
                    # RF packets sent to concentrator: 0 (0 bytes)
                    # TX errors: 0
                    ### [JIT] ###
                    [jit] queue is empty
                    ### [GPS] ###
                    # GPS sync is disabled
                    ##### END #####
                    [2717771754] LORAPF_WARN_:[up  ] PUSH_ACK recieve timeout 0
                    [2717788687] LORAPF_INFO_:[up  ] received pkt from mote: 26022F3F (fcnt=43163/A89B), RSSI -101.0
                    [2717788740] LORAPF_WARN_:[up  ] PUSH_ACK recieve timeout 0
                    [2717789107] LORAPF_INFO_:jitqueue: Current concentrator tv_sec=50 time_us=50139381, pkt_type=0, packet->count_us=50670067, (c-t)=530686/530686 us = 0/0 s
                    [2717801684] LORAPF_INFO_:[main] report
                    ##### 2021-09-01 15:33:26 GMT #####
                    ### [UPSTREAM] ###
                    # RF packets received by concentrator: 3
                    # CRC_OK: 33.33%, CRC_FAIL: 66.67%, NO_CRC: 0.00%
                    # RF packets forwarded: 1 (22 bytes)
                    # PUSH_DATA datagrams sent: 2 (316 bytes)
                    # PUSH_DATA acknowledged: 100.00%
                    ### [DOWNSTREAM] ###
                    # PULL_DATA sent: 3 (100.00% acknowledged)
                    # PULL_RESP(onse) datagrams received: 1 (180 bytes)
                    # RF packets sent to concentrator: 1 (12 bytes)
                    # TX errors: 0
                    # TX rejected (collision packet): 0.00% (req:1, rej:0)
                    # TX rejected (collision beacon): 0.00% (req:1, rej:0)
                    # TX rejected (too late): 0.00% (req:1, rej:0)
                    # TX rejected (too early): 0.00% (req:1, rej:0)
                    ### [JIT] ###
                    [jit] queue is empty
                    ### [GPS] ###
                    # GPS sync is disabled
                    ##### END #####
                    [2717801802] LORAPF_WARN_:[up  ] PUSH_ACK recieve timeout 0
                    

                    However, the end result is still no message uploaded to TTN.

                    1 Reply Last reply Reply Quote 1
                    • N Offline
                      netskink @jcaron
                      last edited by

                      @jcaron I tried to reply here in the forums, but my post was flagged as spam. Here is the reply now in the issue section of the github.
                      https://github.com/pycom/pycom-micropython-sigfox/issues/563

                      Its really frustrating to try and use these forums and the forums work against you.

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

                        Its really frustrating to try and use these forums and the forums work against you.

                        It may be easier now. I added a few reputation points to your account.

                        N 1 Reply Last reply Reply Quote 0
                        • N Offline
                          netskink @robert-hh
                          last edited by

                          @robert-hh said in Pygate does not receive after downlink:

                          Its really frustrating to try and use these forums and the forums work against you.

                          It may be easier now. I added a few reputation points to your account.

                          Thanks.

                          1 Reply Last reply Reply Quote 0
                          • C Offline
                            Carlton flores 2
                            last edited by

                            any update on the issue ? its resolved now ?

                            1 Reply Last reply Reply Quote 0
                            • C Offline
                              Carlton flores 2
                              last edited by Carlton flores 2

                              yeah you can check debug logs.. .

                              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