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. Sensor node not working without #define MyDebug

Sensor node not working without #define MyDebug

Scheduled Pinned Locked Moved Troubleshooting
25 Posts 6 Posters 6.3k 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.
  • ayoA Offline
    ayoA Offline
    ayo
    wrote on last edited by
    #1

    Hello,
    I have built a sensor node with one of the mysensors examples and my gateway runs the default SerialGateway code without any modification. Sensor node is running on Arduino Mega and Gateway device runs on Arduino Uno and am using the mysensor 2.0. Everything is working properly well but when I tried commenting the #define MY_DEBUG on the gateway code I observe that the sensor node can't seems to work well again and can't successfully connect to the gateway device.

    Sensor node won't work well if comment the My_Debug code on the gateway.

    //#define MY_DEBUG 
    

    Sensor node works well if I uncomment the My_Debug code on the gateway

    #define MY_DEBUG 
    

    My sensor node #define MY_DEBUG code is uncommented.

    This is the screenshot of the result from the gateway and the sensor node respectively

    0_1475254771931_Capture1.JPG

    Result from the sensor node

    0_1475254820875_Capture2.JPG

    It fails at this stage

    TSP:PING:SEND (dest=0)
    !TSP:MSG:SEND 8-8-0-0 s=255,c=3,t=24,pt=1,l=1,sg=0,ft=0,st=fail:1
    TSP:CHKUPL:FAIL (hops=255)
    !TSM:UPL:FAIL
    

    What am I doing wrong? or any fix to make the gateway work with printing out the debug messages.

    I will really appreciate the help.

    Thank You.

    karl261K 1 Reply Last reply
    0
    • cimba007C Offline
      cimba007C Offline
      cimba007
      wrote on last edited by
      #2

      Can u describe more about your sensor node? What voltage? What speed? General setup?!

      ayoA 1 Reply Last reply
      0
      • ayoA ayo

        Hello,
        I have built a sensor node with one of the mysensors examples and my gateway runs the default SerialGateway code without any modification. Sensor node is running on Arduino Mega and Gateway device runs on Arduino Uno and am using the mysensor 2.0. Everything is working properly well but when I tried commenting the #define MY_DEBUG on the gateway code I observe that the sensor node can't seems to work well again and can't successfully connect to the gateway device.

        Sensor node won't work well if comment the My_Debug code on the gateway.

        //#define MY_DEBUG 
        

        Sensor node works well if I uncomment the My_Debug code on the gateway

        #define MY_DEBUG 
        

        My sensor node #define MY_DEBUG code is uncommented.

        This is the screenshot of the result from the gateway and the sensor node respectively

        0_1475254771931_Capture1.JPG

        Result from the sensor node

        0_1475254820875_Capture2.JPG

        It fails at this stage

        TSP:PING:SEND (dest=0)
        !TSP:MSG:SEND 8-8-0-0 s=255,c=3,t=24,pt=1,l=1,sg=0,ft=0,st=fail:1
        TSP:CHKUPL:FAIL (hops=255)
        !TSM:UPL:FAIL
        

        What am I doing wrong? or any fix to make the gateway work with printing out the debug messages.

        I will really appreciate the help.

        Thank You.

        karl261K Offline
        karl261K Offline
        karl261
        wrote on last edited by
        #3

        @ayo Hmmm I experienced this also Once with the default repeater node sketch. The radio failed completely when commenting out the my_debug.
        However, it went away somehow, so I cannot debug it. It went away after several reuploads of the sketch. So maybe there was just something wrong during programming in my case...

        ayoA 1 Reply Last reply
        0
        • cimba007C cimba007

          Can u describe more about your sensor node? What voltage? What speed? General setup?!

          ayoA Offline
          ayoA Offline
          ayo
          wrote on last edited by
          #4

          The Sensor node is being powered by an Arduino Mega 2560 var a USB connection to my pc as source of power. I have a 10uf cap btw the 3.3v and Gnd that powers the nrf24L01+ radio. It's just the normal traditional sensor node setup. Also I have an Led connected to one of the arduino mega pins (pin 4).
          @cimba007 said:

          Can u describe more about your sensor node? What voltage? What speed? General setup?!

          1 Reply Last reply
          0
          • karl261K karl261

            @ayo Hmmm I experienced this also Once with the default repeater node sketch. The radio failed completely when commenting out the my_debug.
            However, it went away somehow, so I cannot debug it. It went away after several reuploads of the sketch. So maybe there was just something wrong during programming in my case...

            ayoA Offline
            ayoA Offline
            ayo
            wrote on last edited by
            #5

            Is it commenting out my_Debug at the gateway side or at the sensor node side. Mine is at the gateway side and the sensor node fails to connect even though my_debug isn't commented out. I even try commenting it out self it doesn't still work either.

            @karl261 said:

            @ayo Hmmm I experienced this also Once with the default repeater node sketch. The radio failed completely when commenting out the my_debug.
            However, it went away somehow, so I cannot debug it. It went away after several reuploads of the sketch. So maybe there was just something wrong during programming in my case...

            1 Reply Last reply
            0
            • Alex PopovskiyA Offline
              Alex PopovskiyA Offline
              Alex Popovskiy
              wrote on last edited by
              #6

              I observed similar problem with nodes communication, only in opposite direction, the gateway was fine but two of my nodes required MY_DEBUG enabled to function properly. One of them was completely unreachable without MY_DEBUG or a delay(10) in the loop(), and other node had big problems receiving data (a lot of fail's). I couldn't figure out where the problem was, my assumption is that it is some kind of timing problem, maybe the radio being polled to fast or something... and debug prints certainly add some time to code execution and that kinda solves the problem. But thats only my assumption, I may be completely wrong

              1 Reply Last reply
              1
              • delinendD Offline
                delinendD Offline
                delinend
                wrote on last edited by
                #7

                I have the same problem on Serialgateway 2.0.1-beta. If I disable MY_DEBUG, nothing can't connect to the Gateway.

                1 Reply Last reply
                0
                • delinendD Offline
                  delinendD Offline
                  delinend
                  wrote on last edited by
                  #8

                  Update: If I set my RF24 to MIN (#define RF24_PA_LEVEL RF24_PA_MIN), then my NODE's can fine connect to my Serialgateway, with disabled MY_DEBUG. Hmm that's strange ?!?! So yes, maybe it's a timing problem. Btw. I use 47uF on all NRF24's.

                  tekkaT 1 Reply Last reply
                  0
                  • delinendD Offline
                    delinendD Offline
                    delinend
                    wrote on last edited by
                    #9

                    I have solved it, with the fix from Alex, with a delay(10) in the loop() :-) Thanks

                    tekkaT ayoA 2 Replies Last reply
                    0
                    • delinendD delinend

                      I have solved it, with the fix from Alex, with a delay(10) in the loop() :-) Thanks

                      tekkaT Offline
                      tekkaT Offline
                      tekka
                      Admin
                      wrote on last edited by tekka
                      #10

                      @delinend Please describe your GW setup, that is:

                      • HW type
                      • Frequency / voltage
                      • Arduino IDE version
                      • Board def version.

                      I'd like to reproduce your issue.

                      delinendD 2 Replies Last reply
                      0
                      • delinendD Offline
                        delinendD Offline
                        delinend
                        wrote on last edited by delinend
                        #11
                        This post is deleted!
                        1 Reply Last reply
                        0
                        • tekkaT tekka

                          @delinend Please describe your GW setup, that is:

                          • HW type
                          • Frequency / voltage
                          • Arduino IDE version
                          • Board def version.

                          I'd like to reproduce your issue.

                          delinendD Offline
                          delinendD Offline
                          delinend
                          wrote on last edited by
                          #12

                          @tekka
                          Last Mysensor 2.0.1-beta
                          2 Arduino Mini Pro (8Mhz) 3.3V version
                          2 NRF24l01+ with 47uF caps
                          Use a 3.6V LiPo battery on both setup's.
                          IDE 1.6.12

                          I use the standard GatewaySerial.ino and BinarySwitchSleepSensor.ino sketch, where the problem comes, when I disable the MY_DEBUG in the GatewaySerial.ino sketch.

                          I think the problem is, that the "void loop()" in the GatewaySerial.ino is empty, and the Arduino has a timing problem to the radio, as the loop is running to fast, without doing nothing. If I add delay(10) into the "void loop", it all works fine.

                          1 Reply Last reply
                          0
                          • tekkaT tekka

                            @delinend Please describe your GW setup, that is:

                            • HW type
                            • Frequency / voltage
                            • Arduino IDE version
                            • Board def version.

                            I'd like to reproduce your issue.

                            delinendD Offline
                            delinendD Offline
                            delinend
                            wrote on last edited by delinend
                            #13

                            @tekka
                            Btw. Another problem. If I use the "#define MY_DISABLED_SERIAL" on my GatewaySerial.ino I still get incomming message on the serial port. Ex. temp sendet from a tempsensor here:
                            6;0;1;0;0,24.5
                            6;0;1;0;0,24.6
                            6;0;1;0;0,24.5
                            6;0;1;0;0,24.4
                            6;0;1;0;0,24.5

                            tekkaT 1 Reply Last reply
                            0
                            • delinendD delinend

                              Update: If I set my RF24 to MIN (#define RF24_PA_LEVEL RF24_PA_MIN), then my NODE's can fine connect to my Serialgateway, with disabled MY_DEBUG. Hmm that's strange ?!?! So yes, maybe it's a timing problem. Btw. I use 47uF on all NRF24's.

                              tekkaT Offline
                              tekkaT Offline
                              tekka
                              Admin
                              wrote on last edited by
                              #14

                              @delinend
                              I also need the AVR board def version - you can find this information in the Boards Manager.

                              delinendD 1 Reply Last reply
                              0
                              • delinendD delinend

                                @tekka
                                Btw. Another problem. If I use the "#define MY_DISABLED_SERIAL" on my GatewaySerial.ino I still get incomming message on the serial port. Ex. temp sendet from a tempsensor here:
                                6;0;1;0;0,24.5
                                6;0;1;0;0,24.6
                                6;0;1;0;0,24.5
                                6;0;1;0;0,24.4
                                6;0;1;0;0,24.5

                                tekkaT Offline
                                tekkaT Offline
                                tekka
                                Admin
                                wrote on last edited by
                                #15

                                @delinend said:

                                @tekka
                                Btw. Another problem. If I use the "#define MY_DISABLED_SERIAL" on my GatewaySerial.ino I still get incomming message on the serial port. Ex. temp sendet from a tempsensor here:
                                6;0;1;0;0,24.5
                                6;0;1;0;0,24.6
                                6;0;1;0;0,24.5
                                6;0;1;0;0,24.4
                                6;0;1;0;0,24.5

                                Well, there is no sense in disabling the serial port on a serial gateway :smirk:

                                1 Reply Last reply
                                1
                                • tekkaT tekka

                                  @delinend
                                  I also need the AVR board def version - you can find this information in the Boards Manager.

                                  delinendD Offline
                                  delinendD Offline
                                  delinend
                                  wrote on last edited by
                                  #16

                                  @tekka
                                  BN: Unknown board
                                  VID: 10C4
                                  PID EA60
                                  SN: Upload any sketch to obtain it

                                  Btw. I use OpTiboot loader

                                  tekkaT 1 Reply Last reply
                                  0
                                  • delinendD delinend

                                    I have solved it, with the fix from Alex, with a delay(10) in the loop() :-) Thanks

                                    ayoA Offline
                                    ayoA Offline
                                    ayo
                                    wrote on last edited by ayo
                                    #17

                                    So I tried to see if I make one last attempt to fix this problem again, I tried the Alex option using a delay(10) in the for loop. So I put a delay(10) in the for loop of my gateway code whoa it works fully well. I guess their is truly a timely issues here and the enable my_debug it's somehow doing a slowing things down work.
                                    But using a delay(10) in the loop isn't really an efficient way though.
                                    @delinend said:

                                    I have solved it, with the fix from Alex, with a delay(10) in the loop() :-) Thanks

                                    UPDATE: Using a delay(1) also works for me too

                                    1 Reply Last reply
                                    0
                                    • delinendD delinend

                                      @tekka
                                      BN: Unknown board
                                      VID: 10C4
                                      PID EA60
                                      SN: Upload any sketch to obtain it

                                      Btw. I use OpTiboot loader

                                      tekkaT Offline
                                      tekkaT Offline
                                      tekka
                                      Admin
                                      wrote on last edited by tekka
                                      #18

                                      @delinend Still not the right thing. Sorry for bugging you with that ;)

                                      You'll find the requested information under:

                                      In Arduino IDE under Tools | Board | Boards Manager => Arduino AVR Boards Built-in by Arduino version 1.6.xx

                                      delinendD 1 Reply Last reply
                                      0
                                      • tekkaT tekka

                                        @delinend Still not the right thing. Sorry for bugging you with that ;)

                                        You'll find the requested information under:

                                        In Arduino IDE under Tools | Board | Boards Manager => Arduino AVR Boards Built-in by Arduino version 1.6.xx

                                        delinendD Offline
                                        delinendD Offline
                                        delinend
                                        wrote on last edited by
                                        #19

                                        @tekka
                                        It's: Arduino AVR Board Built-In by Arduino version 1.6.14 installed.

                                        tekkaT 1 Reply Last reply
                                        0
                                        • delinendD delinend

                                          @tekka
                                          It's: Arduino AVR Board Built-In by Arduino version 1.6.14 installed.

                                          tekkaT Offline
                                          tekkaT Offline
                                          tekka
                                          Admin
                                          wrote on last edited by
                                          #20

                                          @delinend I've tried your setup but cannot reproduce your issue. Are you on the latest dev branch (from today)? What board did you choose in the settings?

                                          Out of curiosity, please upload this sketch:

                                          #define MY_CORE_ONLY
                                          #define MY_DEBUG
                                          #include <MySensors.h>
                                          
                                          void setup() {
                                            Serial.begin(115200);
                                            Serial.println("***");
                                            Serial.print("V=");
                                            Serial.println(hwCPUVoltage());
                                            Serial.print("F=");
                                            Serial.println(hwCPUFrequency());  
                                            Serial.println("***");
                                          }
                                          
                                          void loop() {}
                                          

                                          and post the serial output.

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


                                          15

                                          Online

                                          11.7k

                                          Users

                                          11.2k

                                          Topics

                                          113.0k

                                          Posts


                                          Copyright 2019 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