Adafruit RFM69 Bonnet not working



  • I have an Adafruit RFM69 Bonnet attached to a Raspberry PI 0. The device works correctly with Adafruit's sample python code, but the mysgw.cpp Linux example from version 2.3.4 or the current development branch has the issues described below.

    Issues:

    • The sanity check would never succeed.
      DEBUG !RFM69:INIT:SANCHK FAIL
      One resolution I found:
      Comment out the code that prevented toggling the CS_PIN
    pi@raspberrypi0w-1:~/github/MySensors $ git diff --patch
    diff --git a/hal/transport/RFM69/driver/new/RFM69_new.cpp b/hal/transport/RFM69/driver/new/RFM69_new.cpp
    index cf4f0f02..f374f06d 100644
    --- a/hal/transport/RFM69/driver/new/RFM69_new.cpp
    +++ b/hal/transport/RFM69/driver/new/RFM69_new.cpp
    @@ -52,11 +52,11 @@ uint8_t RFM69_spi_txbuff[RFM69_MAX_PACKET_LEN + 1];
     
     LOCAL void RFM69_csn(const bool level)
     {
    -#if defined(__linux__)
    -       (void)level;
    -#else
    +//#if defined(__linux__)
    +//     (void)level;
    +//#else
            hwDigitalWrite(MY_RFM69_CS_PIN, level);
    -#endif
    +//#endif
     }
     
     LOCAL void RFM69_prepareSPITransaction(void)
    @@ -207,10 +207,10 @@ LOCAL bool RFM69_initialise(const uint32_t frequencyHz)
            RFM69.ATCtargetRSSI = RFM69_RSSItoInternal(MY_RFM69_ATC_TARGET_RSSI_DBM);
     
            // SPI init
    -#if !defined(__linux__)
    +//#if !defined(__linux__)
            hwDigitalWrite(MY_RFM69_CS_PIN, HIGH);
            hwPinMode(MY_RFM69_CS_PIN, OUTPUT);
    -#endif
    +//#endif
            RFM69_SPI.begin();
            (void)RFM69_setRadioMode(RFM69_RADIO_MODE_STDBY);
            // set configuration, encryption is disabled
    
    
    • Message send fails
    pi@raspberrypi0w-1:~/github/MySensors $ sudo bin/mysgw
    Feb 24 22:34:12 INFO  Starting gateway...
    Feb 24 22:34:12 INFO  Protocol version - 2.4.0-alpha
    Feb 24 22:34:12 DEBUG MCO:BGN:INIT GW,CP=RPNGL---,FQ=NA,REL=0,VER=2.4.0-alpha
    Feb 24 22:34:12 DEBUG TSF:LRT:OK
    Feb 24 22:34:12 DEBUG TSM:INIT
    Feb 24 22:34:12 DEBUG TSF:WUR:MS=0
    Feb 24 22:34:12 DEBUG RFM69:INIT
    Feb 24 22:34:12 DEBUG RFM69:INIT:PIN,CS=26,IQP=15,IQN=22,RST=22
    Feb 24 22:34:13 DEBUG RFM69:PTX:LEVEL=5 dBm
    Feb 24 22:34:13 DEBUG RFM69:DUMP:Registers Address | HEX value 
    Feb 24 22:34:13 DEBUG RFM69:DUMP:REG=0x01 Value=0x00
    Feb 24 22:34:13 DEBUG RFM69:DUMP:REG=0x02 Value=0x00
    Feb 24 22:34:13 DEBUG RFM69:DUMP:REG=0x03 Value=0x00
    Feb 24 22:34:13 DEBUG RFM69:DUMP:REG=0x04 Value=0x00
    Feb 24 22:34:13 DEBUG RFM69:DUMP:REG=0x05 Value=0x00
    Feb 24 22:34:13 DEBUG RFM69:DUMP:REG=0x06 Value=0x00
    Feb 24 22:34:13 DEBUG RFM69:DUMP:REG=0x07 Value=0x00
    Feb 24 22:34:13 DEBUG RFM69:DUMP:REG=0x08 Value=0x00
    Feb 24 22:34:13 DEBUG RFM69:DUMP:REG=0x09 Value=0x00
    Feb 24 22:34:13 DEBUG RFM69:DUMP:REG=0x0a Value=0x00
    Feb 24 22:34:13 DEBUG RFM69:DUMP:REG=0x0b Value=0x00
    Feb 24 22:34:13 DEBUG RFM69:DUMP:REG=0x0c Value=0x00
    Feb 24 22:34:13 DEBUG RFM69:DUMP:REG=0x0d Value=0x00
    Feb 24 22:34:13 DEBUG RFM69:DUMP:REG=0x0e Value=0x00
    Feb 24 22:34:13 DEBUG RFM69:DUMP:REG=0x0f Value=0x00
    Feb 24 22:34:13 DEBUG RFM69:DUMP:REG=0x10 Value=0x00
    Feb 24 22:34:13 DEBUG RFM69:DUMP:REG=0x11 Value=0x00
    Feb 24 22:34:13 DEBUG RFM69:DUMP:REG=0x12 Value=0x00
    Feb 24 22:34:13 DEBUG RFM69:DUMP:REG=0x13 Value=0x00
    Feb 24 22:34:13 DEBUG RFM69:DUMP:REG=0x14 Value=0x00
    Feb 24 22:34:13 DEBUG RFM69:DUMP:REG=0x15 Value=0x00
    Feb 24 22:34:13 DEBUG RFM69:DUMP:REG=0x16 Value=0x00
    Feb 24 22:34:13 DEBUG RFM69:DUMP:REG=0x17 Value=0x00
    Feb 24 22:34:13 DEBUG RFM69:DUMP:REG=0x18 Value=0x00
    Feb 24 22:34:13 DEBUG RFM69:DUMP:REG=0x19 Value=0x00
    Feb 24 22:34:13 DEBUG RFM69:DUMP:REG=0x1a Value=0x00
    Feb 24 22:34:13 DEBUG RFM69:DUMP:REG=0x1b Value=0x00
    Feb 24 22:34:13 DEBUG RFM69:DUMP:REG=0x1c Value=0x00
    Feb 24 22:34:13 DEBUG RFM69:DUMP:REG=0x1d Value=0x00
    Feb 24 22:34:13 DEBUG RFM69:DUMP:REG=0x1e Value=0x00
    Feb 24 22:34:13 DEBUG RFM69:DUMP:REG=0x1f Value=0x00
    Feb 24 22:34:13 DEBUG RFM69:DUMP:REG=0x20 Value=0x00
    Feb 24 22:34:13 DEBUG RFM69:DUMP:REG=0x21 Value=0x00
    Feb 24 22:34:13 DEBUG RFM69:DUMP:REG=0x22 Value=0x00
    Feb 24 22:34:13 DEBUG RFM69:DUMP:REG=0x23 Value=0x00
    Feb 24 22:34:13 DEBUG RFM69:DUMP:REG=0x24 Value=0x00
    Feb 24 22:34:13 DEBUG RFM69:DUMP:REG=0x25 Value=0x00
    Feb 24 22:34:13 DEBUG RFM69:DUMP:REG=0x26 Value=0x00
    Feb 24 22:34:13 DEBUG RFM69:DUMP:REG=0x27 Value=0x00
    Feb 24 22:34:13 DEBUG RFM69:DUMP:REG=0x28 Value=0x00
    Feb 24 22:34:13 DEBUG RFM69:DUMP:REG=0x29 Value=0x00
    Feb 24 22:34:13 DEBUG RFM69:DUMP:REG=0x2a Value=0x00
    Feb 24 22:34:13 DEBUG RFM69:DUMP:REG=0x2b Value=0x00
    Feb 24 22:34:13 DEBUG RFM69:DUMP:REG=0x2c Value=0x00
    Feb 24 22:34:13 DEBUG RFM69:DUMP:REG=0x2d Value=0x00
    Feb 24 22:34:13 DEBUG RFM69:DUMP:REG=0x2e Value=0x00
    Feb 24 22:34:13 DEBUG RFM69:DUMP:REG=0x2f Value=0x00
    Feb 24 22:34:13 DEBUG RFM69:DUMP:REG=0x30 Value=0x00
    Feb 24 22:34:13 DEBUG RFM69:DUMP:REG=0x31 Value=0x00
    Feb 24 22:34:13 DEBUG RFM69:DUMP:REG=0x32 Value=0x00
    Feb 24 22:34:13 DEBUG RFM69:DUMP:REG=0x33 Value=0x00
    Feb 24 22:34:13 DEBUG RFM69:DUMP:REG=0x34 Value=0x00
    Feb 24 22:34:13 DEBUG RFM69:DUMP:REG=0x35 Value=0x00
    Feb 24 22:34:13 DEBUG RFM69:DUMP:REG=0x36 Value=0x00
    Feb 24 22:34:13 DEBUG RFM69:DUMP:REG=0x37 Value=0x00
    Feb 24 22:34:13 DEBUG RFM69:DUMP:REG=0x38 Value=0x00
    Feb 24 22:34:13 DEBUG RFM69:DUMP:REG=0x39 Value=0x00
    Feb 24 22:34:13 DEBUG RFM69:DUMP:REG=0x3a Value=0x00
    Feb 24 22:34:13 DEBUG RFM69:DUMP:REG=0x3b Value=0x00
    Feb 24 22:34:13 DEBUG RFM69:DUMP:REG=0x3c Value=0x00
    Feb 24 22:34:13 DEBUG RFM69:DUMP:REG=0x3d Value=0x00
    Feb 24 22:34:13 DEBUG RFM69:DUMP:REG=0x3e Value=0x00
    Feb 24 22:34:13 DEBUG RFM69:DUMP:REG=0x3f Value=0x00
    Feb 24 22:34:13 DEBUG RFM69:DUMP:REG=0x40 Value=0x00
    Feb 24 22:34:13 DEBUG RFM69:DUMP:REG=0x41 Value=0x00
    Feb 24 22:34:13 DEBUG RFM69:DUMP:REG=0x42 Value=0x00
    Feb 24 22:34:13 DEBUG RFM69:DUMP:REG=0x43 Value=0x00
    Feb 24 22:34:13 DEBUG RFM69:DUMP:REG=0x44 Value=0x00
    Feb 24 22:34:13 DEBUG RFM69:DUMP:REG=0x45 Value=0x00
    Feb 24 22:34:13 DEBUG RFM69:DUMP:REG=0x46 Value=0x00
    Feb 24 22:34:13 DEBUG RFM69:DUMP:REG=0x47 Value=0x00
    Feb 24 22:34:13 DEBUG RFM69:DUMP:REG=0x48 Value=0x00
    Feb 24 22:34:13 DEBUG RFM69:DUMP:REG=0x49 Value=0x00
    Feb 24 22:34:13 DEBUG RFM69:DUMP:REG=0x4a Value=0x00
    Feb 24 22:34:13 DEBUG RFM69:DUMP:REG=0x4b Value=0x00
    Feb 24 22:34:13 DEBUG RFM69:DUMP:REG=0x4c Value=0x00
    Feb 24 22:34:13 DEBUG RFM69:DUMP:REG=0x4d Value=0x00
    Feb 24 22:34:13 DEBUG RFM69:DUMP:REG=0x4e Value=0x00
    Feb 24 22:34:13 DEBUG RFM69:DUMP:REG=0x4f Value=0x00
    Feb 24 22:34:13 DEBUG !RFM69:INIT:SANCHK FAIL
    Feb 24 22:34:13 DEBUG !TSM:INIT:TSP FAIL
    Feb 24 22:34:13 DEBUG TSM:FAIL:CNT=1
    Feb 24 22:34:13 DEBUG TSM:FAIL:DIS
    Feb 24 22:34:13 DEBUG TSF:TDI:TSL
    Feb 24 22:34:13 DEBUG RFM69:RSL
    Feb 24 22:34:23 DEBUG TSM:FAIL:RE-INIT
    Feb 24 22:34:23 DEBUG TSM:INIT
    Feb 24 22:34:23 DEBUG RFM69:INIT
    Feb 24 22:34:23 DEBUG RFM69:INIT:PIN,CS=26,IQP=15,IQN=22,RST=22
    Feb 24 22:34:23 DEBUG RFM69:PTX:LEVEL=5 dBm
    Feb 24 22:34:23 DEBUG RFM69:DUMP:Registers Address | HEX value 
    Feb 24 22:34:23 DEBUG RFM69:DUMP:REG=0x01 Value=0x04
    Feb 24 22:34:23 DEBUG RFM69:DUMP:REG=0x02 Value=0x00
    Feb 24 22:34:23 DEBUG RFM69:DUMP:REG=0x03 Value=0x02
    Feb 24 22:34:23 DEBUG RFM69:DUMP:REG=0x04 Value=0x40
    Feb 24 22:34:23 DEBUG RFM69:DUMP:REG=0x05 Value=0x03
    Feb 24 22:34:23 DEBUG RFM69:DUMP:REG=0x06 Value=0x33
    Feb 24 22:34:23 DEBUG RFM69:DUMP:REG=0x07 Value=0xd9
    Feb 24 22:34:23 DEBUG RFM69:DUMP:REG=0x08 Value=0x00
    Feb 24 22:34:23 DEBUG RFM69:DUMP:REG=0x09 Value=0x00
    Feb 24 22:34:23 DEBUG RFM69:DUMP:REG=0x0a Value=0x41
    Feb 24 22:34:23 DEBUG RFM69:DUMP:REG=0x0b Value=0x40
    Feb 24 22:34:23 DEBUG RFM69:DUMP:REG=0x0c Value=0x02
    Feb 24 22:34:23 DEBUG RFM69:DUMP:REG=0x0d Value=0x92
    Feb 24 22:34:23 DEBUG RFM69:DUMP:REG=0x0e Value=0xf5
    Feb 24 22:34:23 DEBUG RFM69:DUMP:REG=0x0f Value=0x20
    Feb 24 22:34:23 DEBUG RFM69:DUMP:REG=0x10 Value=0x24
    Feb 24 22:34:23 DEBUG RFM69:DUMP:REG=0x11 Value=0x97
    Feb 24 22:34:23 DEBUG RFM69:DUMP:REG=0x12 Value=0x09
    Feb 24 22:34:23 DEBUG RFM69:DUMP:REG=0x13 Value=0x1a
    Feb 24 22:34:23 DEBUG RFM69:DUMP:REG=0x14 Value=0x40
    Feb 24 22:34:23 DEBUG RFM69:DUMP:REG=0x15 Value=0xb0
    Feb 24 22:34:23 DEBUG RFM69:DUMP:REG=0x16 Value=0x7b
    Feb 24 22:34:23 DEBUG RFM69:DUMP:REG=0x17 Value=0x9b
    Feb 24 22:34:23 DEBUG RFM69:DUMP:REG=0x18 Value=0x88
    Feb 24 22:34:23 DEBUG RFM69:DUMP:REG=0x19 Value=0xe2
    Feb 24 22:34:23 DEBUG RFM69:DUMP:REG=0x1a Value=0xe2
    Feb 24 22:34:23 DEBUG RFM69:DUMP:REG=0x1b Value=0x40
    Feb 24 22:34:23 DEBUG RFM69:DUMP:REG=0x1c Value=0x80
    Feb 24 22:34:23 DEBUG RFM69:DUMP:REG=0x1d Value=0x06
    Feb 24 22:34:23 DEBUG RFM69:DUMP:REG=0x1e Value=0x10
    Feb 24 22:34:23 DEBUG RFM69:DUMP:REG=0x1f Value=0x00
    Feb 24 22:34:23 DEBUG RFM69:DUMP:REG=0x20 Value=0x00
    Feb 24 22:34:23 DEBUG RFM69:DUMP:REG=0x21 Value=0x00
    Feb 24 22:34:23 DEBUG RFM69:DUMP:REG=0x22 Value=0x00
    Feb 24 22:34:23 DEBUG RFM69:DUMP:REG=0x23 Value=0x02
    Feb 24 22:34:23 DEBUG RFM69:DUMP:REG=0x24 Value=0xff
    Feb 24 22:34:23 DEBUG RFM69:DUMP:REG=0x25 Value=0x00
    Feb 24 22:34:23 DEBUG RFM69:DUMP:REG=0x26 Value=0x07
    Feb 24 22:34:23 DEBUG RFM69:DUMP:REG=0x27 Value=0x80
    Feb 24 22:34:23 DEBUG RFM69:DUMP:REG=0x28 Value=0x00
    Feb 24 22:34:23 DEBUG RFM69:DUMP:REG=0x29 Value=0xe4
    Feb 24 22:34:23 DEBUG RFM69:DUMP:REG=0x2a Value=0x00
    Feb 24 22:34:23 DEBUG RFM69:DUMP:REG=0x2b Value=0x00
    Feb 24 22:34:23 DEBUG RFM69:DUMP:REG=0x2c Value=0x00
    Feb 24 22:34:23 DEBUG RFM69:DUMP:REG=0x2d Value=0x03
    Feb 24 22:34:23 DEBUG RFM69:DUMP:REG=0x2e Value=0x88
    Feb 24 22:34:23 DEBUG RFM69:DUMP:REG=0x2f Value=0x2d
    Feb 24 22:34:23 DEBUG RFM69:DUMP:REG=0x30 Value=0x64
    Feb 24 22:34:23 DEBUG RFM69:DUMP:REG=0x31 Value=0x00
    Feb 24 22:34:23 DEBUG RFM69:DUMP:REG=0x32 Value=0x00
    Feb 24 22:34:23 DEBUG RFM69:DUMP:REG=0x33 Value=0x00
    Feb 24 22:34:23 DEBUG RFM69:DUMP:REG=0x34 Value=0x00
    Feb 24 22:34:23 DEBUG RFM69:DUMP:REG=0x35 Value=0x00
    Feb 24 22:34:23 DEBUG RFM69:DUMP:REG=0x36 Value=0x00
    Feb 24 22:34:23 DEBUG RFM69:DUMP:REG=0x37 Value=0xd4
    Feb 24 22:34:23 DEBUG RFM69:DUMP:REG=0x38 Value=0x40
    Feb 24 22:34:23 DEBUG RFM69:DUMP:REG=0x39 Value=0xff
    Feb 24 22:34:23 DEBUG RFM69:DUMP:REG=0x3a Value=0xff
    Feb 24 22:34:23 DEBUG RFM69:DUMP:REG=0x3b Value=0x00
    Feb 24 22:34:23 DEBUG RFM69:DUMP:REG=0x3c Value=0x05
    Feb 24 22:34:23 DEBUG RFM69:DUMP:REG=0x3d Value=0x10
    Feb 24 22:34:23 DEBUG RFM69:DUMP:REG=0x3e Value=0x00
    Feb 24 22:34:23 DEBUG RFM69:DUMP:REG=0x3f Value=0x00
    Feb 24 22:34:23 DEBUG RFM69:DUMP:REG=0x40 Value=0x00
    Feb 24 22:34:23 DEBUG RFM69:DUMP:REG=0x41 Value=0x00
    Feb 24 22:34:23 DEBUG RFM69:DUMP:REG=0x42 Value=0x00
    Feb 24 22:34:23 DEBUG RFM69:DUMP:REG=0x43 Value=0x00
    Feb 24 22:34:23 DEBUG RFM69:DUMP:REG=0x44 Value=0x00
    Feb 24 22:34:23 DEBUG RFM69:DUMP:REG=0x45 Value=0x00
    Feb 24 22:34:23 DEBUG RFM69:DUMP:REG=0x46 Value=0x00
    Feb 24 22:34:23 DEBUG RFM69:DUMP:REG=0x47 Value=0x00
    Feb 24 22:34:23 DEBUG RFM69:DUMP:REG=0x48 Value=0x00
    Feb 24 22:34:23 DEBUG RFM69:DUMP:REG=0x49 Value=0x00
    Feb 24 22:34:23 DEBUG RFM69:DUMP:REG=0x4a Value=0x00
    Feb 24 22:34:23 DEBUG RFM69:DUMP:REG=0x4b Value=0x00
    Feb 24 22:34:23 DEBUG RFM69:DUMP:REG=0x4c Value=0x00
    Feb 24 22:34:23 DEBUG RFM69:DUMP:REG=0x4d Value=0x00
    Feb 24 22:34:23 DEBUG RFM69:DUMP:REG=0x4e Value=0x01
    Feb 24 22:34:23 DEBUG RFM69:DUMP:REG=0x4f Value=0x00
    Feb 24 22:34:23 DEBUG TSM:INIT:TSP OK
    Feb 24 22:34:23 DEBUG TSM:INIT:GW MODE
    Feb 24 22:34:23 DEBUG TSM:READY:ID=0,PAR=0,DIS=0
    Feb 24 22:34:23 DEBUG MCO:REG:NOT NEEDED
    Feb 24 22:34:23 DEBUG MCO:BGN:STP
    Feb 24 22:34:23 DEBUG MCO:BGN:INIT OK,TSP=1
    Feb 24 22:34:23 DEBUG GWT:RMQ:CONNECTING...
    Feb 24 22:34:23 DEBUG connected to 127.0.0.1
    Feb 24 22:34:23 DEBUG GWT:RMQ:OK
    Feb 24 22:34:23 DEBUG GWT:TPS:TOPIC=mygateway1-out/0/255/0/0/18,MSG SENT
    Feb 24 22:34:23 DEBUG TSM:READY:NWD REQ
    Feb 24 22:34:23 DEBUG RFM69:SWR:SEND,TO=255,SEQ=0,RETRY=0
    Feb 24 22:34:23 DEBUG RFM69:CSMA:RSSI=-106
    Feb 24 22:34:23 DEBUG ?TSF:MSG:SEND,0-0-255-255,s=255,c=3,t=20,pt=0,l=0,sg=0,ft=0,st=OK:
    
    4249676 TSM:FAIL:RE-INIT
    4249676 TSM:INIT
    4250933 THA:INIT
    4250933 RFM69:INIT
    4250938 RFM69:INIT:PIN,CS=10,IQP=6,IQN=6,RST=11
    4250939 RFM69:PTX:LEVEL=5 dBm
    4250940 TSM:INIT:TSP OK
    4250940 !TSF:SID:FAIL,ID=0
    4250940 TSM:FAIL:CNT=7
    4250940 TSM:FAIL:DIS
    4250940 TSF:TDI:TSL
    4250940 RFM69:RSL
    

    Below is the how mysgw was build

    ./configure --mi-is-rfm69hw --my-transport=rfm69 --my-gateway=mqtt --my-controller-ip-address=127.0.0.1 --my-rfm69-cs-pin=26 --my-rfm69-irq-pin=15 --extra-cxxflags="-DMY_DEBUG_VERBOSE_RFM69 -DMY_DEBUG_VERBOSE_RFM69_REGISTERS -DMY_RFM69_RST_PIN=22" --my-debug=enable
    

    Any help is appreciated.


  • Mod

    Welcome to the forum @paulsp

    The log parser can help understanding the log output.

    Your node fails to initialize because it thinks it has been assigned node id 0 (which is reserved for the gateway). Run the MySensors cleareeprom sketch and then upload your existing sketch again.



  • @mfalkvidd Running the cleareeprom sketch on the M0 Express did not work.

    1385 MCO:BGN:INIT NODE,CP=RPNNS---,FQ=48,REL=255,VER=2.3.2
    6370 TSM:INIT
    8022 TSF:WUR:MS=0
    8022 THA:INIT
    8022 RFM69:INIT
    8027 RFM69:INIT:PIN,CS=10,IQP=6,IQN=6,RST=11
    8029 RFM69:PTX:LEVEL=5 dBm
    8029 TSM:INIT:TSP OK
    8029 !TSF:SID:FAIL,ID=0
    8029 TSM:FAIL:CNT=1
    8029 TSM:FAIL:DIS
    8029 TSF:TDI:TSL
    8029 RFM69:RSL
    18030 TSM:FAIL:RE-INIT
    18030 TSM:INIT
    19367 THA:INIT
    19367 RFM69:INIT
    19372 RFM69:INIT:PIN,CS=10,IQP=6,IQN=6,RST=11
    19373 RFM69:PTX:LEVEL=5 dBm
    19373 TSM:INIT:TSP OK
    19373 !TSF:SID:FAIL,ID=0
    19374 TSM:FAIL:CNT=2
    19374 TSM:FAIL:DIS
    19374 TSF:TDI:TSL
    19374 RFM69:RSL
    29375 TSM:FAIL:RE-INIT
    

    How can I determine the gateway running the PI is receiving a request from the M0 and then replying to the M0?


  • Mod

    @paulsp said in Adafruit RFM69 Bonnet not working:

    How can I determine the gateway running the PI is receiving a request from the M0 and then replying to the M0?

    As long as the M0 thinks it has Id 0, it will not communicate.

    Could you post the sketch for the M0?

    If the MySensors cleareeprom sketch did not work, it seems like the eeprom in the M0 is broken. Could you share the output from the MySensors cleareeprom run? It should look like this:

    Started clearing. Please wait...
    Clearing done.
    


  • Below is the atc_signalsreport sketch modified to support the pin number and Serial configuration of the M0. I also include the ClearEepromConfig sketch modified to display the value of EEPROM_LOCAL_CONFIG_ADDRESS
    Output of the sketch

    Started clearing. Please wait...
    413
    Clearing done.
    

    Modified atc_signalsreport sketch

    /*
     * The MySensors Arduino library handles the wireless radio link and protocol
     * between your home built sensors/actuators and HA controller of choice.
     * The sensors forms a self healing radio network with optional repeaters. Each
     * repeater and gateway builds a routing tables in EEPROM which keeps track of the
     * network topology allowing messages to be routed to nodes.
     *
     * Created by Henrik Ekblad <henrik.ekblad@mysensors.org>
     * Copyright (C) 2013-2019 Sensnology AB
     * Full contributor list: https://github.com/mysensors/MySensors/graphs/contributors
     *
     * Documentation: http://www.mysensors.org
     * Support Forum: http://forum.mysensors.org
     *
     * This program is free software; you can redistribute it and/or
     * modify it under the terms of the GNU General Public License
     * version 2 as published by the Free Software Foundation.
     *
     *******************************
     *
     * REVISION HISTORY
     * Version 1.0 - tekka
     *
     * DESCRIPTION
     * ATC mode settings and signal report functions, on RFM69 and RFM95 nodes
     *
     */
    #define MY_SERIALDEVICE Serial
    
    // Enable debug prints
    #define MY_DEBUG
    #define MY_DEBUG_VERBOSE_TRANSPORT
    #define MY_DEBUG_VERBOSE_TRANSPORT_HAL
    #define MY_DEBUG_VERBOSE_RFM69
    
    // Enable and select radio type attached
    
    // RFM69
    #define MY_RADIO_RFM69
    #define MY_RFM69_NEW_DRIVER   // ATC on RFM69 works only with the new driver (not compatible with old=default driver)
    #define MY_RFM69_ATC_TARGET_RSSI_DBM (-70)  // target RSSI -70dBm
    #define MY_RFM69_MAX_POWER_LEVEL_DBM (10)   // max. TX power 10dBm = 10mW
    #define MY_RFM69_CS_PIN 10
    #define MY_RFM69_IRQ_PIN 6
    #define MY_RFM69_RST_PIN 11
    
    // RFM95
    //#define MY_RADIO_RFM95
    //#define MY_RFM95_ATC_TARGET_RSSI_DBM (-70)  // target RSSI -70dBm
    //#define MY_RFM95_MAX_POWER_LEVEL_DBM (10)   // max. TX power 10dBm = 10mW
    
    #include <MySensors.h>
    
    // ID of the sensor child
    #define CHILD_ID_UPLINK_QUALITY (0)
    #define CHILD_ID_TX_LEVEL       (1)
    #define CHILD_ID_TX_PERCENT     (2)
    #define CHILD_ID_TX_RSSI        (3)
    #define CHILD_ID_RX_RSSI        (4)
    #define CHILD_ID_TX_SNR         (5)
    #define CHILD_ID_RX_SNR         (6)
    
    
    // Initialize general message
    MyMessage msgTxRSSI(CHILD_ID_TX_RSSI, V_CUSTOM);
    MyMessage msgRxRSSI(CHILD_ID_RX_RSSI, V_CUSTOM);
    MyMessage msgTxSNR(CHILD_ID_TX_SNR, V_CUSTOM);
    MyMessage msgRxSNR(CHILD_ID_RX_SNR, V_CUSTOM);
    MyMessage msgTxLevel(CHILD_ID_TX_LEVEL, V_CUSTOM);
    MyMessage msgTxPercent(CHILD_ID_TX_PERCENT, V_CUSTOM);
    MyMessage msgUplinkQuality(CHILD_ID_UPLINK_QUALITY, V_CUSTOM);
    
    void setup()
    {
    }
    
    
    void presentation()
    {
      // Send the sketch version information to the gateway and controller
      sendSketchInfo("ATC", "1.0");
    
      // Register all sensors to gw (they will be created as child devices)
      present(CHILD_ID_UPLINK_QUALITY, S_CUSTOM, "UPLINK QUALITY RSSI");
      present(CHILD_ID_TX_LEVEL, S_CUSTOM, "TX LEVEL DBM");
      present(CHILD_ID_TX_PERCENT, S_CUSTOM, "TX LEVEL PERCENT");
      present(CHILD_ID_TX_RSSI, S_CUSTOM, "TX RSSI");
      present(CHILD_ID_RX_RSSI, S_CUSTOM, "RX RSSI");
      present(CHILD_ID_TX_SNR, S_CUSTOM, "TX SNR");
      present(CHILD_ID_RX_SNR, S_CUSTOM, "RX SNR");
    }
    
    void loop()
    {
      // send messages to GW
      send(msgUplinkQuality.set(transportGetSignalReport(SR_UPLINK_QUALITY)));
      send(msgTxLevel.set(transportGetSignalReport(SR_TX_POWER_LEVEL)));
      send(msgTxPercent.set(transportGetSignalReport(SR_TX_POWER_PERCENT)));
      // retrieve RSSI / SNR reports from incoming ACK
      send(msgTxRSSI.set(transportGetSignalReport(SR_TX_RSSI)));
      send(msgRxRSSI.set(transportGetSignalReport(SR_RX_RSSI)));
      send(msgTxSNR.set(transportGetSignalReport(SR_TX_SNR)));
      send(msgRxSNR.set(transportGetSignalReport(SR_RX_SNR)));
      // wait a bit
      wait(5000);
    }
    

    ClearEepromConfig sketch

    /*
     * The MySensors Arduino library handles the wireless radio link and protocol
     * between your home built sensors/actuators and HA controller of choice.
     * The sensors forms a self healing radio network with optional repeaters. Each
     * repeater and gateway builds a routing tables in EEPROM which keeps track of the
     * network topology allowing messages to be routed to nodes.
     *
     * Created by Henrik Ekblad <henrik.ekblad@mysensors.org>
     * Copyright (C) 2013-2019 Sensnology AB
     * Full contributor list: https://github.com/mysensors/MySensors/graphs/contributors
     *
     * Documentation: http://www.mysensors.org
     * Support Forum: http://forum.mysensors.org
     *
     * This program is free software; you can redistribute it and/or
     * modify it under the terms of the GNU General Public License
     * version 2 as published by the Free Software Foundation.
     *
     *******************************
     *
     * DESCRIPTION
     *
     * This sketch clears radioId, relayId and other routing information in EEPROM back to factory default
     *
     */
    // load core modules only
    #define MY_CORE_ONLY
    #define MY_SERIALDEVICE Serial
    
    #include <MySensors.h>
    
    void setup()
    {
    	Serial.begin(MY_BAUD_RATE);
    	Serial.println("Started clearing. Please wait...");
      Serial.println(EEPROM_LOCAL_CONFIG_ADDRESS);
    	for (uint16_t i=0; i<EEPROM_LOCAL_CONFIG_ADDRESS; i++) {
    		hwWriteConfig(i,0xFF);
    	}
    	Serial.println("Clearing done.");
    }
    
    void loop()
    {
    	// Nothing to do here...
    }
    

  • Mod

    Thanks @paulsp. I am out of ideas unfortunately. I can't understand why the M0 thinks it has node id 0.



  • @mfalkvidd How can I hard code and ID for the device and the Gateway ID?


  • Mod

    @paulsp gateway ID is always 0. It can not be changed.

    To set an ID for the M0, add

    #define MY_NODE_ID (42)
    

    to the sketch, before including MySensors.h. Change 42 to whatever node ID you want to use (1-254).

    https://www.mysensors.org/apidocs/group__RoutingNodeSettingGrpPub.html#gac677233da7f20bbf93cb479471e3234e



  • @paulsp I'm trying to get a Raspberry Pi gateway working as well. Also with a Bonnet but I don't think that is particularly pertinent as the bonnet doesn't do much other than connecting the RFM69 to a bunch of GPIO.
    Have you been able to get the Pi gateway working? Before I spend more time troubleshooting my own setup here and hack away further at the RFM69_new.cpp code it would be good to know whether I'm wasting my time, doing something stupid or not. If you got it working with only the changes you mention then that means I'm doing something wrong. Thank you!



  • I too would like to know if you every got this working. I would like to set up the one I have as a gateway as well. I am wanting to log pool temp and PSI data to a database.



  • @556duckvader I did not get the bonnet working through the mysensor library. I ended up using the Adafruit python client library and posting data to MQTT as a workaround.



  • paulsp........Any chance of getting a copy of your code you used? I really only want the nodes to send data to a pi zero, and the zero to send an mqtt message. I plan on doing everything else in node red and home assistant. Is that similar to your setup. Thanks!



  • I'm usually loathe to post to an ancient topic, but since this post is near the top of search results for "adafruit rfm69 bonnet mysensors" I thought this would be the best place to post the solution to the OP's problem.

    By doing the following, you should be able to get an Adafruit RFM69 Bonnet on a Raspberry Pi Zero talking to your other RFM69-based MySensors nodes:

    1. I started by checking out the head of the development branch (specifically commit aa76d26615, which was the head at the time, but hopefully future versions will work too).
    2. I commented out the code that prevented toggling the CS_PIN as @paulsp described in post #1
    3. I then built mysgw on my Rasperry Pi (happened to be a Pi Zero, but hopefully that's irrelevant) using the following command:
    ./configure --my-transport=rfm69 --my-rfm69-frequency=915 --my-is-rfm69hw --my-gateway=ethernet --my-port=5003 --my-rfm69-cs-pin=26 --my-rfm69-irq-pin=15 --extra-cxxflags="-DMY_RFM69_RST_PIN=22" --spi-spidev-device=/dev/spidev0.1 --spi-driver=SPIDEV
    

    With this configuration, I was able to successfully get my RPi-based gateway using an Adafruit RFM69 radio bonnet talking to (and receiving from) various Moteino-based MySensors RFM69 nodes. I think the key difference was that I had to tell the MySensors gateway to use the spidev driver with the --spi-spidev-device=/dev/spidev0.1 --spi-driver=SPIDEV flags (instead of the BCM driver, which is the default).

    Obviously if you're using a different frequency for your RFM69 radio (or a different gateway type or port) you should adjust the --my-rfm69-frequency=915 --my-gateway=ethernet --my-port=5003 flags appropriately.



  • @FlyingSaucrDude

    What great timing (for me anyway), only this week I purchased the Adafruit RFM95 Bonnet version, and this thread is the only thing returned in a quick search. Your solution works for RFM95 also.

    I didn't need to comment out the code that prevented toggling the CS_PIN, but I'm using the development version as the main branch dose not seem to build on Pi OS Bullseye.

    ./configure --my-transport=rfm95 --my-rfm95-frequency=868 --my-gateway=ethernet --my-port=5003 --my-rfm95-cs-pin=26 --my-rfm95-irq-pin=15 --extra-cxxflags="-DMY_RFM95_RST_PIN=22" --spi-spidev-device=/dev/spidev0.1 --spi-driver=SPIDEV
    

    Thanks to your post I got this working in a few min of trying, would have taken me much longer otherwise, so thank you for posting to an ancient thread.


Log in to reply
 

Suggested Topics

  • 3
  • 6
  • 1
  • 2
  • 5

0
Online

11.4k
Users

11.1k
Topics

112.7k
Posts