rfm69 gateway freezing on rpi 4
-
Hi,
I am using the development branch of mysensors because I'd like to run the gateway on a raspberry pi 4.
The node I have is an arduino pro mini (3v) on an easypcb connected to an rfm69HW chip (868mhz).
The gateway is a mqtt gateway and the controller is Home Assitant, but I decided to hand out node IDs manually (don't know if that's important.
It takes the node some time to connect to the gateway ( Around 10-20 sec, is that normal?) and after running for a few minutes the gateway just freezes, judging from the log output.
Gateway output and node output have been uploaded to pastebin since the forum complained about their size.
Gateway: https://pastebin.com/7wy9mLGe
Node: https://pastebin.com/jPME3gMHHere is the sketch I used:
/* * 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 * */ // Enable debug prints #define MY_DEBUG #define MY_SIGNAL_REPORT_ENABLED #define MY_NODE_ID 1 // 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_IS_RFM69HW #define MY_RFM69_ATC_TARGET_RSSI_DBM (-70) // target RSSI -70dBm #define MY_RFM69_MAX_POWER_LEVEL_DBM (10) // max. TX power 10dBm = 10mW // 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(transportInternalToRSSI(_transportSM.uplinkQualityRSSI))); send(msgTxLevel.set(transportGetTxPowerLevel())); send(msgTxPercent.set(transportGetTxPowerPercent())); // retrieve RSSI / SNR reports from incoming ACK send(msgTxRSSI.set(transportGetSendingRSSI())); send(msgRxRSSI.set(transportGetReceivingRSSI())); send(msgTxSNR.set(transportGetSendingSNR())); send(msgRxSNR.set(transportGetReceivingSNR())); //to serial Serial.print("transportInternalToRSSI(_transportSM.uplinkQualityRSSI): "); Serial.println(transportInternalToRSSI(_transportSM.uplinkQualityRSSI)); Serial.print("transportGetTxPowerLevel(): "); Serial.println(transportGetTxPowerLevel()); Serial.print("transportGetTxPowerPercent(): "); Serial.println(transportGetTxPowerPercent()); Serial.print("transportGetSendingRSSI(): "); Serial.println(transportGetSendingRSSI()); Serial.print("transportGetReceivingRSSI(): "); Serial.println(transportGetReceivingRSSI()); Serial.print("transportGetSendingSNR(): "); Serial.println(transportGetSendingSNR()); Serial.print("transportGetReceivingSNR(): "); Serial.println(transportGetReceivingSNR()); Serial.println("Waiting"); // wait a bit wait(5000); }
This is how I configured the gateway:
./configure --my-transport=rfm69 --my-rfm69-frequency=868 --my-gateway=mqtt --my-is-rfm69hw --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=mysensorsgateway1 --my-mqtt-user=mysensors --my-mqtt-password=redacted --my-port=1883
Did I configure the gateway incorrectly?
And can somebody let me know whether these RSSI values say that the connection is good? The node is 3m from the raspberry pi. GetSendingRSSI should be higher, right? Around 70, since that is defined in the beginning of the sketch if I am not mistaken.
The timezone on the gateway is one hour behind, I just noticed that.
Thanks for any help!
-
I think this was solved by soldering a wire to the reset pin of the rfm69 and pin 29 of the raspberry pi and reconfiguring the gateway with
--extra-cxxflags="-DMY_RFM69_RST_PIN=29"
Now the connection is instant (before it was about 10-20 seconds IF it worked at all.
But since this is my first gig with electronics it might just be that I had a bad connection and moving the wires around fixed it....
-
I'm not sure about the RPi4, but for other raspberry pi's you need to use the new RFM69 driver, #define MY_RFM69_NEW_DRIVER. You must compile both your nodes and gateway with the new driver.
-
@jaylove oh, I didn't know I had to compile the gateway with it. I'll give it a try. Thanks!
-
@kiesel the Pi gateway only supports the new driver. There is no way to compile it for the old driver.