Ethernet Gateway On Arduino Mega 2056 Issues
-
I have the SEEEDstudio ethernet shield W5200 and am using the ethernet gateway code found here. This works fine with SOFTSPI enabled under Mysensors v2 library on my UNO. However, when I build the code out for my Mega 2056 i get this error on the serial monitor:
0;255;3;0;9;Starting gateway (RNNGA-, 2.0.0) 0;255;3;0;9;TSM:INIT 0;255;3;0;9;!TSM:RADIO:FAIL 0;255;3;0;9;!TSM:FAILURE 0;255;3;0;9;TSM:PDT
What am I missing here?
-
The SPI Pins are different on the MEGA2560 than on a 328-Arduino.
How is your wiring of the NRF24L01+?
-
I am using the following hookup on the ethernet shield to the nrf+:
A2 --> MISO
A1 --> MOSI
A0 --> SCK
6 --> CSN
5 --> CE
-
@wergeld - Maybe this can give you some hints? https://forum.mysensors.org/topic/1245/building-an-ethernet-gateway-on-an-arduino-mega/3
-
@sundberg84
I had read that. But, to be honest I could not make heads or tails about what the posters said did or did not work. There was no definitive answer on that thread. Some said try pins x/y/z and other said to try a/b/c. Yet, no one said "hey, this actually works". Closest was the comment by spugna85. But, looking at the v2 libraries it was already done (hence me using A0-2 pins).
-
@wergeld - ok, to bad give google search a go, it might help you find other threads.
I cant help you more, not a mega user myself. By the way, ethernet gw works great on Uno or Nano as well.
-
@sundberg84
Yea, by my UNO is used for templating projects for my slimNode. I am only making the ethernet gateway because the direct-connection of the nrf to the RPi is not yet supporting v2 library. Just seems silly to include extra hardware (uno/mega and ethernet shield) when the RPi has GPIO and the nrf can be connected to it. I am using domoticz on the RPi using serial gateway but only with v1.4.
-
Try with following defines and wire accordingly:
#define MY_RF24_CE_PIN 40 #define MY_RF24_CS_PIN 53
-
@FotoFieber
Builds and still I get the error:0;255;3;0;9;Starting gateway (RNNGA-, 2.0.0) 0;255;3;0;9;TSM:INIT 0;255;3;0;9;!TSM:RADIO:FAIL 0;255;3;0;9;!TSM:FAILURE 0;255;3;0;9;TSM:PDT
-
I have this error also with a ENC28J60 module.
I have used the 1.6.8/9 and 11 ide but that doesn't matter.
This was on an Nano by the way.
-
@wergeld
My gateway is based on a mega 2560 with following wiring:40 CE
51 MOSI
50 MISO
52 SCK
53 CSNand the defines from above:
#define MY_RF24_CE_PIN 40 #define MY_RF24_CS_PIN 53
Do you have this wiring?
-
@FotoFieber, no. As I stated above this is my wiring:
A2 --> MISO A1 --> MOSI A0 --> SCK 6 --> CSN 5 --> CE
When I changed CSN/CE to the 2 pins you mentioned above it was and I was still getting this error:
A2 --> MISO A1 --> MOSI A0 --> SCK 53 --> CSN 40 --> CE
To use your wiring I would need to modify the rest of the pin definitions in the code, yes?
-
Wiring like this does not apply for the Mega 2056
A2 --> MISO
A1 --> MOSI
A0 --> SCKIf you see from here -> https://arduino-info.wikispaces.com/file/view/Mega2-900.jpg/421499040/Mega2-900.jpg
Pinout for Mega 2056:
51 MOSI
50 MISO
52 SCKYou need to change your wiring.
-
@korttoma, excellent! I will try this out when I get home from work.
-
@korttoma
Success! Got this ethernet gateway up and running! Thank you very much.