Having problems with RFM69HW in Raspberry Pi



  • Hello everyone, I've been using OpenHab for a while now, and I created a bunch of Arduino devices using MySensors to control some lights around the house.
    I am using a PI Model 3B v1.2 with an RFM69HW wired as described in https://www.mysensors.org/build/raspberry#wiring

    I am pulling version 2.3.2 from https://github.com/mysensors/MySensors/releases/tag/2.3.2 and compiling with these flags

    ./configure --my-transport=rfm69 --my-is-rfm69hw --my-rfm69-frequency=915 --my-gateway=mqtt --my-controller-ip-address=127.0.0.1 --my-mqtt-publish-topic-prefix=mysensors-out --my-mqtt-subscribe-topic-prefix=mysensors-in --my-mqtt-client-id=my_sensors_gw --my-mqtt-user=openhabian --my-mqtt-password=mqtt
    

    Then, for the sensors code, I am using the #define MY_RFM69_NEW_DRIVER as described in the documentation.

    This has been working perfectly so far, and I decided to stop using openhabian as the OS in the raspberry, and wanted to switch to the default Raspberry Pi OS and use docker to be able to switch openhab versions more easily... And this is where the problems started. I tried compiling the mysgw and while it does compile and run, I am not able to communicate properly between the sensors and the GW. Here's the log when I start mysgw:

    pi@openhab:~/MySensors $ sudo bin/mysgw                                                                                                                                             
    Jun 06 15:36:20 INFO  Starting gateway...                                                                                                                                           
    Jun 06 15:36:20 INFO  Protocol version - 2.3.2                                                                                                                                      
    Jun 06 15:36:20 DEBUG MCO:BGN:INIT GW,CP=RPNGL---,FQ=NA,REL=255,VER=2.3.2                                                                                                           
    Jun 06 15:36:20 DEBUG TSF:LRT:OK                                                                                                                                                    
    Jun 06 15:36:20 DEBUG TSM:INIT                                                                                                                                                      
    Jun 06 15:36:20 DEBUG TSF:WUR:MS=0                                                                                                                                                  
    Jun 06 15:36:20 DEBUG TSM:INIT:TSP OK                                                                                                                                               
    Jun 06 15:36:20 DEBUG TSM:INIT:GW MODE                                                                                                                                              
    Jun 06 15:36:20 DEBUG TSM:READY:ID=0,PAR=0,DIS=0                                                                                                                                    
    Jun 06 15:36:20 DEBUG MCO:REG:NOT NEEDED                                                                                                                                            
    Jun 06 15:36:20 DEBUG MCO:BGN:STP                                                                                                                                                   
    Jun 06 15:36:20 DEBUG MCO:BGN:INIT OK,TSP=1                                                                                                                                         
    Jun 06 15:36:20 DEBUG GWT:RMQ:CONNECTING...                                                                                                                                         
    Jun 06 15:36:20 DEBUG connected to 127.0.0.1                                                                                                                                        
    Jun 06 15:36:20 DEBUG GWT:RMQ:OK                                                                                                                                                    
    Jun 06 15:36:20 DEBUG GWT:TPS:TOPIC=mysensors-out/0/255/0/0/18,MSG SENT                                                                                                             
    Jun 06 15:36:20 DEBUG TSM:READY:NWD REQ                                                                                                                                             
    Jun 06 15:36:22 DEBUG ?TSF:MSG:SEND,0-0-255-255,s=255,c=3,t=20,pt=0,l=0,sg=0,ft=0,st=OK:
    

    While the log appears to be correct and the gw ready to communicate, when a sensor tries to speak to it:

    __  __       ____
    |  \/  |_   _/ ___|  ___ _ __  ___  ___  _ __ ___
    | |\/| | | | \___ \ / _ \ `_ \/ __|/ _ \| `__/ __|
    | |  | | |_| |___| |  __/ | | \__ \  _  | |  \__ \
    |_|  |_|\__, |____/ \___|_| |_|___/\___/|_|  |___/
            |___/                      2.3.2
    
    16 MCO:BGN:INIT NODE,CP=RPNNA---,FQ=8,REL=255,VER=2.3.2
    28 TSM:INIT
    28 TSF:WUR:MS=0
    32 TSM:INIT:TSP OK
    34 TSM:INIT:STATID=220
    36 TSF:SID:OK,ID=220
    38 TSM:FPAR
    45 ?TSF:MSG:SEND,220-220-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=OK:
    2054 !TSM:FPAR:NO REPLY
    2056 TSM:FPAR
    2062 ?TSF:MSG:SEND,220-220-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=OK:
    4071 !TSM:FPAR:NO REPLY
    4073 TSM:FPAR
    4079 ?TSF:MSG:SEND,220-220-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=OK:
    6088 !TSM:FPAR:NO REPLY
    6090 TSM:FPAR
    6096 ?TSF:MSG:SEND,220-220-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=OK:
    8108 !TSM:FPAR:FAIL
    8110 TSM:FAIL:CNT=1
    8112 TSM:FAIL:DIS
    8114 TSF:TDI:TSL
    

    Any hint on what could it be going on? before I switched from openhabian to raspberry os, everything was working fine, so frequencies and configuration should be ok... I configured openhabian more than a year ago, almost about the time 2.3.2 came out, and that's when I last compiled mysgw, so I suspect I may not have documented some last minute change before it worked fine... I am noticing in https://www.mysensors.org/apidocs/group__RaspberryPiGateway.html that there are --my-rfm69-irq-pin and --my-rfm69-cs-pin I am not using, not sure if they are needed when the radio is connected in the suggested way, however I tried recompiling setting 24 for the cs-pin and 22 for the irq, but then when I run mysgw I see the exact same log... I am not sure what else to try, so asking here for suggestions?



  • Hi @frapell,

    does the network id (MY_RFM69_NETWORKID) used on the node and the gateway match? Also other communication parameters like MY_RFM69_MODEM_CONFIGURATION, for example.

    If, for example, your node has the following parameters...

    #define MY_RFM69_NETWORKID 123
    #define MY_RFM69_MODEM_CONFIGURATION RFM69_FSK_BR55_5_FD50
    

    ... you should pass the same parameters to the configure statement:

    --extra-cxxflags="-DMY_RFM69_NETWORKID=\(123\) -DMY_RFM69_MODEM_CONFIGURATION=RFM69_FSK_BR55_5_FD50"
    

    Also check if encryption settings match, if encryption is enabled.



  • @frapell
    I am having the same issue with Raspberry PI zero W, I get an awful range (less than 2 meters) with the default build values. It seems the default power setting for RFM69HCW are 5dB. Also, for RPI Zero W it seems the 3.3V pin supplies only 50mA and I have also added an extra 3.3V regulator (should not be the case for RPI3+).
    I have now compiled the gateway using the following and got a better range indoors:

    ./configure --my-transport=rfm69 --my-rfm69-frequency=915 --my-is-rfm69hcw --my-gateway=mqtt --my-controller-ip-address=192.168.1.41 --my-mqtt-publish-topic-prefix=mysensors-out --my-mqtt-subscribe-topic-prefix=mysensors-in --my-mqtt-client-id=mygateway1 --extra-cxxflags="-DMY_RFM69_MAX_POWER_LEVEL_DBM=20 -DMY_RFM69_TX_POWER_DBM=20 -DMY_DEBUG_VERBOSE_RFM69"
    

    Look for "LEVEL" in the logs to check that the power level is the correct one. I don't know how mysensors handles the power range (expected to see it increasing it by itself no answers, but I could not get it working otherwise).

    Maybe it helps.

    Best Regards,
    Costa


Log in to reply
 

Suggested Topics

  • 3
  • 6
  • 8
  • 1
  • 2

8
Online

11.4k
Users

11.1k
Topics

112.7k
Posts