Serial gateway problem after upgrade from 1-5 to 2-1-1



  • Hi all,
    i have my four nodes running and serial gateway running on version 1.5 and all works fine, but after upgrading to version 2.1.1 my serial gateway stop working i haven't changed any wiring so its not hardware, if i flash this gateway with 1.5 it works without even changing radio. so it must be some config/software change from 1.5 to 2.1.1 that is causing this failure. i m just lost here, all forum posts seems to end without any final conclusion

    0;255;3;0;9;MCO:BGN:INIT GW,CP=RNNGA--,VER=2.1.1
    0;255;3;0;9;TSM:INIT
    0;255;3;0;9;TSF:WUR:MS=0
    0;255;3;0;9;RF24:write register, reg=0, value=14
    0;255;3;0;9;RF24:write register, reg=3, value=3
    0;255;3;0;9;RF24:write register, reg=4, value=95
    0;255;3;0;9;RF24:write register, reg=5, value=76
    0;255;3;0;9;RF24:write register, reg=6, value=35
    0;255;3;0;9;RF24:write register, reg=16, value=115
    0;255;3;0;9;RF24:write register, reg=29, value=6
    0;255;3;0;9;RF24:read register, reg=6, value=255
    0;255;3;0;9;RF24:read register, reg=5, value=255
    0;255;3;0;9;!RF24:INIT:SANCHK FAIL
    0;255;3;0;9;!TSM:INIT:TSP FAIL
    0;255;3;0;9;TSM:FAIL:CNT=1
    0;255;3;0;9;TSM:FAIL:PDT
    0;255;3;0;9;RF24:write register, reg=0, value=12
    0;255;3;0;9;RF24:PD



  • Maybe there could be more reasons but at least these two are known to cause troubles:

    The newer nRF lib:

    • Causes higher power consumption: So make sure, there's enought juice.
    • Check the PA-level used (standard is already low, so this may have been different in the past also).
    • In some rare cases, there may occur strange things with fake nRF chips. If possible, try an other nRF module from differen source.

    Second: use latest board-definition within the Arduino IDE (board manager). Some "in between-versions" cause regular reboots of the arduino.


  • Hardware Contributor

    Hello.

    I don't think new nRF consumes more juice. it process faster than in 1.5 lib though, so it can send faster consecutive packets sure.

    @pihome

    • please post your gw+nodes sketch
    • and your gw+nodes logs.

    That will be easier for helping you. (you can use "Insert code block" tool in your message toolbar for inserting stuff. Easier to read 😉 )

    • Are all your devices updated to same version ?
    • Decoupling capacitor, like 10uF, on radio ?
    • finally, if anything above work, not sure, but maybe try with a fresh a node, or radio, or try a clear eeprom.

    Else it could be in your sketch defines..
    Not enough infos for the moment 🙂


  • Mod

    @pihome did you update all nodes and gateway to 2.1.1, or only the gateway ?



  • all nodes are powered off now, and only gateway is on 2.1.1 now.


  • Mod

    @pihome Make sure all nodes and gateway use the same version; 2.x is not compatible with 1.x !



  • I had huge problems with ack on so I turned it off on my whole network. Otherwise a node presenting would reset the controller over and over.



  • here is my gateway sketch. i have no other sensors powered on so having sensors on same version doesn't apply here.

    /**
    * 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-2015 Sensnology AB
    * Full contributor list: https://github.com/mysensors/Arduino/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
    * The ArduinoGateway prints data received from sensors on the serial link.
    * The gateway accepts input on seral which will be sent out on radio network.
    *
    * The GW code is designed for Arduino Nano 328p / 16MHz
    *
    * Wire connections (OPTIONAL):
    * - Inclusion button should be connected between digital pin 3 and GND
    * - RX/TX/ERR leds need to be connected between +5V (anode) and digital pin 6/5/4 with resistor 270-330R in a series
    *
    * LEDs (OPTIONAL):
    * - To use the feature, uncomment any of the MY_DEFAULT_xx_LED_PINs
    * - RX (green) - blink fast on radio message recieved. In inclusion mode will blink fast only on presentation recieved
    * - TX (yellow) - blink fast on radio message transmitted. In inclusion mode will blink slowly
    * - ERR (red) - fast blink on error during transmission error or recieve crc error
    *
    */
    
    // Enable debug prints to serial monitor
    #define MY_DEBUG
    
    
    // Enable and select radio type attached
    #define MY_RADIO_NRF24
    //#define MY_RADIO_RFM69
    
    // Set LOW transmit power level as default, if you have an amplified NRF-module and
    // power your radio separately with a good regulator you can turn up PA level.
    // #define MY_RF24_PA_LEVEL RF24_PA_LOW
    
    #define MY_RF24_PA_LEVEL RF24_PA_MAX
    //#define MY_DEBUG_VERBOSE_RF24
    // RF channel for the sensor net, 0-127
    #define RF24_CHANNEL     125
    //RF24_250KBPS for 250kbs, RF24_1MBPS for 1Mbps, or RF24_2MBPS for 2Mbps
    #define RF24_DATARATE 	   RF24_250KBPS
    
    // Enable serial gateway
    #define MY_GATEWAY_SERIAL
    
    // Define a lower baud rate for Arduino's running on 8 MHz (Arduino Pro Mini 3.3V & SenseBender)
    #if F_CPU == 8000000L
    #define MY_BAUD_RATE 38400
    #endif
    
    // Enable inclusion mode
    #define MY_INCLUSION_MODE_FEATURE
    // Enable Inclusion mode button on gateway
    //#define MY_INCLUSION_BUTTON_FEATURE
    
    // Inverses behavior of inclusion button (if using external pullup)
    //#define MY_INCLUSION_BUTTON_EXTERNAL_PULLUP
    
    // Set inclusion mode duration (in seconds)
    #define MY_INCLUSION_MODE_DURATION 60
    // Digital pin used for inclusion mode button
    //#define MY_INCLUSION_MODE_BUTTON_PIN  3
    
    // Set blinking period
    #define MY_DEFAULT_LED_BLINK_PERIOD 300
    
    // Inverses the behavior of leds
    #define MY_WITH_LEDS_BLINKING_INVERSE
    
    // Flash leds on rx/tx/err
    // Uncomment to override default HW configurations
    #define MY_DEFAULT_ERR_LED_PIN 4  // Error led pin
    #define MY_DEFAULT_RX_LED_PIN  6  // Receive led pin
    #define MY_DEFAULT_TX_LED_PIN  5  // the PCB, on board LED
    
    #include <MySensors.h>
    
    void setup()
    {
      // Setup locally attached sensors
    }
    
    void presentation()
    {
      // Present locally attached sensors
    }
    
    void loop()
    {
      // Send locally attached sensor data here
    }
    
    
    
    
    


  • after making following changes my gateway seems to be working fine.

    #define MY_RF24_PA_LEVEL RF24_PA_MAX
    //#define MY_DEBUG_VERBOSE_RF24
    // RF channel for the sensor net, 0-127
    #define RF24_CHANNEL     125
    
    0;255;3;0;9;MCO:BGN:INIT GW,CP=RNNGA--,VER=2.1.1
    0;255;3;0;9;TSM:INIT
    0;255;3;0;9;TSF:WUR:MS=0
    0;255;3;0;9;TSM:INIT:TSP OK
    0;255;3;0;9;TSM:INIT:GW MODE
    0;255;3;0;9;TSM:READY:ID=0,PAR=0,DIS=0
    0;255;3;0;9;MCO:REG:NOT NEEDED
    0;255;3;0;14;Gateway startup complete.
    0;255;0;0;18;2.1.1
    0;255;3;0;9;MCO:BGN:STP
    0;255;3;0;9;MCO:BGN:INIT OK,TSP=1
    


  • Basic Temperature sensors 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-2015 Sensnology AB
     * Full contributor list: https://github.com/mysensors/Arduino/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
     *
     * Example sketch showing how to send in DS1820B OneWire temperature readings back to the controller
     * http://www.mysensors.org/build/temp
     */
    
    
    // Enable debug prints to serial monitor
    //#define MY_DEBUG 
    
    // Set LOW transmit power level as default, if you have an amplified NRF-module and
    // power your radio separately with a good regulator you can turn up PA level.
    // #define MY_RF24_PA_LEVEL RF24_PA_LOW
    
    // Enable and select radio type attached
    #define MY_RADIO_NRF24
    //#define MY_RADIO_RFM69
    
    // Set LOW transmit power level as default, if you have an amplified NRF-module and
    // power your radio separately with a good regulator you can turn up PA level.
    // #define MY_RF24_PA_LEVEL RF24_PA_LOW
    
    #define MY_RF24_PA_LEVEL RF24_PA_MAX
    //#define MY_DEBUG_VERBOSE_RF24
    // RF channel for the sensor net, 0-127
    #define RF24_CHANNEL     125
    //RF24_250KBPS for 250kbs, RF24_1MBPS for 1Mbps, or RF24_2MBPS for 2Mbps
    #define RF24_DATARATE 	   RF24_250KBPS
    
    
    #include <SPI.h>
    #include <MySensors.h>  
    #include <DallasTemperature.h>
    #include <OneWire.h>
    int BATTERY_SENSE_PIN = A0;  // select the input pin for the battery sense point
    
    #define COMPARE_TEMP 0 // Send temperature only if changed? 1 = Yes 0 = No
    //PiHome Node ID
    #define MY_NODE_ID 25
    #define ONE_WIRE_BUS 3 // Pin where dallase sensor is connected 
    #define MAX_ATTACHED_DS18B20 16
    unsigned long SLEEP_TIME = 150000; // Sleep time between reads (in milliseconds)
    int oldBatteryPcnt = 0;
    OneWire oneWire(ONE_WIRE_BUS); // Setup a oneWire instance to communicate with any OneWire devices (not just Maxim/Dallas temperature ICs)
    DallasTemperature sensors(&oneWire); // Pass the oneWire reference to Dallas Temperature. 
    float lastTemperature[MAX_ATTACHED_DS18B20];
    int numSensors=0;
    bool receivedConfig = false;
    bool metric = true;
    // Initialize temperature message
    MyMessage msg(0,V_TEMP);
    
    void before()
    {
      // Startup up the OneWire library
      sensors.begin();
    }
    
    void setup()  
    { 
      // requestTemperatures() will not block current thread
      sensors.setWaitForConversion(false);
      
    // use the 1.1 V internal reference
    #if defined(__AVR_ATmega2560__)
        analogReference(INTERNAL1V1);
    #else
        analogReference(INTERNAL);
    #endif
    }
    
    // void sendSketchInfo(const char "Temperature Sensor", const char "1.1", bool ack);
    
    void presentation() {
      // Send the sketch version information to the gateway and Controller
      sendSketchInfo("Temperature Sensor", "1.1");
    
      // Fetch the number of attached temperature sensors  
      numSensors = sensors.getDeviceCount();
    
      // Present all sensors to controller
      for (int i=0; i<numSensors && i<MAX_ATTACHED_DS18B20; i++) {   
         present(i, S_TEMP);
      }
    }
    
    void loop()     
    {  
    // get the battery Voltage
    	int sensorValue = analogRead(BATTERY_SENSE_PIN);
    	#ifdef MY_DEBUG
    		Serial.println(sensorValue);
    	#endif
    	// 1M, 470K divider across battery and using internal ADC ref of 1.1V
        // Sense point is bypassed with 0.1 uF cap to reduce noise at that point
        // ((1e6+470e3)/470e3)*1.1 = Vmax = 3.44 Volts
        // 3.44/1023 = Volts per bit = 0.003363075
    	int batteryPcnt = sensorValue / 10;
    	#ifdef MY_DEBUG
    		float batteryV  = sensorValue * 0.003363075;
    		Serial.print("Battery Voltage: ");
    		Serial.print(batteryV);
    		Serial.println(" V");
    
    		Serial.print("Battery percent: ");
    		Serial.print(batteryPcnt);
    		Serial.println(" %");
    	#endif
    	
        if (oldBatteryPcnt != batteryPcnt) {
            // Power up radio after sleep
            sendBatteryLevel(batteryPcnt);
            oldBatteryPcnt = batteryPcnt;
        }
    	
      // Fetch temperatures from Dallas sensors
      sensors.requestTemperatures();
    
      // query conversion time and sleep until conversion completed
      int16_t conversionTime = sensors.millisToWaitForConversion(sensors.getResolution());
      // sleep() call can be replaced by wait() call if node need to process incoming messages (or if node is repeater)
      sleep(conversionTime);
    
      // Read temperatures and send them to controller 
      for (int i=0; i<numSensors && i<MAX_ATTACHED_DS18B20; i++) {
     
        // Fetch and round temperature to one decimal
        float temperature = static_cast<float>(static_cast<int>((getControllerConfig().isMetric?sensors.getTempCByIndex(i):sensors.getTempFByIndex(i)) * 10.)) / 10.;
     
        // Only send data if temperature has changed and no error
        #if COMPARE_TEMP == 1
        if (lastTemperature[i] != temperature && temperature != -127.00 && temperature != 85.00) {
        #else
        if (temperature != -127.00 && temperature != 85.00) {
        #endif
     
          // Send in the new temperature
          send(msg.setSensor(i).set(temperature,1));
          // Save new temperatures for next compare
          lastTemperature[i]=temperature;
        }
      }
      sleep(SLEEP_TIME);
    }
    

    these message are received on serial gateway...

    0;255;3;0;9;TSF:MSG:BC
    0;255;3;0;9;TSF:MSG:FPAR REQ,ID=25
    0;255;3;0;9;TSF:PNG:SEND,TO=0
    0;255;3;0;9;TSF:CKU:OK
    0;255;3;0;9;TSF:MSG:GWL OK
    0;255;3;0;9;!TSF:MSG:SEND,0-0-25-25,s=255,c=3,t=8,pt=1,l=1,sg=0,ft=0,st=NACK:0
    0;255;3;0;9;TSF:MSG:READ,25-25-255,s=255,c=3,t=7,pt=0,l=0,sg=0:
    0;255;3;0;9;TSF:MSG:BC
    0;255;3;0;9;TSF:MSG:FPAR REQ,ID=25
    0;255;3;0;9;TSF:CKU:OK,FCTRL
    0;255;3;0;9;TSF:MSG:GWL OK
    0;255;3;0;9;!TSF:MSG:SEND,0-0-25-25,s=255,c=3,t=8,pt=1,l=1,sg=0,ft=0,st=NACK:0
    0;255;3;0;9;TSF:MSG:READ,25-25-255,s=255,c=3,t=7,pt=0,l=0,sg=0:
    0;255;3;0;9;TSF:MSG:BC
    0;255;3;0;9;TSF:MSG:FPAR REQ,ID=25
    0;255;3;0;9;TSF:CKU:OK,FCTRL
    0;255;3;0;9;TSF:MSG:GWL OK```
    
    its looking for hardware ack, any idea why this is happening?
    
    only happens if sensors is restarted,

 

448
Online

8.0k
Users

8.8k
Topics

94.4k
Posts