Ethernet Gateway - Radio Init Fail



  • HI,

    I'm just putting together my first mysensors project. I'm starting with the gateway first and trying to put together an Ethernet gateway. Here are the specifics and troubleshooting I've done.

    Platform -> Arduino Uno R3
    Ethernet Shield -> full sized Ethernet shield based on ENC28J60 chip
    Radio -> NRF24L01+PA+LNA (but have also tried just the plain NRF24L01+ smaller version with same results)

    • CSN to pin 6
    • CE to pin 5
    • MOSI to pin 11
    • SCK to pin 13
    • MISO to pin 12

    Operating System - Windows 10 (fresh install last Thursday)
    Arduino IDE: 1.6.5 (freshly installed today)
    MySensors libraries -> 1.5 (freshly pulled today from master branch)
    Radio powered from 3.3V output on Arduino
    100uF "can" capacitor across VCC and GND on radio (because it's the only size I had... same results with or without it)
    everything powered by USB cable from my computer (so I can troubleshoot via serial monitor)
    I have TX, RX, and ERROR LEDs connected between 5V rail from Arduino and 220Ohm resistor to ground

    Steps I've done
    I've updated EthernetGateway.ino to account for the ENC28J60 chip instead of Wiznet per the comments (i.e. UIPEthernet, etc)
    I've uncommented WITH_LEDS_BLINKING in MyConfig.h
    compiled and uploaded to Uno

    in the serial monitor, I get "0;0;3;0;9;radio init fail"

    I put in some Serial.println's to find out where it is failing, and it is failing in the call to rf24.isPVariant() in MyTransportNFR24.cpp

    if (!rf24.isPVariant()) {
    return false;
    }

    the call to isPVariant is returning false, and the code just bails at that point (falls out to a while(1)). looks like the p_variant variable is set as a result of the call to SetDataRate in rf24.cpp... So it looks like the code is failing to set the data rate (and maybe other config params) on the radio for some reason. I tried it with both the antennae and non-antennae versions of the radio with the same results.

    That's where my troubleshooting capabilities start to run out 😞

    Any further ideas?



  • @stevebus Meant to add a couple more details

    • this is all on a breadboard at the moment. prototyping before soldering it all via PCB
    • LEDs are connected to pins 7, 8, and 9
    • I get the same results in the serial monitor if I unplug VCC and GND for the radio!!.. Is this the first place in the code that we try to talk to the radio?? (not having a step debugger stinks 🙂 )

  • Hero Member

    @stevebus The Ethernet shield does not play nice on the SPI bus, so it's having problems talking to the radio. You need to move the radio to different pins and enable SoftSPI. Search the board for details on that. As a quick test, set up a serial gateway first with the radio on the pins you are currently using and if that works, you know the radio is good.

    Cheers
    Al



  • Thanks for the response...

    From the gateway wiring guidance page, I thought the SPI issue was only with the Wiznet based Ethernet shield. Is that not the case?

    I'll give the SoftSPI route a try. Thx for the quick response.


  • Admin

    The ENC module usually works without SOFTSPI.. But it is really tight to get it in on the ATMega328.


  • Admin

    You might have picked up a none+ variant of the NRF24 module which doesn't support the 250kbs transfer speed.

    You might get around this by increasing speed to 1mbps in MyConfig.h and remove the sanity check in MySensors library.


  • Hero Member

    @hek said:

    The ENC module usually works without SOFTSPI.. But it is really tight to get it in on the ATMega328.

    Thanks for the clarification!

    Cheers
    Al



  • thanks for the clarification and help, guys.. You guys rock with the quick responses! (and Mysensors in general is friggin' awesome!)

    I moved the wires and enabled SoftSPI and got further than I was. I managed to get to the hallowed "gateway started" message, but got gobbledygook for the st param.. this is what got printed..

    0;0;3;0;9;gateway started, id=0, parent=0, distance=0
    c=327,t=310,pt=288,l=273,sg=631,st=»:qmjëlVúšÚö�iÿïs0¼�÷ïÜžºKmýÏO»rgædöûå=_ošóÕëÖÌ›§2ŒT†—<÷¿Îºô}~Bõò>,{÷5/

    does that look right? or an issue? what does a 'working' gateway look like (without yet having any sensors or connecting to Vera)? Should I be able to ping it? (I can't) Should I be able to telnet to port 5003? (I can't)



  • disregard the note above about not being able to ping or telnet to the gateway... that was user error :-)...

    the question still remains about the gobbledygook in the st param of the 'gateway started' message. is that legit?


  • Admin

    "gateway started" is a good message 🙂

    But gobbelgoo is not good.



  • Ok... update... I had some debug code in there from when I was trying to find out where the initialization was failing, and I think I introduced a bug... I removed my code and re-ran and got this:

    0;0;3;0;9;gateway started, id=0, parent=0, distance=0

    that looks good :-)...

    thanks for the help guys!


  • Hero Member

    @stevebus Glad to hear you got it working!

    Cheers
    Al


Log in to reply
 

Suggested Topics

55
Online

11.4k
Users

11.1k
Topics

112.6k
Posts