@mfalkvidd Yes you are correct. The point was that digitalPinToInterrupt(MY_RFM95_IRQ_PIN) makes everything works on the D1. Leaving digitalPinToInterrupt() out will break the gateway.
Posts made by VonJoost
-
RE: [SOLVED] RFM95 Node with gateway no parents found (But looks like messages are being sent)
-
RE: [SOLVED] RFM95 Node with gateway no parents found (But looks like messages are being sent)
@mfalkvidd It was code from my ESP RFM69 gateway. Runs on NodeMCUV3. But that works perfect. But I may reflash that one with the good define code.
But the example in your link seems wrong.
#define MY_RFM95_IRQ_PIN DEFAULT_RFM95_IRQ_PIN
Should be
#define MY_RFM95_IRQ_NUM digitalPinToInterrupt(MY_RFM95_IRQ_PIN)
To make it working on an ESP8266 Wemos D1 Mini with RFM95 radio.
-
RE: [SOLVED] RFM95 Node with gateway no parents found (But looks like messages are being sent)
@electrik OMG, this was a quick fix! It runs very good.
Thank you all for the help als reading. Very nice!
-
[SOLVED] RFM95 Node with gateway no parents found (But looks like messages are being sent)
Hello MySensor Friends!
I got myself a new challange. Wiring up an RFM95 gateway so I can reflash my buggy LORA Soil Sensors with RFM95 radio's and put it to work in my trusty MySensors environment.
Everything is being built with the latest Mysensor branch (2.3.2).
Gateway Sketch is straight forward, just like the Node sketch.
Now what is the problem. The Node sends out a parent request (PARENT_REQUEST) The gateway even responds to this request (To Node ID). But the node is not getting that message at all. It looks like there is one way traffic. Or None.
What did I do?
On the gateway I enabled the following options (extra)
#define MY_RADIO_RFM95 #define MY_RFM95_FREQUENCY (RFM95_868MHZ) #define MY_RFM95_MODEM_CONFIGRUATION RFM95_BW125CR45SF128 #define MY_RFM95_ATC_MODE_DISABLED #define MY_RFM95_TX_POWER_DBM (13) #define MY_TRANSPORT_STATE_TIMEOUT_MS (3*1000ul) #define RFM95_RETRY_TIMEOUT_MS (5000ul) #define MY_DEBUG_VERBOSE_RFM95
And on the node I did the following
#define MY_RFM95_MODEM_CONFIGRUATION RFM95_BW125CR45SF128 #define MY_TRANSPORT_STATE_TIMEOUT_MS (3*1000ul) #define RFM95_RETRY_TIMEOUT_MS (5000ul) #define MY_DEBUG_VERBOSE_RFM95
If I collect al the different logs and put them in the Log Parser I can see that the Node request is recieved by the gateway. The gateway then send a response. But the node is not getting it.
I'm out of ideas. Moved the node arround the house. Looked at the schematics.
It is a busy spectrum here at 868mhz. I still have an RFM69 mysensors gateway, a lora gateway and Z-Wave all fighting over 868mhz.The stuff I'm using
Gateway:
A Wemos D1 Mini with an RFM Shield from Diycon (https://diycon.nl/product/d1-rfm-shield-pcb301-for-rfm-and-wemos-d1/) I soldered an extra 10 uF capacitator on the shield for stable 3.3 voltsNode
A Makerfab soil sensor with RFM95 radio (v2) (https://www.makerfabs.com/lora-soil-moisture-sensor-v2.html)If anybode has an idea. Please let me know.
Complete Sketches:
Node
#include <Arduino.h> #include <AHT10.h> #define MY_DEBUG //Batterij const int BatHighValue = 3050; //you need to replace this value with Value_1 const int BatLowValue = 2650; //you need to replace this value with Value_2 int batterypercent=0; int batterypercentage=0; // sensors pin mapping int sensorPin = A2; // select the input pin for the potentiometer int sensorPowerCtrlPin = 5; // select control pin for switching VCC (sensors) uint8_t readStatus = 0; AHT10 myAHT10(AHT10_ADDRESS_0X38); // Enable and select radio type attached #define MY_RADIO_RFM95 #define MY_RFM95_FREQUENCY (RFM95_868MHZ) #define MY_RFM95_IRQ_PIN 2 #define MY_RFM95_CS_PIN 10 #define MY_RFM95_RST_PIN 4 #define MY_RFM95_IRQ_NUM MY_RFM95_IRQ_PIN #define MY_RFM95_MODEM_CONFIGRUATION RFM95_BW125CR45SF128 #define MY_TRANSPORT_STATE_TIMEOUT_MS (3*1000ul) #define RFM95_RETRY_TIMEOUT_MS (5000ul) #define MY_DEBUG_VERBOSE_RFM95 #define MY_SOFT_SPI_SCK_PIN 13 #define MY_SOFT_SPI_MISO_PIN 12 #define MY_SOFT_SPI_MOSI_PIN 11 // AANPASSEN ANDERS DIKKE PROBLEMEN!! #define MY_NODE_ID 100 //#define MY_PARENT_NODE_ID 0 //#define MY_PARENT_NODE_IS_STATIC #define MY_BAUD_RATE 115200 #define MY_SPLASH_SCREEN_DISABLED //Spaart 120 bytes uit #define MY_SMART_SLEEP_WAIT_DURATION_MS 120000 #include <MySensors.h> #define TEMP_CHILD 1 #define HUM_CHILD 2 #define SOIL_CHILD 3 MyMessage tempMsg(TEMP_CHILD, V_TEMP); MyMessage humMsg(HUM_CHILD, V_HUM); MyMessage soilMsg(SOIL_CHILD, V_LEVEL); float lastSoil = -1; float lastHum = -1; float lastTemp = -1; uint32_t SLEEP_TIME = 900000; // sleep time between reads (seconds * 1000 milliseconds) int oldbatterypercentage = 0; float temperature=0.0; //temperature float humidity=0.0; //humidity int soilmoisturepercent=0; //spoil moisture humidity int AirValue = 850; //capacitive sensor in the value (maximum value) int WaterValue = 520; //capacitive sensor in water value (minimum value) int sensorValue = 0; //capacitive sensor int x = 0; // switch VCC on (sensors on) void sensorPowerOn(void) { digitalWrite(sensorPowerCtrlPin, HIGH);//Sensor power on } // switch VCC off (sensor off) void sensorPowerOff(void) { digitalWrite(sensorPowerCtrlPin, LOW);//Sensor power on } void setup() { #if defined(__AVR_ATmega2560__) analogReference(INTERNAL1V1); #else analogReference(INTERNAL); #endif /* AHT10 connection check */ while (myAHT10.begin() != true) { Serial.print("AHT10 not connected or fail to load calibration coefficient"); delay(5000); } } void presentation() { sendSketchInfo("Soilsensor01", "HNSSV2-1.0"); present(TEMP_CHILD, S_TEMP); present(HUM_CHILD, S_HUM); present(SOIL_CHILD, S_MOISTURE); } void loop() { // read capacitive sensor value sensorPowerOn();// wait(100); sensorValue = analogRead(sensorPin); wait(200); readStatus = myAHT10.readRawData(); if (readStatus != AHT10_ERROR) { temperature = myAHT10.readTemperature(AHT10_USE_READ_DATA); humidity = myAHT10.readHumidity(AHT10_USE_READ_DATA); } else { Serial.print("i2c error"); } soilmoisturepercent = map(sensorValue, AirValue, WaterValue, 0, 100); if(soilmoisturepercent >= 100) { soilmoisturepercent=100; } else if(soilmoisturepercent <=0) { soilmoisturepercent=0; } // measure voltage by band gap voltage unsigned int getVDD = 0; // set the reference to Vcc and the measurement to the internal 1.1V reference while (((getVDD == 0)&&(x<=10)) || isnan(getVDD)){ x++; ADMUX = (1<<REFS0) | (1<<MUX3) | (1<<MUX2) | (1<<MUX1); delay(50); // Wait for Vref to settle ADCSRA |= (1<<ADSC); // Start conversion while (bit_is_set(ADCSRA,ADSC)); // wait until done getVDD = ADC; // Vcc in millivolts // mcu dependend calibration } getVDD = 1122475UL / (unsigned long)getVDD; //1126400 = 1.1*1024*1000 batterypercent = map(getVDD, BatLowValue, BatHighValue, 0, 100); if(batterypercent >= 100) { batterypercentage = 100; } else if(batterypercent <=0) { batterypercentage = 0; } else if(batterypercent >0 && batterypercent < 100) { batterypercentage = batterypercent; } #ifdef MY_DEBUG Serial.print("Battery percent: "); Serial.print(batterypercentage); Serial.println(" %"); #endif if (lastTemp != temperature) { send(tempMsg.set(temperature, 1)); lastTemp = temperature; } if (lastHum != humidity) { send(humMsg.set(humidity, 1)); lastHum = humidity; } if (lastSoil != soilmoisturepercent) { send(soilMsg.set(soilmoisturepercent, 1)); lastSoil = soilmoisturepercent; } if (oldbatterypercentage != batterypercentage) { sendBatteryLevel(batterypercentage); oldbatterypercentage = batterypercentage; } Serial.print(F(" Nu Slapen ")); sensorPowerOff(); wait(100); smartSleep(SLEEP_TIME); }
Gateway
// Enable debug prints to serial monitor #define MY_DEBUG // Use a bit lower baudrate for serial prints on ESP8266 than default in MyConfig.h #define MY_BAUD_RATE 115200 //Nieuw #define MY_RADIO_RFM95 #define MY_RFM95_FREQUENCY (RFM95_868MHZ) #define MY_RFM95_IRQ_PIN D1 //DIO0 #define MY_RFM95_IRQ_NUM MY_RFM95_IRQ_PIN #define MY_RFM95_CS_PIN D8 // NSS #define MY_DEBUG_VERBOSE_RFM95 #define MY_RFM95_MODEM_CONFIGRUATION RFM95_BW125CR45SF128 #define RFM95_RETRY_TIMEOUT_MS (3000ul) #define MY_RFM95_ATC_MODE_DISABLED #define MY_RFM95_TX_POWER_DBM (13) #define MY_TRANSPORT_STATE_TIMEOUT_MS (3*1000ul) #define RFM95_RETRY_TIMEOUT_MS (5000ul) #define MY_SOFT_SPI_SCK_PIN D5 #define MY_SOFT_SPI_MISO_PIN D6 #define MY_SOFT_SPI_MOSI_PIN D7 #define MY_GATEWAY_MQTT_CLIENT #define MY_GATEWAY_ESP8266 // Set this node's subscribe and publish topic prefix #define MY_MQTT_PUBLISH_TOPIC_PREFIX "mysensors02-out" #define MY_MQTT_SUBSCRIBE_TOPIC_PREFIX "mysensors02-in" // Set MQTT client id #define MY_MQTT_CLIENT_ID "removed" // Enable these if your MQTT broker requires username/password #define MY_MQTT_USER "removed" #define MY_MQTT_PASSWORD "removed" // Set WIFI SSID and password #define MY_WIFI_SSID "removed" #define MY_WIFI_PASSWORD "removed" // Set the hostname for the WiFi Client. This is the hostname // it will pass to the DHCP server if not static. #define MY_HOSTNAME "removed" // MQTT broker ip address. #define MY_CONTROLLER_IP_ADDRESS 192, 168, 0, 7 //MQTT broker if using URL instead of ip address. //#define MY_CONTROLLER_URL_ADDRESS "removed" // The MQTT broker port to to open #define MY_PORT 1883 // Set blinking period //#define MY_DEFAULT_LED_BLINK_PERIOD 300 // Flash leds on rx/tx/err #define MY_DEFAULT_ERR_LED_PIN D0 // Error led pin #define MY_DEFAULT_RX_LED_PIN D4 // Receive led pin //#define MY_DEFAULT_TX_LED_PIN D4 // the PCB, on board LED #include <ESP8266WiFi.h> #include <MySensors.h> void setup() { // Setup locally attached sensors } void presentation() { // Present locally attached sensors here } void loop() { // Send locally attached sensors data here }
-
RE: OTA not working in my current setup (CRC Error)
Success!
I've been reading and measuring and soldering everything to fix the bug. With some datasheet help and my trusty multimeter. I did the following fix:
Soldering the SCK pin (only soldering this pin does not fix the CRC errors)
Soldering pin 7 to pin 8 on the flash chip finishes the fix.So first my log shows:
OTA:FWP:FL DUMP 437A:0000000000000000000000000000000018530
Now the log shows
TSF:MSG:READ,0-0-45,s=255,c=4,t=3,pt=6,l=22,sg=0:03000D0003000C94D5030C94D5030C94D5030C94D503 OTA:FWP:FL DUMP 003A:0C94D5030C94D5030C94D5030C94D503127516
Lot more data is whriting to the flash.
And after the firmware is recieved:
127760 OTA:FWP:FW END 129652 OTA:CRC:B=04E0,C=3E27,F=3E27 129656 OTA:FWP:CRC OK
And the node reboots so OTA works!
And as a bonus
#define MY_OTA_FLASH_JDECID (0x1F65)
Works also so this can also be used as an red flag if your OTA is not working and you have the correct flash chip but get a FLASH INIT error.
I would like to thank everybody for helping!
@sundberg84 I would not move away from your great PCB design, but I might order some new ones.
-
RE: OTA not working in my current setup (CRC Error)
Okay, i understand there are some bugs in the PCB design. Having V10 boards I have tried to do a quick fix and solder the SCK pin.
But still getting CRC errors. Should I do more more modifications? Or abandon the EasyPCB boards because of the bugs with the flash memory and get some other PCB to try again?
-
RE: OTA not working in my current setup (CRC Error)
@sundberg84 And the bug is that the SCK pin is going nowhere? Because that pin is not connected to SCK in the schematic.
@cabat Alright so the messages are correct but the flash is not working.So my next step is to solder the SCK pin. Will do that in a few days. Keeping everybody in the loop.
-
RE: OTA not working in my current setup (CRC Error)
Maybe replying at my own post.
But the MySensors OTA code uses
#define MY_OTA_FLASH_JDECID (0x1F65)
That is for the AT25DF512C-SSHN-B if i read the datasheet from Adesto right. But using code 0x1F65 always results in Flash INIT error and using 0x00 works. But that's the "unknown type".
-
RE: OTA not working in my current setup (CRC Error)
OK,
Now I'm seeing
125540 OTA:FWP:FL DUMP 000A:00000000000000000000000000000000125546
These lines in the serial console and a lot of them. Don't know if these lines are any good.
18442 OTA:FRQ:FW REQ,T=0003,V=000D,B=0437 18466 TSF:MSG:SEND,45-45-0-0,s=255,c=4,t=2,pt=6,l=6,sg=0,ft=0,st=OK:03000D003704 18509 TSF:MSG:READ,0-0-45,s=255,c=4,t=3,pt=6,l=22,sg=0:03000D003704B0E2A1114FC0C40ED11C992309F45BC0 18520 OTA:FWP:RECV B=0437 18524 OTA:FWP:FL DUMP 437A:0000000000000000000000000000000018530
It get's a long line from recieve and just a small amount reads from flash?
-
RE: OTA not working in my current setup (CRC Error)
Yes I've seen MyOtaFirmUpdate.h and the log messages.
Did some calculations on the B/C and F line
109953 OTA:FWP:FW END 111788 OTA:CRC:B=04E0,C=5897,F=3E27 111792 !OTA:FWP:CRC FAIL
B= Firmware Blocks, 1248 blocks (same value from MyController)
F= Firmware CRC 15911 (same value from MyController)No the wrong one:
C= Calculated CRC 22679 that divers from Mycontrollers 15911 value.But I can't figure out what causes these calculated crc errors. Well I know how CRC is calculated, but now how do I figure out where the error is happening.
-
OTA not working in my current setup (CRC Error)
Hi Everyone,
As a some sort MySensors enthousiast I can't get OTA to work (ever).
I have a current setup with a Raspberry Pi 3B that is configured with an RFM69 radio and setup as MQTT gateway. I have multiple nodes setup and with MQTT is all works flawless.
So last december I wanted to take it to another level and get my nodes to OTA, but as of today I can't get it to work.
Anyway to make my nodes OTA I installed mycontroller.org and set everything up. I use EasyPCB boards with RFM69 radio's, and soldered AT25DF512C-SSHN-B on these boards. Burned the Dualoptiboot sensebender micro bootloader as instructed.
Started with a simple battery node (code from examples and added OTA).
Only to change the version number in presentation and compile and upload the HEX file to MyController. Instructing the node to upload the firmware always results in CRC error.
Node log using serial console:
178499 OTA:FWP:FW END 180334 OTA:CRC:B=04E0,C=5897,F=3E27 180338 !OTA:FWP:CRC FAIL
My question. Is there anybody how has this some problem? Or is having the same setup and do have a working OTA environment? I'm running Mycontroller 1.5.0 FINAL and Mysensors 2.3.2 code on both the node and gateway. And not having any luck using OTA. All the rest works as expected. Did found a lot of other topics but these where all old and fixed in later firmwares.
Thanks in advance.