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. Development
  3. SmartSleep wake up message always get NACK

SmartSleep wake up message always get NACK

Scheduled Pinned Locked Moved Development
18 Posts 6 Posters 2.4k Views 5 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.
  • H Henrik Nielsen

    @berkseo Thank you for your suggestions, I have tried both.

    • I moved the node up right next to the gateway, so there are no repeaters in between. I still get NACK on the wake up message. And I can see in the gateway log that the wake up message are not received by the gateway. The other message still shows up just fine. In the output below you can see it sends directly to node 0

    • I also added a wait(200) after the sleep, still get the same error, but I guess it is because the wake up message are sent before the sleep method returns?

    • Using sleep(1000, true) instead of smartSleep, same result, but I'll start using sleep(nnn, true) instead anyway :)

    New code:

    #define MY_DEBUG
    #define MY_RADIO_NRF24
    #define MY_RF24_CHANNEL 0x44
    #define MY_RF24_BASE_RADIO_ID 0x00,0xf6,0x4d,0x89,0xc0
    #include <MySensors.h>
    
    void presentation() {
      sendSketchInfo("SmartSleepTest", "1.0");
      present(1, S_INFO, "Info");
    }
    
    void loop() {
      sleep(1000, true);
      wait(200);
    }
    

    Output:

    16 MCO:BGN:INIT NODE,CP=RNNNA---,VER=2.3.0
    26 TSM:INIT
    28 TSF:WUR:MS=0
    34 TSM:INIT:TSP OK
    36 TSF:SID:OK,ID=204
    38 TSM:FPAR
    75 TSF:MSG:SEND,204-204-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=OK:
    686 TSF:MSG:READ,0-0-204,s=255,c=3,t=8,pt=1,l=1,sg=0:0
    692 TSF:MSG:FPAR OK,ID=0,D=1
    708 TSF:MSG:READ,0-201-204,s=255,c=3,t=25,pt=1,l=1,sg=0:2
    714 !TSF:MSG:PONG RECV,INACTIVE
    854 TSF:MSG:READ,202-202-204,s=255,c=3,t=8,pt=1,l=1,sg=0:1
    880 TSF:MSG:READ,203-203-204,s=255,c=3,t=8,pt=1,l=1,sg=0:1
    2084 TSM:FPAR:OK
    2084 TSM:ID
    2086 TSM:ID:OK
    2088 TSM:UPL
    2093 TSF:MSG:SEND,204-204-0-0,s=255,c=3,t=24,pt=1,l=1,sg=0,ft=0,st=OK:1
    2101 TSF:MSG:READ,0-0-204,s=255,c=3,t=25,pt=1,l=1,sg=0:1
    2107 TSF:MSG:PONG RECV,HP=1
    2109 TSM:UPL:OK
    2111 TSM:READY:ID=204,PAR=0,DIS=1
    2117 TSF:MSG:SEND,204-204-0-0,s=255,c=3,t=15,pt=6,l=2,sg=0,ft=0,st=OK:0100
    2127 TSF:MSG:READ,0-0-204,s=255,c=3,t=15,pt=6,l=2,sg=0:0100
    2136 TSF:MSG:SEND,204-204-0-0,s=255,c=0,t=17,pt=0,l=5,sg=0,ft=0,st=OK:2.3.0
    2146 TSF:MSG:SEND,204-204-0-0,s=255,c=3,t=6,pt=1,l=1,sg=0,ft=0,st=OK:0
    2242 TSF:MSG:READ,0-0-204,s=255,c=3,t=6,pt=0,l=1,sg=0:M
    2254 TSF:MSG:SEND,204-204-0-0,s=255,c=3,t=11,pt=0,l=14,sg=0,ft=0,st=OK:SmartSleepTest
    2265 TSF:MSG:SEND,204-204-0-0,s=255,c=3,t=12,pt=0,l=3,sg=0,ft=0,st=OK:1.0
    2275 TSF:MSG:SEND,204-204-0-0,s=1,c=0,t=36,pt=0,l=4,sg=0,ft=0,st=OK:Info
    2283 MCO:REG:REQ
    2289 TSF:MSG:SEND,204-204-0-0,s=255,c=3,t=26,pt=1,l=1,sg=0,ft=0,st=OK:2
    2297 TSF:MSG:READ,0-0-204,s=255,c=3,t=27,pt=1,l=1,sg=0:1
    2304 MCO:PIM:NODE REG=1
    2308 MCO:BGN:INIT OK,TSP=1
    2310 MCO:SLP:MS=1000,SMS=1,I1=255,M1=255,I2=255,M2=255
    2318 TSF:MSG:SEND,204-204-0-0,s=255,c=3,t=32,pt=5,l=4,sg=0,ft=0,st=OK:500
    2826 TSF:TDI:TSL
    2828 MCO:SLP:WUP=-1
    2830 TSF:TRI:TSB
    4513 !TSF:MSG:SEND,204-204-0-0,s=255,c=3,t=33,pt=5,l=4,sg=0,ft=0,st=NACK:1000
    4722 MCO:SLP:MS=1000,SMS=1,I1=255,M1=255,I2=255,M2=255
    4728 TSF:MSG:SEND,204-204-0-0,s=255,c=3,t=32,pt=5,l=4,sg=0,ft=1,st=OK:500
    5238 TSF:TDI:TSL
    5240 MCO:SLP:WUP=-1
    5242 TSF:TRI:TSB
    6926 !TSF:MSG:SEND,204-204-0-0,s=255,c=3,t=33,pt=5,l=4,sg=0,ft=0,st=NACK:1000
    
    berkseoB Offline
    berkseoB Offline
    berkseo
    wrote on last edited by berkseo
    #7

    @henrik-nielsen
    :(

    The problem is deeper, you came across an interesting point, I did not notice it before... left to dig the problem

    1 Reply Last reply
    0
    • H Offline
      H Offline
      Henrik Nielsen
      wrote on last edited by
      #8

      I guess if I could just turn off the wake up / post-sleep message, everything would still kinda work. MyController will react to the pre-sleep message and send any pending messages, so the problem is just the 2 seconds of wasted battery everytime it try to send the wake up messages.

      There might of course be other implications that I am not aware of :)

      berkseoB 1 Reply Last reply
      0
      • H Henrik Nielsen

        I guess if I could just turn off the wake up / post-sleep message, everything would still kinda work. MyController will react to the pre-sleep message and send any pending messages, so the problem is just the 2 seconds of wasted battery everytime it try to send the wake up messages.

        There might of course be other implications that I am not aware of :)

        berkseoB Offline
        berkseoB Offline
        berkseo
        wrote on last edited by berkseo
        #9

        @henrik-nielsen
        I banished your sketch. Faced the same problem, have not seen before. As it turned out, this is a problem of quality of radio modules and radio driver settings. The solution is described below.

        Was before:

        
         __  __       ____
        |  \/  |_   _/ ___|  ___ _ __  ___  ___  _ __ ___
        | |\/| | | | \___ \ / _ \ `_ \/ __|/ _ \| `__/ __|
        | |  | | |_| |___| |  __/ | | \__ \  _  | |  \__ \
        |_|  |_|\__, |____/ \___|_| |_|___/\___/|_|  |___/
                |___/                      2.3.1-alpha
        
        18 MCO:BGN:INIT NODE,CP=RNNNA---,VER=2.3.1-alpha
        28 TSM:INIT
        28 TSF:WUR:MS=0
        36 TSM:INIT:TSP OK
        38 TSF:SID:OK,ID=100
        40 TSM:FPAR
        77 TSF:MSG:SEND,100-100-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=OK:
        600 TSF:MSG:READ,0-0-100,s=255,c=3,t=8,pt=1,l=1,sg=0:0
        606 TSF:MSG:FPAR OK,ID=0,D=1
        2088 TSM:FPAR:OK
        2088 TSM:ID
        2091 TSM:ID:OK
        2093 TSM:UPL
        2099 TSF:MSG:SEND,100-100-0-0,s=255,c=3,t=24,pt=1,l=1,sg=0,ft=0,st=OK:1
        2205 TSF:MSG:READ,0-0-100,s=255,c=3,t=25,pt=1,l=1,sg=0:1
        2211 TSF:MSG:PONG RECV,HP=1
        2215 TSM:UPL:OK
        2217 TSM:READY:ID=100,PAR=0,DIS=1
        2222 TSF:MSG:SEND,100-100-0-0,s=255,c=3,t=15,pt=6,l=2,sg=0,ft=0,st=OK:0100
        2357 TSF:MSG:READ,0-0-100,s=255,c=3,t=15,pt=6,l=2,sg=0:0100
        2365 TSF:MSG:SEND,100-100-0-0,s=255,c=0,t=17,pt=0,l=11,sg=0,ft=0,st=OK:2.3.1-alpha
        2375 TSF:MSG:SEND,100-100-0-0,s=255,c=3,t=6,pt=1,l=1,sg=0,ft=0,st=OK:0
        2838 TSF:MSG:READ,0-0-100,s=255,c=3,t=6,pt=0,l=1,sg=0:M
        2846 TSF:MSG:SEND,100-100-0-0,s=255,c=3,t=11,pt=0,l=14,sg=0,ft=0,st=OK:SmartSleepTest
        2856 TSF:MSG:SEND,100-100-0-0,s=255,c=3,t=12,pt=0,l=3,sg=0,ft=0,st=OK:1.0
        2867 TSF:MSG:SEND,100-100-0-0,s=1,c=0,t=36,pt=0,l=4,sg=0,ft=0,st=OK:Info
        2875 MCO:REG:REQ
        2912 !TSF:MSG:SEND,100-100-0-0,s=255,c=3,t=26,pt=1,l=1,sg=0,ft=0,st=NACK:2
        4923 TSF:MSG:SEND,100-100-0-0,s=255,c=3,t=26,pt=1,l=1,sg=0,ft=1,st=OK:2
        4995 TSF:MSG:READ,0-0-100,s=255,c=3,t=27,pt=1,l=1,sg=0:1
        5001 MCO:PIM:NODE REG=1
        5003 MCO:BGN:STP
        5005 MCO:BGN:INIT OK,TSP=1
        6008 MCO:SLP:MS=3000,SMS=1,I1=0,M1=3,I2=255,M2=255
        6017 TSF:MSG:SEND,100-100-0-0,s=255,c=3,t=32,pt=5,l=4,sg=0,ft=0,st=OK:600
        6625 TSF:TDI:TSL
        6627 MCO:SLP:WUP=-1
        6629 TSF:TRI:TSB
        8312 !TSF:MSG:SEND,100-100-0-0,s=255,c=3,t=33,pt=5,l=4,sg=0,ft=0,st=NACK:3000
        10524 MCO:SLP:MS=3000,SMS=1,I1=0,M1=3,I2=255,M2=255
        10532 TSF:MSG:SEND,100-100-0-0,s=255,c=3,t=32,pt=5,l=4,sg=0,ft=1,st=OK:600
        11141 TSF:TDI:TSL
        11143 MCO:SLP:WUP=-1
        11145 TSF:TRI:TSB
        12828 !TSF:MSG:SEND,100-100-0-0,s=255,c=3,t=33,pt=5,l=4,sg=0,ft=0,st=NACK:3000
        15036 MCO:SLP:MS=3000,SMS=1,I1=0,M1=3,I2=255,M2=255
        15044 TSF:MSG:SEND,100-100-0-0,s=255,c=3,t=32,pt=5,l=4,sg=0,ft=1,st=OK:600
        15652 TSF:TDI:TSL
        
        

        1.Go to the folder - C:\Users\Andrey\Documents\Arduino\libraries\MySensors-development

        2.Next, go to the folder - \drivers\RF24

        3.Open the file - RF24registers.h

        4.Change the parameters to these:
        ...lines 42-47.

        // ARD, auto retry delay

        #define RF24_SET_ARD (10)
        // ARD, auto retry count

        #define RF24_SET_ARC (15)

        5.Next, open the file-RF24.ccp
        Change the parameters to these:
        ...line 67
        ...line 114

        delayMicroseconds(100);

        The problem in radio driver, in his settings, apparently all wrote according to the Datasheet, but in life a bit otherwise)))

        Has now become:

         
         __  __       ____
        |  \/  |_   _/ ___|  ___ _ __  ___  ___  _ __ ___
        | |\/| | | | \___ \ / _ \ `_ \/ __|/ _ \| `__/ __|
        | |  | | |_| |___| |  __/ | | \__ \  _  | |  \__ \
        |_|  |_|\__, |____/ \___|_| |_|___/\___/|_|  |___/
                |___/                      2.3.1-alpha
        
        18 MCO:BGN:INIT NODE,CP=RNNNA---,VER=2.3.1-alpha
        28 TSM:INIT
        28 TSF:WUR:MS=0
        38 TSM:INIT:TSP OK
        43 TSF:SID:OK,ID=100
        45 TSM:FPAR
        102 TSF:MSG:SEND,100-100-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=OK:
        2111 !TSM:FPAR:NO REPLY
        2113 TSM:FPAR
        2170 TSF:MSG:SEND,100-100-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=OK:
        2736 TSF:MSG:READ,0-0-100,s=255,c=3,t=8,pt=1,l=1,sg=0:0
        2742 TSF:MSG:FPAR OK,ID=0,D=1
        4182 TSM:FPAR:OK
        4182 TSM:ID
        4184 TSM:ID:OK
        4186 TSM:UPL
        4194 TSF:MSG:SEND,100-100-0-0,s=255,c=3,t=24,pt=1,l=1,sg=0,ft=0,st=OK:1
        4300 TSF:MSG:READ,0-0-100,s=255,c=3,t=25,pt=1,l=1,sg=0:1
        4306 TSF:MSG:PONG RECV,HP=1
        4311 TSM:UPL:OK
        4311 TSM:READY:ID=100,PAR=0,DIS=1
        4319 TSF:MSG:SEND,100-100-0-0,s=255,c=3,t=15,pt=6,l=2,sg=0,ft=0,st=OK:0100
        4450 TSF:MSG:READ,0-0-100,s=255,c=3,t=15,pt=6,l=2,sg=0:0100
        4462 TSF:MSG:SEND,100-100-0-0,s=255,c=0,t=17,pt=0,l=11,sg=0,ft=0,st=OK:2.3.1-alpha
        4474 TSF:MSG:SEND,100-100-0-0,s=255,c=3,t=6,pt=1,l=1,sg=0,ft=0,st=OK:0
        4939 TSF:MSG:READ,0-0-100,s=255,c=3,t=6,pt=0,l=1,sg=0:M
        4950 TSF:MSG:SEND,100-100-0-0,s=255,c=3,t=11,pt=0,l=14,sg=0,ft=0,st=OK:SmartSleepTest
        4966 TSF:MSG:SEND,100-100-0-0,s=255,c=3,t=12,pt=0,l=3,sg=0,ft=0,st=OK:1.0
        4976 TSF:MSG:SEND,100-100-0-0,s=1,c=0,t=36,pt=0,l=4,sg=0,ft=0,st=OK:Info
        4984 MCO:REG:REQ
        5021 TSF:MSG:SEND,100-100-0-0,s=255,c=3,t=26,pt=1,l=1,sg=0,ft=0,st=OK:2
        5308 TSF:MSG:READ,0-0-100,s=255,c=3,t=27,pt=1,l=1,sg=0:1
        5314 MCO:PIM:NODE REG=1
        5316 MCO:BGN:STP
        5318 MCO:BGN:INIT OK,TSP=1
        6322 MCO:SLP:MS=3000,SMS=1,I1=0,M1=3,I2=255,M2=255
        6334 TSF:MSG:SEND,100-100-0-0,s=255,c=3,t=32,pt=5,l=4,sg=0,ft=0,st=OK:600
        6942 TSF:TDI:TSL
        6944 MCO:SLP:WUP=-1
        6946 TSF:TRI:TSB
        6952 TSF:MSG:SEND,100-100-0-0,s=255,c=3,t=33,pt=5,l=4,sg=0,ft=0,st=OK:3000
        9164 MCO:SLP:MS=3000,SMS=1,I1=0,M1=3,I2=255,M2=255
        9177 TSF:MSG:SEND,100-100-0-0,s=255,c=3,t=32,pt=5,l=4,sg=0,ft=0,st=OK:600
        9785 TSF:TDI:TSL
        9787 MCO:SLP:WUP=-1
        9789 TSF:TRI:TSB
        9797 TSF:MSG:SEND,100-100-0-0,s=255,c=3,t=33,pt=5,l=4,sg=0,ft=0,st=OK:3000
        12005 MCO:SLP:MS=3000,SMS=1,I1=0,M1=3,I2=255,M2=255
        12017 TSF:MSG:SEND,100-100-0-0,s=255,c=3,t=32,pt=5,l=4,sg=0,ft=0,st=OK:600
        12625 TSF:TDI:TSL
        
        

        use.. ;)

        1 Reply Last reply
        1
        • H Offline
          H Offline
          Henrik Nielsen
          wrote on last edited by
          #10

          It works :D You're a wizard @berkseo :)

          I do infact use the cheap radio modules from china, so I think you're right about the possible lacking of quality in the hardware :/

          I guess there is not a way I can change these settings somewhere local to my sketch, so they do not get overwritten the next time I update the MySensors lib?

          Anyway, it's great that it works now, and I will just bookmark this topic for future reference.

          Thank again for your assistance :)

          berkseoB 1 Reply Last reply
          0
          • H Henrik Nielsen

            It works :D You're a wizard @berkseo :)

            I do infact use the cheap radio modules from china, so I think you're right about the possible lacking of quality in the hardware :/

            I guess there is not a way I can change these settings somewhere local to my sketch, so they do not get overwritten the next time I update the MySensors lib?

            Anyway, it's great that it works now, and I will just bookmark this topic for future reference.

            Thank again for your assistance :)

            berkseoB Offline
            berkseoB Offline
            berkseo
            wrote on last edited by
            #11

            @henrik-nielsen
            Everyone uses cheap radio modules, it's a reality. One thing is technical specifications, the other is real network on real equipment. Although I think if you take a very original radios, it will be the same in 99%)). ....Glad to help, it's called a community.

            H 1 Reply Last reply
            1
            • berkseoB berkseo

              @henrik-nielsen
              Everyone uses cheap radio modules, it's a reality. One thing is technical specifications, the other is real network on real equipment. Although I think if you take a very original radios, it will be the same in 99%)). ....Glad to help, it's called a community.

              H Offline
              H Offline
              Henrik Nielsen
              wrote on last edited by
              #12

              @berkseo I just started wondering if "everyone" uses cheap chinese radios, should this fix be part of the official code base?

              Maybe just as something that could be enabled if needed.

              scalzS 1 Reply Last reply
              0
              • H Henrik Nielsen

                @berkseo I just started wondering if "everyone" uses cheap chinese radios, should this fix be part of the official code base?

                Maybe just as something that could be enabled if needed.

                scalzS Offline
                scalzS Offline
                scalz
                Hardware Contributor
                wrote on last edited by scalz
                #13

                @henrik-nielsen said in SmartSleep wake up message always get NACK:

                if "everyone" uses cheap chinese radios, should this fix be part of the official code base?

                simple! add issue or pull request to mysensors github. that's the easiest way when there's issue to fix ;)
                because the team can't follow all forum topics and make todolist, in this way this is not handy.

                berkseoB 1 Reply Last reply
                0
                • scalzS scalz

                  @henrik-nielsen said in SmartSleep wake up message always get NACK:

                  if "everyone" uses cheap chinese radios, should this fix be part of the official code base?

                  simple! add issue or pull request to mysensors github. that's the easiest way when there's issue to fix ;)
                  because the team can't follow all forum topics and make todolist, in this way this is not handy.

                  berkseoB Offline
                  berkseoB Offline
                  berkseo
                  wrote on last edited by berkseo
                  #14

                  @scalz said in SmartSleep wake up message always get NACK:

                  pull request

                  I made a pull request. I think that this will accept. Apparently the next version will already be. ...I'm not sure this is absolutely perfect, a mistake in the first message after sleeping mostly. Perhaps later it is better to modify startListening, although, of course, now it is a good solution, but not ideal.

                  H M 2 Replies Last reply
                  1
                  • berkseoB berkseo

                    @scalz said in SmartSleep wake up message always get NACK:

                    pull request

                    I made a pull request. I think that this will accept. Apparently the next version will already be. ...I'm not sure this is absolutely perfect, a mistake in the first message after sleeping mostly. Perhaps later it is better to modify startListening, although, of course, now it is a good solution, but not ideal.

                    H Offline
                    H Offline
                    Henrik Nielsen
                    wrote on last edited by
                    #15

                    @berkseo Great :) I am currently trying to figure out what my employers policy for open source contributions made in their employees spare time is, so I could make the pull request myself, but you beat me to it :(

                    1 Reply Last reply
                    1
                    • berkseoB berkseo

                      @scalz said in SmartSleep wake up message always get NACK:

                      pull request

                      I made a pull request. I think that this will accept. Apparently the next version will already be. ...I'm not sure this is absolutely perfect, a mistake in the first message after sleeping mostly. Perhaps later it is better to modify startListening, although, of course, now it is a good solution, but not ideal.

                      M Offline
                      M Offline
                      Memphis007
                      wrote on last edited by
                      #16

                      @berkseo Hi, could you post the link to your pull request ? I don't see any traces of it in MySensors Github repository.

                      BTW with my setup (genuine/good quality NRF24L01) increase lines 67 & 114 of RF24.ccp to 50 do the trick.

                      Thanks.

                      mfalkviddM 1 Reply Last reply
                      0
                      • M Memphis007

                        @berkseo Hi, could you post the link to your pull request ? I don't see any traces of it in MySensors Github repository.

                        BTW with my setup (genuine/good quality NRF24L01) increase lines 67 & 114 of RF24.ccp to 50 do the trick.

                        Thanks.

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

                        @memphis007 berseo's pull requests (link 1, link 2) were closed in favor of this pull request.

                        1 Reply Last reply
                        0
                        • M Offline
                          M Offline
                          Memphis007
                          wrote on last edited by
                          #18

                          @mfalkvidd I have applied Tekka007 pull request successfully, all is working correctly now. Thanks !

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


                          12

                          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