Gateway W5100 with RFM69 fails to compile


  • Contest Winner

    Hello,

    im trying to build a Gateway based on ATMEGA2560 with W5100 Ethnernet Chip and RF69 Radio Module.
    I'm using the stock GatewayW5100 from the MySensors Examples folder. Becuase I'm using a RF69 and not a NRF24 I disable the NRF24 driver and enable the RF69 Driver by (dis)commenting the specific lines.

    However my Arduino 1.8.8 gives me an error message: 'class SoftSPI<16u, 15u, 14u, 0u>' has no member named 'setDataMode'. Arduino.cc says that setDataMode shall not be used anymore. I think something is screwed up here...

    The debug output of Arduino says the following Versions are used:
    Bibliothek Ethernet in Version 2.0.0 im Ordner: D:\Program Files (x86)\Arduino\libraries\Ethernet wird verwendet
    Bibliothek MySensors in Version 2.3.2 im Ordner: D:\EigeneDaten\Dokumente\Arduino\libraries\MySensors wird verwendet
    Bibliothek SPI in Version 1.0 im Ordner: D:\Program Files (x86)\Arduino\hardware\arduino\avr\libraries\SPI wird verwendet

    Source of the Gateway Sketch (only put a comment on #define MY_RADIO_RF24 and removed comment from #define MY_RADIO_RFM69.

    /*
     * 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 - Henrik Ekblad
     * Contribution by a-lurker and Anticimex
     * Contribution by Norbert Truchsess <norbert.truchsess@t-online.de>
     * Contribution by Tomas Hozza <thozza@gmail.com>
     *
     *
     * DESCRIPTION
     * The EthernetGateway sends data received from sensors to the ethernet link.
     * The gateway also accepts input on ethernet interface, which is then sent out to the radio network.
     *
     * The GW code is designed for Arduino 328p / 16MHz.  ATmega168 does not have enough memory to run this program.
     *
     * LED purposes:
     * - To use the feature, uncomment MY_DEFAULT_xxx_LED_PIN in the sketch below
     * - RX (green) - blink fast on radio message received. In inclusion mode will blink fast only on presentation received
     * - TX (yellow) - blink fast on radio message transmitted. In inclusion mode will blink slowly
     * - ERR (red) - fast blink on error during transmission error or receive crc error
     *
     * See http://www.mysensors.org/build/ethernet_gateway for wiring instructions.
     *
     */
    
    // Enable debug prints to serial monitor
    #define MY_DEBUG
    
    // Enable and select radio type attached
    //#define MY_RADIO_RF24
    //#define MY_RADIO_NRF5_ESB
    #define MY_RADIO_RFM69
    //#define MY_RFM69_NEW_DRIVER
    //#define MY_RADIO_RFM95
    
    // Enable gateway ethernet module type
    #define MY_GATEWAY_W5100
    
    // W5100 Ethernet module SPI enable (optional if using a shield/module that manages SPI_EN signal)
    //#define MY_W5100_SPI_EN 4
    
    // Enable Soft SPI for NRF radio (note different radio wiring is required)
    // The W5100 ethernet module seems to have a hard time co-operate with
    // radio on the same spi bus.
    #if !defined(MY_W5100_SPI_EN) && !defined(ARDUINO_ARCH_SAMD)
    #define MY_SOFTSPI
    #define MY_SOFT_SPI_SCK_PIN 14
    #define MY_SOFT_SPI_MISO_PIN 16
    #define MY_SOFT_SPI_MOSI_PIN 15
    #endif
    
    // When W5100 is connected we have to move CE/CSN pins for NRF radio
    #ifndef MY_RF24_CE_PIN
    #define MY_RF24_CE_PIN 5
    #endif
    #ifndef MY_RF24_CS_PIN
    #define MY_RF24_CS_PIN 6
    #endif
    
    // Enable UDP communication
    //#define MY_USE_UDP  // If using UDP you need to set MY_CONTROLLER_IP_ADDRESS or MY_CONTROLLER_URL_ADDRESS below
    
    // Enable MY_IP_ADDRESS here if you want a static ip address (no DHCP)
    #define MY_IP_ADDRESS 192,168,178,66
    
    // If using static ip you can define Gateway and Subnet address as well
    //#define MY_IP_GATEWAY_ADDRESS 192,168,178,1
    //#define MY_IP_SUBNET_ADDRESS 255,255,255,0
    
    // Renewal period if using DHCP
    //#define MY_IP_RENEWAL_INTERVAL 60000
    
    // The port to keep open on node server mode / or port to contact in client mode
    #define MY_PORT 5003
    
    // Controller ip address. Enables client mode (default is "server" mode).
    // Also enable this if MY_USE_UDP is used and you want sensor data sent somewhere.
    //#define MY_CONTROLLER_IP_ADDRESS 192, 168, 178, 254
    //#define MY_CONTROLLER_URL_ADDRESS "my.controller.org"
    
    // The MAC address can be anything you want but should be unique on your network.
    // Newer boards have a MAC address printed on the underside of the PCB, which you can (optionally) use.
    // Note that most of the Arduino examples use  "DEAD BEEF FEED" for the MAC address.
    #define MY_MAC_ADDRESS 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED
    
    
    // Enable inclusion mode
    #define MY_INCLUSION_MODE_FEATURE
    // Enable Inclusion mode button on gateway
    //#define MY_INCLUSION_BUTTON_FEATURE
    // 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
    
    // Flash leds on rx/tx/err
    // Uncomment to override default HW configurations
    //#define MY_DEFAULT_ERR_LED_PIN 7  // Error led pin
    //#define MY_DEFAULT_RX_LED_PIN  8  // Receive led pin
    //#define MY_DEFAULT_TX_LED_PIN  9  // Transmit led pin
    
    #if defined(MY_USE_UDP)
    #include <EthernetUdp.h>
    #endif
    #include <Ethernet.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
    }
    
    

  • Mod

    Iā€™m unable to find any recent changes that seem to cause this problem (checked the Arduino changelog and the MySensors code). But I noticed that only the old rfm69 driver uses setDataMode(). Maybe nobody has tried to build a mega-based gateway with w5100 and rfm69 before, so the problem has not been observed until now.

    If you are building a new MySensors network, you could use the new rfm69 driver by uncommenting MY_RFM69_NEW_DRIVER


  • Contest Winner

    Sorry for replying this late, just having some "real world" issues šŸ˜‰
    Yes, with the new driver it works. Do we have a comparison about pros/cons of the new RFM69 driver. As I'm migrating all my nodes from nrf24 to rfm69 its no problem to use the new driver in all sketches. Just wondering what has changed in the new driver..

    Thanks, DirkH


  • Hardware Contributor

    @Dirk_H - I have the same issue, but I do not get softSPI to work on a Uno + Ethernet Module + RFM69. Can you confirm that softSPI works for you and Ethernet Module? What pins do you use for softSPI (analog?)


  • Hardware Contributor

    @Dirk_H

    • old driver is based on an old lowpowerlab lib version
    • new driver has been refactored and optimized. It's not compatible with old driver. Which means it should be deployed on gw and all nodes

    About new driver:

    • more features like : automatic power level control so it does not use more rf power than needed
    • unified driver with Lora modules so they can communicate with rfm69 (rfm95<->rfm69 for example)
    • handles SPI transaction so it should be compatible with HW SPI+W5100
    • memory and speed optimizations
    • etc

    I don't know if it still works, but I tried (years ago) Nano gw + W5100 + RFM69 + HW SPI, and it was ok. No time for the moment to re-test it unfortunately (I don't use this setup in prod).

    That said if you got it working with new driver, that's what I would use for sure


  • Contest Winner

    Hello,

    thank you scalz for the very good clarification.
    @sundberg84 I can confirm that it does compile with the #define MY_RFM69_NEW_DRIVER option. AFAIK Arduino changed the way setDataMode should be called (see links in first post). I'm not a SW-Expert but I think Someone would have to change the coresponding SoftSPI calls in the old RFM69 (old) driver if you want to use it. I currently use an ATMega2560+W5100+NRF24PA with SoftSPI which is working (but I do not know with which Arduino Verison it was compiled).

    I will go with the new driver. I think it takes some time until I really do the change in HW, because I have to change several productive nodes. As we have big heat at the moment and my lab is under the roof my motivation is currently not that high... šŸŒ” šŸ˜„


  • Contest Winner

    @sundberg84
    It does not work for me with softspi too. Although the debug output does not look that bad..

    MCO:BGN:INIT GW,CP=RPNGA---,FQ=16,REL=255,VER=2.3.2<\n>
    4 TSM:INIT<\n>
    5 TSF:WUR:MS=0<\n>
    8 TSM:INIT:TSP OK<\n>
    10 TSM:INIT:GW MODE<\n>
    12 TSM:READY:ID=0,PAR=0,DIS=0<\n>
    14 MCO:REG:NOT NEEDED<\n>
    577 GWT:TIN:IP=192.168.178.203<\n>
    1581 MCO:BGN:STP<\n>
    1583 MCO:BGN:INIT OK,TSP=1<\n>
    1585 TSM:READY:NWD REQ<\n>
    
    

  • Hardware Contributor

    @Dirk_H - this is exactly the same for me. Are you using logic level converters?


  • Contest Winner

    @sundberg84 Hi, I'm not using level converters becuse I use a ProMini with 3,3V (with W5100 and rfm69hw).

    Maybe I have a small clue: The Interrupt Pin is high all the time. It seems that the interrupt request from the RFM Module is not processed. I cant see interrupts when I start a node. (With a working setup with ESP8266 and RFM69, the pin is low most of the time except when new packets arrive from a sensor).


Log in to reply
 

Suggested Topics

  • 1
  • 6
  • 5
  • 10
  • 13
  • 5
  • 11
  • 11

198
Online

9.6k
Users

10.2k
Topics

106.1k
Posts