Uno+ethernet shield = radio init fail [solved]
-
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.