How to properly debug Serial Gateway nRF24L01+ ?



  • Hi,

    I have a problem with my serial gateway described in more detail here:
    http://forum.mysensors.org/topic/797/pimatic-mysensors-controller-plugin/57
    I am using the 1.5 mysensors library. And an arduino nano with a nRF24L01+ which has worked for 3 weeks before it started to do weird stuff.

    My question is now, how can I get some debug messages? I never get any output, apart from the

    0;0;3;0;9;gateway started, id=0, parent=0, distance=0
    0;0;3;0;14;Gateway startup complete.
    

    So, I tried to add

    rf24.printDetails();
    

    in the MyTransportNRF24.cpp but it did not show anything. I also discovered

    #define FAILURE_HANDLING
     #define SERIAL_DEBUG
    //  #define MINIMAL 
    

    in the RF24_config.h and that it has something to do with what debug output is shown. But whatever combination of these I do, I never see any debug output.

    What am I overlooking?
    Thanks!



  • No one? Really? I can't get the output of
    RF24 printDetails();
    in my sketch.
    Can anybody tell me how I can use the printDetails(); function in the SerialGateway.ino to show the radio details on the serial console? I can't get it to work... I am using the 1.5 library.


  • Admin



  • @hek Thanks a lot! That really helped. Finally had time to look into it. So for other people I will try to write down what I did. I tested this for one of my sensors.
    I am using Mysensors 1.5 master branch.

    1. MyTransportNRF24: I commented out the "private:" to make the rf24 function public.
    2. RF24_config.h: I commented out the "#define MINIMAL" to make some more functions available in RF24.cpp.
    3. then I added to my sketch:
    • "#include <printf.h>" in the beginning, I found the file somewhere on the net.
    • in the void setup() function I added "printf_begin();" I do not fully understand this, but it seems to define stdio. Because I read in RF24.h
      printf.h
    /**
       * Print a giant block of debugging information to stdout
       *
       * @warning Does nothing if stdout is not defined.  See fdevopen in stdio.h
       */
      void printDetails(void);
    
    • in the void loop(); I added "radio.rf24.printDetails();"

    ... and after several months of research it is finally printing some debug output. For example: PA Power = PA_HIGH

    I wonder why this is so difficult to use and there is so little info about debugging.

    Hope it helps someone!


 

313
Online

8.3k
Users

9.2k
Topics

97.3k
Posts