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. RC from send() and How to identify an Ack message

RC from send() and How to identify an Ack message

Scheduled Pinned Locked Moved Troubleshooting
8 Posts 4 Posters 4.1k Views 2 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.
  • M Offline
    M Offline
    meanpenugin
    Hardware Contributor
    wrote on last edited by meanpenugin
    #1

    I have a very simple sketch, Controller sends a message every 500 ms to a sensor node. with the millis() as is it's payload.
    The sensor node just echos the payload back...

    void loop() 
    {
        int iRC;
        
        rf24.process();
        if ((millis() - lastrun) > 500)
        {
            Serial.println("---------------------------------------------------");
            iRC = rf24.send(myMsgPingReply.set(millis()), RF24_RECEIVE_ACK_FALSE);
            Serial.print("rf24.send() RC=");
            Serial.println(iRC);
            lastrun = millis();
        }
    }```
    
    
    Here is a question to what is in the serial output..
    
    Q1:  The first send():  Why is the RC = 0  when the remote node got the message and replied.    
    ---
    Am I understanding the RC of the send() incorrectly?  1 = Successful, 0 = failed?
    Especially since the "st=fail" in the debug corresponds to the RC from the send() 
    
    

    send: 0-0-200-0 s=0,c=1,t=0,pt=5,l=4,st=fail:27546
    rf24.send() RC=0
    read: 0-200-0 s=0,c=1,t=0,pt=5,l=4:27546

    send: 0-0-200-0 s=0,c=1,t=0,pt=5,l=4,st=ok:28072
    rf24.send() RC=1
    read: 0-200-0 s=0,c=1,t=0,pt=5,l=4:28072

    send: 0-0-200-0 s=0,c=1,t=0,pt=5,l=4,st=ok:28582
    rf24.send() RC=1
    read: 0-200-0 s=0,c=1,t=0,pt=5,l=4:28582

    send: 0-0-200-0 s=0,c=1,t=0,pt=5,l=4,st=fail:29092
    rf24.send() RC=0
    read: 0-200-0 s=0,c=1,t=0,pt=5,l=4:29092

    send: 0-0-200-0 s=0,c=1,t=0,pt=5,l=4,st=ok:29618
    rf24.send() RC=1
    read: 0-200-0 s=0,c=1,t=0,pt=5,l=4:29618

    send: 0-0-200-0 s=0,c=1,t=0,pt=5,l=4,st=ok:30127
    rf24.send() RC=1
    read: 0-200-0 s=0,c=1,t=0,pt=5,l=4:30127

    send: 0-0-200-0 s=0,c=1,t=0,pt=5,l=4,st=fail:30637
    rf24.send() RC=0

    send: 0-0-200-0 s=0,c=1,t=0,pt=5,l=4,st=fail:31162
    rf24.send() RC=0
    read: 0-200-0 s=0,c=1,t=0,pt=5,l=4:31162

    
    
    
    Q2:  Set the ACK flag to TRUE:  How do I know from the serial output which is the Ack Message?
    ----
    My sketch sends the first send: 0-0-200-0 ....
    I'm done after displaying the RC
    The first read: 0-200-0 ... must be the Echo back from the sensor node
    the second send 0-0-200-0  must be the Ack to the Sensor node
    the second read 0-200-0 must be the Ack from the Sensor node to the initial Send?
    
    Send Msg -->
    <--  Echo of the Msg
    Ack of the Echo -->
    <--  Ack to the Msg"
    Is this correct?  
    
    
    * Only way I could assume the above is  because there is only one message involved.  In a more complicated case when trying to debug how would someone know what is a message I sent and one automatically sent by the Library?  What is an Ack message?
    
    * st=ok and st=fail still concerns me that is does not make sense.  :-(
    
    

    send: 0-0-200-0 s=0,c=1,t=0,pt=5,l=4,st=fail:327302
    rf24.send() RC=0
    read: 0-200-0 s=0,c=1,t=0,pt=5,l=4:327302
    send: 0-0-200-0 s=0,c=1,t=0,pt=5,l=4,st=ok:327302

    send: 0-0-200-0 s=0,c=1,t=0,pt=5,l=4,st=ok:327827
    rf24.send() RC=1
    read: 0-200-0 s=0,c=1,t=0,pt=5,l=4:327827
    send: 0-0-200-0 s=0,c=1,t=0,pt=5,l=4,st=ok:327827
    read: 0-200-0 s=0,c=1,t=0,pt=5,l=4:327827

    send: 0-0-200-0 s=0,c=1,t=0,pt=5,l=4,st=fail:328336
    rf24.send() RC=0
    read: 0-200-0 s=0,c=1,t=0,pt=5,l=4:328336
    send: 0-0-200-0 s=0,c=1,t=0,pt=5,l=4,st=fail:328336
    read: 0-200-0 s=0,c=1,t=0,pt=5,l=4:328336

    
    ---
    1 Reply Last reply
    0
    • hekH Offline
      hekH Offline
      hek
      Admin
      wrote on last edited by
      #2

      The serial debug messages does not print the ack flags. You'll have to add it yourself.

      1 Reply Last reply
      0
      • M Offline
        M Offline
        meanpenugin
        Hardware Contributor
        wrote on last edited by
        #3

        I guess then it's a feature request..

        1. Add Ack Flag
        2. Add indicator when the library sends the message vs. the sketch.

        Any idea why the status is returning fail (st=fail) when it looks like the message send was actually successful?

        send: 0-0-200-0 s=0,c=1,t=0,pt=5,l=4,st=fail:328336
        rf24.send() RC=0
        read: 0-200-0 s=0,c=1,t=0,pt=5,l=4:328336
        
        1 Reply Last reply
        0
        • D Offline
          D Offline
          dzairo
          wrote on last edited by
          #4

          hi, go to my last project... I use ACK .. look to my code..
          may be help..

          regards

          M 1 Reply Last reply
          0
          • D dzairo

            hi, go to my last project... I use ACK .. look to my code..
            may be help..

            regards

            M Offline
            M Offline
            meanpenugin
            Hardware Contributor
            wrote on last edited by
            #5

            @dzairo thanks.

            I'm not asking how to use the Ack flag.

            I'm asking how to recognize the Ack messages from the debug messages.
            This is the debug with Ack enabled. can you tell me which one is the Ack message?

            send: 0-0-200-0 s=0,c=1,t=0,pt=5,l=4,st=fail:328336
            rf24.send() RC=0
            read: 0-200-0 s=0,c=1,t=0,pt=5,l=4:328336
            send: 0-0-200-0 s=0,c=1,t=0,pt=5,l=4,st=fail:328336
            read: 0-200-0 s=0,c=1,t=0,pt=5,l=4:328336
            

            Second, why is the send status = fail but seems like the message actually was successful in being received by the receiver (as I received a reply to the message sent).

            1 Reply Last reply
            0
            • hekH Offline
              hekH Offline
              hek
              Admin
              wrote on last edited by
              #6

              Second, why is the send status = fail but seems like the message actually was successful in being received by the receiver (as I received a reply to the message sent).

              The receiver can very well receive a message but does not succeed in sending (hardware) ack back to sender. This will result in "st=failed" on sending side.

              You can do a simple msg.isAck() in the message callback to check if it is a ack message.

              M S 2 Replies Last reply
              0
              • hekH hek

                Second, why is the send status = fail but seems like the message actually was successful in being received by the receiver (as I received a reply to the message sent).

                The receiver can very well receive a message but does not succeed in sending (hardware) ack back to sender. This will result in "st=failed" on sending side.

                You can do a simple msg.isAck() in the message callback to check if it is a ack message.

                M Offline
                M Offline
                meanpenugin
                Hardware Contributor
                wrote on last edited by
                #7

                @hek thanks for the clarification...

                OK, that's interesting...

                So you are utilizing the Hardware Ack mechanisms - RC represents the hardware successfully received HW Ack to the message.

                • Understand the st=fail now. The hardware Ack was not received.
                • Even if the Ack was received, No guarantee that the sketch got the message

                The Software Ack is then handles the full path - validates that the message made it all the way up to the clients' sketch.

                • The HW may have successfully received the message but for some reason did not make it to the sketch to be processed
                • or the sketch failed to process the message.

                Now, only if we can "fix" the debug output to identify which are Acks

                • I know I can use the isAck() in the sketches......
                • This was just in the debug messages so when we look at the output, it's clear that its an Ack message.
                • That's what debug mode is for, so we can simply trace the messages
                1 Reply Last reply
                0
                • hekH hek

                  Second, why is the send status = fail but seems like the message actually was successful in being received by the receiver (as I received a reply to the message sent).

                  The receiver can very well receive a message but does not succeed in sending (hardware) ack back to sender. This will result in "st=failed" on sending side.

                  You can do a simple msg.isAck() in the message callback to check if it is a ack message.

                  S Offline
                  S Offline
                  samppa
                  wrote on last edited by
                  #8

                  @hek said:

                  You can do a simple msg.isAck() in the message callback to check if it is a ack message.

                  How the received acks can be matched with the sent messages?

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


                  9

                  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