Uno+ethernet shield = radio init fail [solved]
-
@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.
-
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?
-
-
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.
-
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.
-
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.
-
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 MyTransportNRF240;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.
-
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. -
@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.
-
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.
-
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/30sonicblaze
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 -
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.
@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.