Leonardo/RFM69HW ethernet gateway not working



  • I am having trouble building an ethernet gateway with RFM69HW. I have several radios and used them with an ESP8266 gateway so I know they work. It kept dropping off the network every so often to I want to move to wired. I have Freaduino Leonardo clone and clone 5100 shield and I borrowed a genuine Uno and clone 5100 shield. I have wired everything up per the documentation and neither will work. If I comment out all the RFM lines the gateway comes online and I can ping it on either board/shield. With RFM enabled I get init failures. I have tried the with default wiring and defines and changed them up based on what I've read in other posts. I really need to get it working on the Leonardo as I will have to give back the Uno. I am using level converters as well.

    Here is the log from the Uno:

    0 MCO:BGN:INIT GW,CP=RPNGA---,REL=255,VER=2.3.1
    4 TSM:INIT
    5 TSF:WUR:MS=0
    6 RFM69:INIT
    7 RFM69:INIT:PIN,CS=6,IQP=2,IQN=0
    809 RFM69:PTX:LEVEL=5 dBm
    812 !RFM69:INIT:SANCHK FAIL
    815 !TSM:INIT:TSP FAIL
    817 TSM:FAIL:CNT=1
    818 TSM:FAIL:DIS
    820 TSF:TDI:TSL
    821 RFM69:RSL
    

    Here is the sketch:

    // Enable debug prints to serial monitor
    #define MY_DEBUG
    #define MY_DEBUG_VERBOSE_RFM69
    
    // Enable and select radio type attached
    #define MY_RADIO_RFM69
    
    // 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
    
    // Define this to enable the improved RFM69 driver
    #define MY_RFM69_NEW_DRIVER
    
    // The frequency to use.
    #define MY_RFM69_FREQUENCY RFM69_915MHZ
    
    // Define this if you are using the RFM69HW
    #define MY_IS_RFM69HW
    
    // RFM69 SPI chip select pin
    #define MY_RFM69_CS_PIN 6
    
    // Define this to override the default RFM69 IRQ pin assignment
    //#define MY_RFM69_IRQ_PIN 7
    
    // Enable UDP communication
    //#define MY_USE_UDP  // If using UDP you need to set MY_CONTROLLER_IP_ADDRESS below
    
    // Enable MY_IP_ADDRESS here if you want a static ip address (no DHCP)
    #define MY_IP_ADDRESS 192,168,0,75
    
    // If using static ip you can define Gateway and Subnet address as well
    #define MY_IP_GATEWAY_ADDRESS 192,168,0,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
    
    // 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
    
    #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
    }
    

    I am using Arduino IDE 1.8.4, Boards 1.6.23, and MySensors 2.3.1.

    I have tried older versions of Boards and MySensors to no avail.

    Please help.


  • Mod

    @elcheekytico have you tried using softspi? If you did, were the results different or exactly the same?



  • @mfalkvidd I wasn't sure on how to do that. I saw that setup for NRF radios, but couldn't figure it how to apply that with RFM radios and what defines to use and such.



  • @elcheekytico said in Leonardo/RFM69HW ethernet gateway not working:

    @mfalkvidd I wasn't sure on how to do that. I saw that setup for NRF radios, but couldn't figure it how to apply that with RFM radios and what defines to use and such.

    @mfalkvidd I just found the API docs for soft SPI. I'll give that a try tonight or in the next couple days.


  • Mod

    @elcheekytico great. If you find a working wiring configuration and corresponding defines, I'll be happy to add it to the table at https://www.mysensors.org/build/ethernet_gateway

    If I understand https://www.mysensors.org/apidocs/group__SoftSpiSettingGrpPub.html correctly, softspi can only be used by the new rfm69 driver. Be aware that all nodes (including the gateway) in a MySensors network need to use the same driver. Since you're already using the new driver it should not be a problem though.





  • @carywin said in Leonardo/RFM69HW ethernet gateway not working:

    I got this working here: https://forum.mysensors.org/topic/6249/mqtt-ethernet-gateway-using-leonardo-32u4-w5100-rfm69h-hard-spi

    @Carywin Have you tried with the new rfm69 driver? From what I have read this should support SPI transactions.



  • I did manage to get this to work this morning. As I mentioned, I have a Freaduino Leonardo clone. This has a selector switch for 3.3v and 5v IO. I decided to go back and try with it at 3.3v and not use logic converters. It also has a ICSP breakout for SPI/IIC. I re-wired this thing many times, but was only able to get it to work when I wired it directly to the ICSP breakout and used the VCC/ground on the ICSP breakout as well. I tried the 3.3v on from one of the other pins on the board and 3.3v from a breadboarded power supply. Maybe it's something more simple that I just don't understand or missed, but it doesn't make sense to me. I made sure the 3.3v was there with each wiring change.

    I did however set the following:

    // RFM69 SPI chip select pin
    #define MY_RFM69_CS_PIN 6
    
    // Define this to override the default RFM69 IRQ pin assignment
    #define MY_RFM69_IRQ_PIN 2
    
    // RFM69 IRQ number
    #define MY_RFM69_IRQ_NUM 1
    

    And the log shows:

    565 GWT:TIN:IP=192.168.0.75
    1565 MCO:BGN:STP
    1566 MCO:BGN:INIT OK,TSP=1
    1566 TSM:READY:NWD REQ
    1566 RFM69:SWR:SEND,TO=255,SEQ=0,RETRY=0
    1568 RFM69:CSMA:RSSI=-97
    3569 TSF:MSG:SEND,0-0-255-255,s=255,c=3,t=20,pt=0,l=0,sg=0,ft=0,st=OK:
    

    I know @Carywin mentioned extending the ICSP connector through the shield and used that. Maybe that's why it worked for him.


 

298
Online

8.8k
Users

9.6k
Topics

100.3k
Posts