Adafruit RFM69HCW and Arduino Nano



  • Hi,

    I have two Adafruit RFM69HCW breakout boards connected to 5V Nano's and they are communicating well using the Radiohead examples shown here . However they do not work with mysensors.

    I am trying to setup a serial gateway with the following:

    #define MY_DEBUG                                                                    
    #define MY_RADIO_RFM69                                                              
    #define MY_IS_RFM69HW                                                               
    #define MY_RFM69_NEW_DRIVER
    #define MY_RFM69_FREQUENCY RFM69_433MHZ                                            
    
    #define RFM69_INT     3   
    #define MY_RFM69_CS_PIN      4 
    #define MY_RFM69_RST_PIN     2  
    #define LED           13
    #define MY_DEBUG_VERBOSE_RFM69                                                      
    #define MY_DEBUG_VERBOSE_RFM69_REGISTERS                                            
    #define MY_GATEWAY_SERIAL                                                           
    
    #include <MySensors.h>
    
    void setup()                                                                        // Setup locally attached sensors
    {
      Serial.println("Adafruit RFM69HWC Gateway v1.0 : setup");
    
     // manual reset
      digitalWrite(MY_RFM69_RST_PIN, HIGH);
      delay(10);
      digitalWrite(MY_RFM69_RST_PIN, LOW);
      delay(10);
    }
    
    void presentation()                                                                    
    {    sendSketchInfo("Holly House Adafruit RFM69HWC Gateway",  "1.0");               
    }
    
    void loop()                                                                        
    {    
    }
    

    The serial log for the above results in this.

    And if i comment out the #define MY_RFM69_NEW_DRIVER i get the following:

    14:18:16.049 -> 0;255;3;0;9;0 MCO:BGN:INIT GW,CP=RRNGA---,FQ=16,REL=255,VER=2.3.2
    14:18:16.286 -> 0;255;3;0;9;205 TSM:INIT
    14:18:16.286 -> 0;255;3;0;9;207 TSF:WUR:MS=0
    14:18:16.320 -> 0;255;3;0;9;259 !TSM:INIT:TSP FAIL
    14:18:16.320 -> 0;255;3;0;9;262 TSM:FAIL:CNT=1
    14:18:16.320 -> 0;255;3;0;9;265 TSM:FAIL:DIS
    14:18:16.320 -> 0;255;3;0;9;267 TSF:TDI:TSL
    14:18:26.327 -> 0;255;3;0;9;10270 TSM:FAIL:RE-INIT
    14:18:26.533 -> 0;255;3;0;9;10473 TSM:INIT
    14:18:26.601 -> 0;255;3;0;9;10525 !TSM:INIT:TSP FAIL
    14:18:26.601 -> 0;255;3;0;9;10528 TSM:FAIL:CNT=2
    14:18:26.601 -> 0;255;3;0;9;10531 TSM:FAIL:DIS
    14:18:26.601 -> 0;255;3;0;9;10534 TSF:TDI:TSL
    14:18:36.599 -> 0;255;3;0;9;20537 TSM:FAIL:RE-INIT
    14:18:36.802 -> 0;255;3;0;9;20740 TSM:INIT
    14:18:36.837 -> 0;255;3;0;9;20792 !TSM:INIT:TSP FAIL
    14:18:36.837 -> 0;255;3;0;9;20795 TSM:FAIL:CNT=3
    14:18:36.837 -> 0;255;3;0;9;20798 TSM:FAIL:DIS
    14:18:36.871 -> 0;255;3;0;9;20801 TSF:TDI:TSL
    14:18:46.854 -> 0;255;3;0;9;30804 TSM:FAIL:RE-INIT
    14:18:47.060 -> 0;255;3;0;9;31007 TSM:INIT
    14:18:47.094 -> 0;255;3;0;9;31059 !TSM:INIT:TSP FAIL
    14:18:47.128 -> 0;255;3;0;9;31063 TSM:FAIL:CNT=4
    14:18:47.128 -> 0;255;3;0;9;31066 TSM:FAIL:DIS
    14:18:47.128 -> 0;255;3;0;9;31069 TSF:TDI:TSL
    

    Where should i start in troubleshooting why the radios don't work with mysensors?

    thanks


  • Mod

    @keithJ said in Adafruit RFM69HCW and Arduino Nano:

    !TSM:INIT:TSP FAIL

    Indicates a communication error with the radio. Double check your wiring and the configuration of mysensors.


  • Mod

    @keithJ Not sure why your sketch manually resets the radio, but resetting in setup() will likely mess upp MySensors' initialization of the radio, which is done before setup()is called. See https://www.mysensors.org/download/sensor_api_20#node-boot-sequence for information on when the different functions are called.

    Try removing the manual reset, or move it from setup() to before().



  • @Yveaux

    I assume the wiring is ok because the radios work with the RadioHead example?

    The mysensors configure file has defaults for rf24 and an Ethernet gateway etc, but doesn't the gateway code i'm using override this?



  • @mfalkvidd

    I cant recall why i had the manual reset now, but know it was from a post with related issues with the RFM69.
    I have removed it and also tried moving it to before() but no luck.

    My current GW Code is :

    #define MY_DEBUG                                                                    
    #define MY_RADIO_RFM69                                                              
    #define MY_IS_RFM69HW                                                               
    #define MY_RFM69_NEW_DRIVER
    #define MY_RFM69_FREQUENCY RFM69_433MHZ                                            
    
    #define RFM69_INT     3   
    #define MY_RFM69_CS_PIN      4 
    #define MY_RFM69_RST_PIN     2  
    #define LED           13
                                               
    #define MY_GATEWAY_SERIAL                                                          
    #include <MySensors.h>
    
    void setup()                                                                        
    {  
    }
    
    void loop()                                                                        
    {    
    }
    

    And the repeater node is:

    // Enable debug prints to serial monitor
    #define MY_DEBUG
    
    // Enable and select radio type attached
    #define MY_RADIO_RFM69                                                              
    #define MY_IS_RFM69HW                                                               
    #define MY_RFM69_NEW_DRIVER
    #define MY_RFM69_FREQUENCY RFM69_433MHZ                                            
    
    #define RFM69_INT 3   
    #define MY_RFM69_CS_PIN 4 
    #define MY_RFM69_RST_PIN  2  
    #define LED 13
    
    // Enabled repeater feature for this node
    #define MY_REPEATER_FEATURE
    #include <MySensors.h>
    
    void setup()
    {
    }
    
    void loop()
    {
    }
    
    

    The result is that the GW outputs the following (and then does nothing else) :

    10:50:48.729 -> 0;255;3;0;9;0 MCO:BGN:INIT GW,CP=RPNGA---,FQ=16,REL=255,VER=2.3.2
    10:50:48.729 -> 0;255;3;0;9;5 MCO:BGN:BFR
    10:50:48.729 -> 0;255;3;0;9;27 TSM:INIT
    10:50:48.729 -> 0;255;3;0;9;29 TSF:WUR:MS=0
    10:50:48.763 -> 0;255;3;0;9;38 TSM:INIT:TSP OK
    10:50:48.763 -> 0;255;3;0;9;40 TSM:INIT:GW MODE
    10:50:48.763 -> 0;255;3;0;9;44 TSM:READY:ID=0,PAR=0,DIS=0
    10:50:48.763 -> 0;255;3;0;9;48 MCO:REG:NOT NEEDED
    10:50:48.763 -> 0;255;3;0;14;Gateway startup complete.
    10:50:48.763 -> 0;255;0;0;18;2.3.2
    10:50:48.763 -> 0;255;3;0;9;52 MCO:BGN:STP
    10:50:48.763 -> 0;255;3;0;9;58 MCO:BGN:INIT OK,TSP=0
    10:50:48.763 -> 0;255;3;0;9;62 TSM:READY:NWD REQ
    10:50:51.288 -> 0;255;3;0;9;2565 ?TSF:MSG:SEND,0-0-255-255,s=255,c=3,t=20,pt=0,l=0,sg=0,ft=0,st=OK:
    

    and the repeater node gives:

    10:51:36.661 ->  
    10:51:36.661 ->  __  __       ____
    10:51:36.661 -> |  \/  |_   _/ ___|  ___ _ __  ___  ___  _ __ ___
    10:51:36.661 -> | |\/| | | | \___ \ / _ \ `_ \/ __|/ _ \| `__/ __|
    10:51:36.661 -> | |  | | |_| |___| |  __/ | | \__ \  _  | |  \__ \
    10:51:36.696 -> |_|  |_|\__, |____/ \___|_| |_|___/\___/|_|  |___/
    10:51:36.696 ->         |___/                      2.3.2
    10:51:36.696 -> 
    10:51:36.696 -> 16 MCO:BGN:INIT REPEATER,CP=RPNRA---,FQ=16,REL=255,VER=2.3.2
    10:51:36.696 -> 27 MCO:BGN:BFR
    10:51:36.731 -> 49 TSM:INIT
    10:51:36.731 -> 50 TSF:WUR:MS=0
    10:51:36.731 -> 57 TSM:INIT:TSP OK
    10:51:36.731 -> 59 TSM:FPAR
    10:51:37.239 -> 561 ?TSF:MSG:SEND,255-255-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=OK:
    10:51:39.230 -> 2568 !TSM:FPAR:NO REPLY
    10:51:39.230 -> 2570 TSM:FPAR
    10:51:41.764 -> 5072 ?TSF:MSG:SEND,255-255-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=OK:
    10:51:43.783 -> 7080 !TSM:FPAR:NO REPLY
    10:51:43.783 -> 7083 TSM:FPAR
    10:51:46.286 -> 9585 ?TSF:MSG:SEND,255-255-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=OK:
    10:51:48.302 -> 11592 !TSM:FPAR:NO REPLY
    10:51:48.302 -> 11594 TSM:FPAR
    10:51:50.829 -> 14096 ?TSF:MSG:SEND,255-255-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=OK:
    10:51:52.822 -> 16103 !TSM:FPAR:FAIL
    10:51:52.822 -> 16104 TSM:FAIL:CNT=1
    10:51:52.822 -> 16106 TSM:FAIL:DIS
    10:51:52.822 -> 16108 TSF:TDI:TSL
    10:52:02.876 -> 26112 TSM:FAIL:RE-INIT
    10:52:02.876 -> 26114 TSM:INIT
    10:52:02.876 -> 26121 TSM:INIT:TSP OK
    10:52:02.876 -> 26123 TSM:FPAR
    10:52:03.387 -> 26625 ?TSF:MSG:SEND,255-255-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=OK:
    10:52:05.404 -> 28633 !TSM:FPAR:NO REPLY
    10:52:05.404 -> 28635 TSM:FPAR
    10:52:07.934 -> 31137 ?TSF:MSG:SEND,255-255-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=OK:
    10:52:09.942 -> 33144 !TSM:FPAR:NO REPLY
    10:52:09.942 -> 33146 TSM:FPAR
    10:52:12.432 -> 35648 ?TSF:MSG:SEND,255-255-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=OK:
    10:52:14.449 -> 37655 !TSM:FPAR:NO REPLY
    10:52:14.449 -> 37657 TSM:FPAR
    10:52:16.984 -> 40159 ?TSF:MSG:SEND,255-255-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=OK:
    10:52:19.000 -> 42166 !TSM:FPAR:FAIL
    10:52:19.000 -> 42167 TSM:FAIL:CNT=2
    10:52:19.000 -> 42169 TSM:FAIL:DIS
    10:52:19.000 -> 42171 TSF:TDI:TSL
    

    Using the log parser this would suggest that the transport is ready and the gateway is running, but that the repeater node cant find the parent?

    The radios are sitting on the same desk, and i see 0;255;3;0;9;807 RFM69:CSMA:RSSI=0 repeatedly when #define MY_DEBUG_VERBOSE_RFM69 is set.

    So this must be a power issue?


  • Mod

    @keithJ try moving the devices further apart (at least 2m/6ft). The signal may bee to strong for the gateway to receive.

    Removing the manual reset was good. You’re getting TSM:INIT:TSP OK now, instead if fail.



  • Yes, its good to see TSP OK πŸ™‚

    I've separated them to around 4m and unfortunately its made no difference, and they work fine using the RadioHead example when they are only 100mm apart.

    One thing... if i connect the rst pin of the radio to pin2 of the arduino - and set #MY_RFM69_RST_PIN 2 - the RSSI values are 0.

    If i change the rst pin to another pin, for example pin 5 on the arduino and set #MY_RFM69_RST_PIN 5 - the RSSI values are -32.

    The RSSI value on the gateway is in the -90's.

    Im struggling to understand why they communicate immediately, reliably, and within close proximity when i use the RH code, but fail when i include mysensors?


  • Mod

    @keithJ MySensors uses a rfm69 library from lowpowerlab, but I don't see why it should make a big difference. I don't have experience troubleshooting rfm69, but hopefully someone else can pitch in.


  • Hardware Contributor

    @keithJ
    it sounds like you have a problem with IRQ mapping. If bad irq mapping, then no irq is triggered and it can't receive any reply.

    it could be your RFM69_INT define, which is not a MySensors define afaik. So I guess it uses MySensors default mapping

    Instead, try to use this define : MY_RFM69_IRQ_PIN

    You don't need to handle rst pin in before(), as MySensors driver already does it when it's defined.

    I use new rfm69 driver (different than lowpowerlab driver), and no problem, even when modules are close on same desk. In that case, TX power level will auto adjust to use as less power as possible.



  • @scalz said in Adafruit RFM69HCW and Arduino Nano:

    MY_RFM69_IRQ_PIN

    πŸ‘

    I changed the IRQ define and its now working!

    i really appreciate the help, thank you.


  • Hardware Contributor

    Enjoy πŸ™‚


Log in to reply
 

Suggested Topics

10
Online

11.4k
Users

11.1k
Topics

112.7k
Posts