Skip to content
  • MySensors
  • OpenHardware.io
  • Categories
  • Recent
  • Tags
  • Popular
Skins
  • Light
  • Brite
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Brand Logo
  1. Home
  2. Troubleshooting
  3. Auto resend on NACK

Auto resend on NACK

Scheduled Pinned Locked Moved Troubleshooting
23 Posts 6 Posters 2.0k Views 6 Watching
  • 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.
  • alowhumA alowhum

    As a quick follow-up: is this a message stating that the hardware ACK failed?

    362547 !TSF:MSG:SEND,27-27-0-0,s=3,c=1,t=37,pt=2,l=2,sg=0,ft=0,st=NACK:120

    mfalkviddM Offline
    mfalkviddM Offline
    mfalkvidd
    Mod
    wrote on last edited by
    #13

    @alowhum yes

    1 Reply Last reply
    0
    • electrikE Offline
      electrikE Offline
      electrik
      wrote on last edited by
      #14

      @alowhum said in Auto resend on NACK:

      Hardware ACK is just that is reaches the next node in the network, right? It could be a repeater saying "I got something from you". It doesn't 100% guarantee that it reached the controller correctly.

      Yes exactly

      @alowhum said in Auto resend on NACK:

      Software ACK is the controller sending back the exact same message you sent, but this time with the ACK bit set to true? It goes up and down your entire network. It's the best way to be sure that the message reached the controller, since you could theoretically even check if the message details are still the same as when you sent it.

      Yes

      @alowhum said in Auto resend on NACK:

      Both will happen when you set ACK to true in your send() function?

      Yes correct again

      @alowhum said in Auto resend on NACK:

      Is this a correct summary?

      I didn't use the software ack myself but I think this last point is also correct.

      1 Reply Last reply
      1
      • alowhumA alowhum

        @electrik Is this a correct understanding?

        • Hardware ACK is just that is reaches the next node in the network, right? It could be a repeater saying "I got something from you". It doesn't 100% guarantee that it reached the controller correctly.
        • Software ACK is the controller sending back the exact same message you sent, but this time with the ACK bit set to true? It goes up and down your entire network. It's the best way to be sure that the message reached the controller, since you could theoretically even check if the message details are still the same as when you sent it.

        Both will happen when you set ACK to true in your send() function?

        So:
        if (send(msgFgeHum.set(fgehum),true)) is just checking the hardware ACK, meaning it got sent away ok.

        And then for software ACK you should use the receive function to check for a returning "echo" message:

        void receive(const MyMessage &message)
        {
        	// We only expect one type of message from controller. But we better check anyway.
        
          Serial.print("Incoming message for child: ");
          Serial.println(message.sensor);
        
          if (message.isAck() && message.sensor == RELAY_1_CHILD_ID) { // We got the ACK!
            Serial.println("- Received ACK for relay");
            retryCounter = 0;
          }
        

        Is this a correct summary?

        mfalkviddM Offline
        mfalkviddM Offline
        mfalkvidd
        Mod
        wrote on last edited by mfalkvidd
        #15

        @alowhum said in Auto resend on NACK:

        Both will happen when you set ACK to true in your send() function?

        This is incorrect. Setting ACK to true in the send() function will enable software ACK.

        Hardware ACK is not affected by the vale of ACK in the send() function.

        1 Reply Last reply
        2
        • alowhumA Offline
          alowhumA Offline
          alowhum
          Plugin Developer
          wrote on last edited by
          #16

          @mfalkvidd Then how is hardware ACK enabled? I that what you enable in the presentation?

          present(TEXT_CHILD_ID, S_INFO, F("Status"),true);

          I always thought that enabling it in presentation() just means you didn't have to do it manually anymore, that it would be done for all messages of that child.

          Or it hardware ACK always on? And it's just a matter of whether you use the return of the send function or not?

          mfalkviddM 1 Reply Last reply
          1
          • alowhumA alowhum

            @mfalkvidd Then how is hardware ACK enabled? I that what you enable in the presentation?

            present(TEXT_CHILD_ID, S_INFO, F("Status"),true);

            I always thought that enabling it in presentation() just means you didn't have to do it manually anymore, that it would be done for all messages of that child.

            Or it hardware ACK always on? And it's just a matter of whether you use the return of the send function or not?

            mfalkviddM Offline
            mfalkviddM Offline
            mfalkvidd
            Mod
            wrote on last edited by mfalkvidd
            #17

            @alowhum said in Auto resend on NACK:

            Or it hardware ACK always on? And it's just a matter of whether you use the return of the send function or not?

            Exactly.

            There might be some way to turn it off, but I don't know how.

            1 Reply Last reply
            2
            • alowhumA Offline
              alowhumA Offline
              alowhum
              Plugin Developer
              wrote on last edited by
              #18

              Thanks.

              While we're on the subject: is there any built-in retry functionality for the hardware and/or software ACK? I believe if you set the ACK bit in the send function, then the hardware ACK will try to re-send the message a few times? I seem to remember seeing the ft value increase by one each time after a NACK.
              2070 TSF:MSG:SEND,27-27-0-0,s=255,c=3,t=24,pt=1,l=1,sg=0,ft=0,st=OK:1
              I suspect this hardware-retry only works if you set the ACK to true?

              And another one:

              Does the isTransportReady() function check..
              A. If the radio works
              B. If there is a connection to a neighbour (repeater or gateway)
              C. If a handshake had been made with the controller

                if(isTransportReady()){
                  Serial.println(F("Connected to gateway!"));
                }
                else {
                  Serial.println(F("! NO CONNECTION"));
                }
              
              mfalkviddM 1 Reply Last reply
              1
              • alowhumA alowhum

                Thanks.

                While we're on the subject: is there any built-in retry functionality for the hardware and/or software ACK? I believe if you set the ACK bit in the send function, then the hardware ACK will try to re-send the message a few times? I seem to remember seeing the ft value increase by one each time after a NACK.
                2070 TSF:MSG:SEND,27-27-0-0,s=255,c=3,t=24,pt=1,l=1,sg=0,ft=0,st=OK:1
                I suspect this hardware-retry only works if you set the ACK to true?

                And another one:

                Does the isTransportReady() function check..
                A. If the radio works
                B. If there is a connection to a neighbour (repeater or gateway)
                C. If a handshake had been made with the controller

                  if(isTransportReady()){
                    Serial.println(F("Connected to gateway!"));
                  }
                  else {
                    Serial.println(F("! NO CONNECTION"));
                  }
                
                mfalkviddM Offline
                mfalkviddM Offline
                mfalkvidd
                Mod
                wrote on last edited by
                #19

                @alowhum again, setting the ACK parameter in the send call will NEVER affect hardware ack.

                For nrf24, up to 15 retries will be done by the hardware ack.

                1 Reply Last reply
                0
                • mfalkviddM Offline
                  mfalkviddM Offline
                  mfalkvidd
                  Mod
                  wrote on last edited by mfalkvidd
                  #20

                  isTransportReady will return true if the node has seen a valid route to the gateway and there have been fewer than MY_TRANSPORT_MAX_TSM_FAILURES transport failures since the node saw the valid route. I do not know what constitutes a transport failure though. I think "Failed uplink counter" (ft= in the log) is the counter that's used for comparison.

                  The controller is not involved in isTransportReady

                  So maybe something between B and C.

                  1 Reply Last reply
                  0
                  • alowhumA Offline
                    alowhumA Offline
                    alowhum
                    Plugin Developer
                    wrote on last edited by
                    #21

                    @mfalkvidd Thank you so much for the explanation! I feel I'm getting a grasp on things.

                    1 Reply Last reply
                    1
                    • Mark SwiftM Offline
                      Mark SwiftM Offline
                      Mark Swift
                      wrote on last edited by
                      #22

                      @mfalkvidd said in Auto resend on NACK:

                      https://forum.mysensors.org/post/33832

                      Would someone be kind enough to point me in the direction of a good software acknowledgement example? I've been building MySensors for 4 years and still have sensors that don't send reliable messages. While most have been replaced with ESP's - these sensors are extremely remote and battery powered (MySensors wins here!).

                      Currently I use:

                      void resend(MyMessage &msg, int repeats) {
                              int repeat = 1;
                              const int repeatDelay = 100;
                              boolean sendOK = false;
                              while ((sendOK == false) and (repeat <= repeats)) {
                                      if (send(msg) == true) {
                                              sendOK = true;
                                      } else {
                                              sendOK = false;
                                              #ifdef MY_DEBUG
                                              Serial.print(F("Send error: "));
                                              Serial.println(repeat);
                                              #endif
                                              repeat++;
                                              wait(repeatDelay);
                                      }
                              }
                      }
                      

                      But this doesn't seem to ensure reliable delivery (some nodes send 10 msgs before sleeping). Often I get multiple messages arriving (I assume this is the burst), but some (often vital) never make it.

                      1 Reply Last reply
                      0
                      • electrikE Offline
                        electrikE Offline
                        electrik
                        wrote on last edited by
                        #23

                        You will get multiple messages, if the message arrives correctly but the hardware ACK doesn't.

                        Do you have a repeater in between the sender and gateway? It could be that the repeater does receive the initial message (and the sensor gets a hardware ACK), but that never reaches the gateway because of a transmission error between the repeater and the gateway.

                        1 Reply Last reply
                        1
                        Reply
                        • Reply as topic
                        Log in to reply
                        • Oldest to Newest
                        • Newest to Oldest
                        • Most Votes


                        26

                        Online

                        11.7k

                        Users

                        11.2k

                        Topics

                        113.1k

                        Posts


                        Copyright 2025 TBD   |   Forum Guidelines   |   Privacy Policy   |   Terms of Service
                        • Login

                        • Don't have an account? Register

                        • Login or register to search.
                        • First post
                          Last post
                        0
                        • MySensors
                        • OpenHardware.io
                        • Categories
                        • Recent
                        • Tags
                        • Popular