Skip to content
  • MySensors
  • OpenHardware.io
  • Categories
  • Recent
  • Tags
  • Popular
Skins
  • Light
  • Brite
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Brand Logo
  1. Home
  2. Troubleshooting
  3. Uno+ethernet shield = radio init fail [solved]

Uno+ethernet shield = radio init fail [solved]

Scheduled Pinned Locked Moved Troubleshooting
23 Posts 8 Posters 17.1k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • hekH Offline
    hekH Offline
    hek
    Admin
    wrote on last edited by hek
    #6

    Oh.. someone already created an issue on github!

    This is probably the issue you're seeing.

    MySensors/Arduino#146

    1 Reply Last reply
    0
    • hekH Offline
      hekH Offline
      hek
      Admin
      wrote on last edited by
      #7

      Could someone try the updated ethernet-sketch?

      1 Reply Last reply
      0
      • M Offline
        M Offline
        mhson
        wrote on last edited by
        #8

        Good work!

        I have to admit, this is my first dive into this project so my knowledge is VERY limited. But my gateway says: "0;0;3;0;9;gateway started, id=0, parent=0, distance=0" so I guess its happy now!

        Thank you!

        1 Reply Last reply
        0
        • TD22057T Offline
          TD22057T Offline
          TD22057
          Hardware Contributor
          wrote on last edited by
          #9

          Excellent! Updated code works for me as well. Thanks for the quick response everyone (and I've learned to go check github for issues as well).

          Is there any reason the SOFTSPI flag can't be moved into the sketch as well? I'm assuming as long as it's defined before the include that gets to RF24, it will be OK. That way all the mods for different configs are in the sketch and it would eliminate having to remember to edit/compile/undo before building sensors. Any opinions?

          1 Reply Last reply
          0
          • hekH Offline
            hekH Offline
            hek
            Admin
            wrote on last edited by
            #10

            @TD22057

            Because defines declared in the sketch isn't visible in the cpp files. The Arduino build system isn't exactly the best on the planet.

            TD22057T 1 Reply Last reply
            0
            • D Offline
              D Offline
              diggs
              wrote on last edited by
              #11

              Hi all, I am about to try this as well as I have the same setup with the etehrnet shiled, but I don't really understand the wiring instructions. As the Ethernet shield is fixed on the board what does it mean by connecting MISO/SO to pin 12 and MOSI/SI to pin 11 etc?

              Apologies if this is a silly question

              1 Reply Last reply
              0
              • TD22057T Offline
                TD22057T Offline
                TD22057
                Hardware Contributor
                wrote on last edited by
                #12

                @diggs The instructions are for a general ethernet board - those are the pins it's using. If you use the ethernet shield, the connections are made in the shield, you just need to connect the radio up. If you're not using a shield, you have to make those connections yourself.

                1 Reply Last reply
                0
                • D Offline
                  D Offline
                  diggs
                  wrote on last edited by
                  #13

                  @TD22057 Thanks for the reply. That would mean then the IRQ is not used with this setup then,

                  1 Reply Last reply
                  0
                  • B Offline
                    B Offline
                    brakc
                    wrote on last edited by
                    #14

                    Hello,

                    I get same message in the serial : 0;0;3;0;9;radio init fail

                    • IDE 1.6.4 on Yosemit

                    • MEGA2560

                    • Ethernet Shield W5100 (like this : https://www.arduino.cc/en/Guide/ArduinoEthernetShield)

                    • NRF24L01+ (1436AH)

                    • MySensors Arduino Library v1.5

                    • I uncommented #define SOFTSPI in MyConfig.h

                    // Enable SOFTSPI for NRF24L01 when using the W5100 Ethernet module
                    #define SOFTSPI
                    #ifdef SOFTSPI
                    	// Define the soft SPI pins used for NRF radio
                    	const uint8_t SOFT_SPI_MISO_PIN = 50;
                        const uint8_t SOFT_SPI_MOSI_PIN = 51;
                        const uint8_t SOFT_SPI_SCK_PIN = 52;
                    #endif
                    
                    • EthernetGateway.ino
                    #define INCLUSION_MODE_TIME 1 // Number of minutes inclusion mode is enabled
                    #define INCLUSION_MODE_PIN  3 // Digital pin used for inclusion mode button
                    
                    #define RADIO_CE_PIN        5  // radio chip enable
                    #define RADIO_SPI_SS_PIN    6  // radio SPI serial select
                    
                    #define RADIO_ERROR_LED_PIN 7  // Error led pin
                    #define RADIO_RX_LED_PIN    8  // Receive led pin
                    #define RADIO_TX_LED_PIN    9  // the PCB, on board LED
                    
                    // NRFRF24L01 radio driver (set low transmit power by default) 
                    MyTransportNRF24 transport(RADIO_CE_PIN, RADIO_SPI_SS_PIN, RF24_PA_LEVEL_GW);  
                    

                    CE & CSN pin are différents configuration in MyConfig.h & EthernetGateway.ino. Can I change this?

                    Other idea please?

                    ;-)

                    1 Reply Last reply
                    0
                    • Michael HritzM Offline
                      Michael HritzM Offline
                      Michael Hritz
                      wrote on last edited by
                      #15

                      I'm getting the same error with the serial gateway.using Arduino Nano, My Sensor 1.5 Arduino ide 1.6.5. I tried two different radio modules and an external 3.3 v supply no combination worked.

                      1 Reply Last reply
                      0
                      • stevebusS Offline
                        stevebusS Offline
                        stevebus
                        wrote on last edited by
                        #16

                        this is probably an obvious question, but I'd rather insult your intelligence than silently let you make the same mistake I made for a while :-). On your hard drive, and I'm not sure how the second copy gets made (I didn't copy the library twice, or if I did, I was drunk when I did it :-)) , there are two copies of the libraries (and thus the config.h file). there is one in c:\program files(x86)\Arduino\libraries and one in your "My Documents"\Arduino\libraries (or wherever your "my docs" is).... it's the one in your "my docs" that counts. Make sure you are editing the right 'myconfig.h' file when you enable SOFT_SPI.

                        Vera Edge/UI7; mysensors; Arduino's and RPIs; data posted to Azure for an IoT 'dashboard' of my house

                        Opinions expressed here are my own and do not necessarily reflect Microsoft's feelings on a given topic :-)

                        1 Reply Last reply
                        0
                        • TD22057T Offline
                          TD22057T Offline
                          TD22057
                          Hardware Contributor
                          wrote on last edited by
                          #17

                          This might be another obvious question, but I'll ask anyway: I see a lot of people saying they're using 1.5 but that version had the bug in it that I originally saw. Did you update directly from the git repository to get the fix? I'm not sure whether or not it's fixed if you download the 1.5 master.zip file.

                          1 Reply Last reply
                          0
                          • Michael HritzM Offline
                            Michael HritzM Offline
                            Michael Hritz
                            wrote on last edited by
                            #18

                            The libraries don't exist under My Documents in my case. I've traced the error back to the code that is causing it, but I don't know what to do about it. In the rf24.h file there is a section that attempts to determine if the rf24 is P variant. It is returning false on the method call rf24.isPvariant. The results of the Serial.println statements I put in the MyTransportNRF24.cpp code are below:

                            Before rf24.begin in MyTransportNRF24
                            after rf24.begin in MyTransportNRF24
                            !rf24.isPVariant() in MyTransportNRF24

                            0;0;3;0;9;radio init fail

                            Here are the lines in the v1.5 rf24.h that I think are causing the problem.

                            Lines 347-351
                            RF24::RF24(uint8_t _cepin, uint8_t _cspin):
                            ce_pin(_cepin), csn_pin(_cspin), p_variant(false),
                            payload_size(32), dynamic_payloads_enabled(false), addr_width(5)//,pipe0_reading_address(0)
                            {
                            }

                            Lines 480-488
                            // Determine if this is a p or non-p RF24 module and then
                            // reset our data rate back to default value. This works
                            // because a non-P variant won't allow the data rate to
                            // be set to 250Kbps.
                            if( setDataRate( RF24_250KBPS ) )
                            {
                            p_variant = true ;
                            }

                            I'll try and copy over the v1.4 version of these files and see if they work.

                            1 Reply Last reply
                            0
                            • Michael HritzM Offline
                              Michael HritzM Offline
                              Michael Hritz
                              wrote on last edited by
                              #19

                              Well, I've completely started from scratch. Latest Arduino IDE, v1.4.2 of MySensors library. Had to copy several *.h files from version 1.5 to C:\Users\mike\Documents\Arduino\libraries\MySensors to get past all the include statements in the compiler. Now the compiler is throwing a lot of error messages (you can peruse them below). This system looked pretty good on their web site, maybe it was too good to be true. I'm trying to get the Gateway.ino sketch to compile. I downloaded it from github. I'll just sit this out and see what the Cognoscenti come up with.

                              In file included from C:\Users\mike\Documents\Arduino\libraries\MySensors\MyGateway.cpp:12:0:
                              C:\Users\mike\Documents\Arduino\libraries\MySensors\MyGateway.h:39:28: error: 'DEFAULT_CE_PIN' was not declared in this scope
                              MyGateway(uint8_t _cepin=DEFAULT_CE_PIN, uint8_t _cspin=DEFAULT_CS_PIN, uint8_t _inclusion_time = 1, int8_t _inclusion_pin=-1, int8_t _rx=-1, int8_t _tx=-1, int8_t _er=-1);
                              ^
                              C:\Users\mike\Documents\Arduino\libraries\MySensors\MyGateway.h:39:59: error: 'DEFAULT_CS_PIN' was not declared in this scope
                              MyGateway(uint8_t _cepin=DEFAULT_CE_PIN, uint8_t _cspin=DEFAULT_CS_PIN, uint8_t _inclusion_time = 1, int8_t _inclusion_pin=-1, int8_t _rx=-1, int8_t _tx=-1, int8_t _er=-1);
                              ^
                              C:\Users\mike\Documents\Arduino\libraries\MySensors\MyGateway.cpp: In constructor 'MyGateway::MyGateway(uint8_t, uint8_t, uint8_t, int8_t, int8_t, int8_t, int8_t)':
                              C:\Users\mike\Documents\Arduino\libraries\MySensors\MyGateway.cpp:30:163: error: no matching function for call to 'MySensor::MySensor(uint8_t&, uint8_t&)'
                              MyGateway::MyGateway(uint8_t _cepin, uint8_t _cspin, uint8_t _inclusion_time, int8_t _inclusion_pin, int8_t _rx, int8_t _tx, int8_t _er) : MySensor(_cepin, _cspin) {
                              ^
                              C:\Users\mike\Documents\Arduino\libraries\MySensors\MyGateway.cpp:30:163: note: candidates are:
                              In file included from C:\Users\mike\Documents\Arduino\libraries\MySensors\MyGateway.h:15:0,
                              from C:\Users\mike\Documents\Arduino\libraries\MySensors\MyGateway.cpp:12:
                              C:\Users\mike\Documents\Arduino\libraries\MySensors\MySensor.h:153:2: note: MySensor::MySensor(MyTransport&, MyHw&)
                              MySensor(MyTransport &radio =new MyTransportNRF24(), MyHw &hw=new MyHwDriver()
                              ^
                              C:\Users\mike\Documents\Arduino\libraries\MySensors\MySensor.h:153:2: note: no known conversion for argument 1 from 'uint8_t {aka unsigned char}' to 'MyTransport&'
                              C:\Users\mike\Documents\Arduino\libraries\MySensors\MySensor.h:144:7: note: MySensor::MySensor(const MySensor&)
                              class MySensor
                              ^
                              C:\Users\mike\Documents\Arduino\libraries\MySensors\MySensor.h:144:7: note: candidate expects 1 argument, 2 provided
                              C:\Users\mike\Documents\Arduino\libraries\MySensors\MyGateway.cpp: In member function 'void MyGateway::begin(rf24_pa_dbm_e, uint8_t, rf24_datarate_e, void (
                              )(char
                              ))':
                              C:\Users\mike\Documents\Arduino\libraries\MySensors\MyGateway.cpp:44:20: error: 'setupRepeaterMode' was not declared in this scope
                              setupRepeaterMode();
                              ^
                              C:\Users\mike\Documents\Arduino\libraries\MySensors\MyGateway.cpp:87:39: error: 'setupRadio' was not declared in this scope
                              setupRadio(paLevel, channel, dataRate);
                              ^
                              C:\Users\mike\Documents\Arduino\libraries\MySensors\MyGateway.cpp:88:36: error: 'BASE_RADIO_ID' was not declared in this scope
                              RF24::openReadingPipe(WRITE_PIPE, BASE_RADIO_ID);
                              ^
                              C:\Users\mike\Documents\Arduino\libraries\MySensors\MyGateway.cpp:90:23: error: cannot call member function 'void RF24::startListening()' without object
                              RF24::startListening();
                              ^
                              Error compiling.

                              1 Reply Last reply
                              0
                              • TD22057T Offline
                                TD22057T Offline
                                TD22057
                                Hardware Contributor
                                wrote on last edited by
                                #20

                                @Michael-Hritz I don't think you're going to be able to copy headers from 1.5 into 1.x and ever get that to work - that's why they are different versions.

                                Did you sync via github instead of downloading the 1.5 zip? Then edit the IDE sketchbook location preferences to point at the downloaded files and compile. I just tried that with the ethernet sketch and it built with only a couple of warnings.

                                1 Reply Last reply
                                0
                                • Michael HritzM Offline
                                  Michael HritzM Offline
                                  Michael Hritz
                                  wrote on last edited by
                                  #21

                                  I'll try it tomorrow. I'm burned out for the day. My wife has some gin gimlets waiting for me. Thanks for the suggestion.

                                  1 Reply Last reply
                                  0
                                  • Michael HritzM Offline
                                    Michael HritzM Offline
                                    Michael Hritz
                                    wrote on last edited by
                                    #22

                                    I got around my earlier problem of “radio init fail” by setting the RF24_DATARATE to RF24_1MBPS (in MYSensor v1.5) as per instructions:
                                    http://forum.mysensors.org/topic/728/radio-setup-give-check-wires/30

                                    sonicblaze
                                    posted 8 months ago reply quote
                                    0

                                    @olaeke You might be able to get everything working over 1MBPS instead of the 250KBPS that's defaulted, as doctor64 suggested. I haven't tried it, but I found everywhere that'd have to be changed to make it work in theory.
                                    Edit <Ardunio libraries folder>/MySensors/Myconfig.h, and change the "RF24_DATARATE" to "RF24_1MBPS".
                                    Edit <Ardunio libraries folder>/MySensors/MySensor.cpp, and comment out lines 102-105 (the if isPVariant check)
                                    Recompile and upload new code to both your gateway and your sensor, and that should put them both in a mode compatible with the NRF24L01 sensor (to my best understanding/knowledge).

                                    But now, I’m getting a “ver mismatch” message. Is this because I’m only running the gateway and I’m not pairing it with a sensor node?
                                    It appears that I’m seeing mGetVersion returning 0 when PROTOCOL_VERSION is 2 .
                                    The taBle below shows where the version is set and gotten.

                                    Item Where used Lines
                                    mSetVersion MySensor.cpp 349,464
                                    mSetVersion MyMessage.h 179
                                    mGetVersion MySensor.cpp 590
                                    mGetVersion MyMessage.h 180

                                    1 Reply Last reply
                                    0
                                    • hekH hek

                                      @TD22057

                                      Because defines declared in the sketch isn't visible in the cpp files. The Arduino build system isn't exactly the best on the planet.

                                      TD22057T Offline
                                      TD22057T Offline
                                      TD22057
                                      Hardware Contributor
                                      wrote on last edited by
                                      #23

                                      @hek said:

                                      @TD22057
                                      Because defines declared in the sketch isn't visible in the cpp files. The Arduino build system isn't exactly the best on the planet.

                                      FYI: I found a trick here: http://gammon.com.au/forum/?id=12625 that allows for more normal C/C++ development while still using the Arduino IDE for builds. Basically you create an empty .ino file with any external library include files in it. The IDE will happily rewrite that file and pick up those libraries. Then you can put the regular code (loop(), setup(), etc) in another .c or .cpp file and it will work properly. So you can put #defines or definitions ahead of include files and they work since the IDE only rewrites the .ino file. I've started using this for a sketch I was writing because I needed an enum in the prototype of local functions which the IDE kept screwing up. Works great and still allows the IDE to be used for building/uploading.

                                      As far as MySensors goes, this would allow you to define the SOFT_SPI macro locally in the sketch and then include the files that use it which makes it a lot easier to maintain your code. Especially when I come back to this in a year and have to remember how I built everything.

                                      1 Reply Last reply
                                      0
                                      Reply
                                      • Reply as topic
                                      Log in to reply
                                      • Oldest to Newest
                                      • Newest to Oldest
                                      • Most Votes


                                      15

                                      Online

                                      11.7k

                                      Users

                                      11.2k

                                      Topics

                                      113.1k

                                      Posts


                                      Copyright 2025 TBD   |   Forum Guidelines   |   Privacy Policy   |   Terms of Service
                                      • Login

                                      • Don't have an account? Register

                                      • Login or register to search.
                                      • First post
                                        Last post
                                      0
                                      • MySensors
                                      • OpenHardware.io
                                      • Categories
                                      • Recent
                                      • Tags
                                      • Popular