Ethernet Gateway problem
-
In doing research on this I came across:
https://github.com/nicoverduin/rf24
Didn't know whether you all considered his implementation, but appears to have the same objective of allowing for softSPI on the radio. -
Am getting a compile error on this line in RF24.h:
SoftSPI<SOFT_SPI_MISO_PIN, SOFT_SPI_MOSI_PIN, SOFT_SPI_SCK_PIN, SPI_MODE> spi;
error: ISO C++ forbids declaration of 'SoftSPI' with no type
error: expected ';' before '<' token -
Am getting a compile error on this line in RF24.h:
SoftSPI<SOFT_SPI_MISO_PIN, SOFT_SPI_MOSI_PIN, SOFT_SPI_SCK_PIN, SPI_MODE> spi;
error: ISO C++ forbids declaration of 'SoftSPI' with no type
error: expected ';' before '<' token -
Double checked. Yes I have.
-
Hum...then I cannot think of anything more than that I had to change (because I made that mistake and the error message looks familiar).
But if you are patient a while longer, I will push a patch to githup with a fix for the ethernet gateway sketch so it works with HW SPI. I have confirmed it now. -
Figured it out and had a successful compile. Did not have my digital IO Lib properly set up. Now to download and test on the gateway!
-
Compiled successfully and downloaded. But doesn't show any signs of operation when plugged in. Guess I will wait for your patch.
-
My patch is now merged to the development branch.
Note that I had to increase the SPI clock divider to get it to work on my breadboard. This might not be needed for everybody, but in case you cannot get it to work, it might be worth a try on that.
For details, see here: -
I looked at your new gateway sketch and noted you use pin 4 f0r Ethernet enable. According to arduino Ethernet shield documentation, pin 4 is used for writing to the sd card on the shield. You select the W5100 with pin 10 and the sd card with pin 4. So if you have an Ethernet shield, should you be using pin 10 to select and deselect the W5100 instead of pin 4 as you do in your breadboard setup?
-
I looked at your new gateway sketch and noted you use pin 4 f0r Ethernet enable. According to arduino Ethernet shield documentation, pin 4 is used for writing to the sd card on the shield. You select the W5100 with pin 10 and the sd card with pin 4. So if you have an Ethernet shield, should you be using pin 10 to select and deselect the W5100 instead of pin 4 as you do in your breadboard setup?
-
I looked at your new gateway sketch and noted you use pin 4 f0r Ethernet enable. According to arduino Ethernet shield documentation, pin 4 is used for writing to the sd card on the shield. You select the W5100 with pin 10 and the sd card with pin 4. So if you have an Ethernet shield, should you be using pin 10 to select and deselect the W5100 instead of pin 4 as you do in your breadboard setup?
@Dan-S. I checked again, and I actually think you mixed two things here. I use pin 10, it is the slave select signal for the ethernet shield/module.
It is not to be confused with the SPI_EN signal, which is more of a free-standing GPIO. It could be that having that signal on D4 makes it incompatible with certain shields, but you cannot use pin 10, because that is reserved for SPI slave select on the ethernet shield (and therefore the library).
SPI_EN and SS is not the same thing. And on a Nano D4 is the only one left unless you want to use an analog pin, one of the UART pins or one of the interrupt-pins. I picked D4 since I use a Nano (and the MySensors site reports the Nano as the "officially supported" option). But I did try to make it possible to change this without having to hack the code, so I hope you can still make use of the patch (or create a new pull request for @hek to consider). -
Did get in my W5100 Ethernet Module yesterday and checking some documentation I think the key to get things working is:
- Check if the Slave Select signal is connected to the SPI_EN pin (pin 31) of the W5100 or the /SCS pin (pin 29).
- If connected to /SCS pin (pin 29) sharing the SPI bus will not work
- If connected to SPI_EN pin (pin 31) sharing the SPI bus should work but SPI_EN is active high where /SCS is active low
- Make sure the wires connecting the module are not too long or clock down the SPI clock
I ordered the W5100 Ethernet Module as on the website from alice1101983 and got a red board with funduino on it with pinning:

Checked the board but I see no invertor IC on it so I think NSS is connected to /SCS pin (pin 29). Too bad.
I think the shopping list should be updated to a board that has SPI_EN pin (pin 31) connected.
-
Hm. But I ordered my W5100 modile from the "store" and it has the SPI_EN signal. But I do not think it has POE on the other hand. I think it since then has been replaced with a different module on the store though.
This is the one I got. -
Did get in my W5100 Ethernet Module yesterday and checking some documentation I think the key to get things working is:
- Check if the Slave Select signal is connected to the SPI_EN pin (pin 31) of the W5100 or the /SCS pin (pin 29).
- If connected to /SCS pin (pin 29) sharing the SPI bus will not work
- If connected to SPI_EN pin (pin 31) sharing the SPI bus should work but SPI_EN is active high where /SCS is active low
- Make sure the wires connecting the module are not too long or clock down the SPI clock
I ordered the W5100 Ethernet Module as on the website from alice1101983 and got a red board with funduino on it with pinning:

Checked the board but I see no invertor IC on it so I think NSS is connected to /SCS pin (pin 29). Too bad.
I think the shopping list should be updated to a board that has SPI_EN pin (pin 31) connected.
@daulagari I have seen HW patches that solves the SPI_EN problem by putting an inverter on the SCS signal, thus automatically enables the SPI bus on the W5100 if SCS is asserted. That should have been put on the module in the first place, but for those who are unfortunate to have a W5100 module without the SPI_EN and no "management" of SPI_EN, that might be a option to consider. A description for how to modify the "standard" shield is here.
-
@Anticimex : Yes, the module I got is definitely different.
A hardware patch will be very difficult I think because the pins of the devices are spaced very close to each other and I do fear the SPI_EN pin (pin 31) is not going to a net. Will have a look Monday in the office where we have a magnifying binocular.
But, suppose I have access to the SPI_EN pin, then I would hope an additional invertor would not be needed, Arduino should be able to invert the select signal I hope.
-
@Anticimex : Yes, the module I got is definitely different.
A hardware patch will be very difficult I think because the pins of the devices are spaced very close to each other and I do fear the SPI_EN pin (pin 31) is not going to a net. Will have a look Monday in the office where we have a magnifying binocular.
But, suppose I have access to the SPI_EN pin, then I would hope an additional invertor would not be needed, Arduino should be able to invert the select signal I hope.
@daulagari Yep, if you can get SPI_EN on a pin, the Arduino can manage it. That is what my fix has implemented. But it "cost" one Arduino pin and adds some complexity to the sketch (if one does not pay attention, moving around stuff in the sketch might break the signal management with ethernet vs rf).
-
Did get in my W5100 Ethernet Module yesterday and checking some documentation I think the key to get things working is:
- Check if the Slave Select signal is connected to the SPI_EN pin (pin 31) of the W5100 or the /SCS pin (pin 29).
- If connected to /SCS pin (pin 29) sharing the SPI bus will not work
- If connected to SPI_EN pin (pin 31) sharing the SPI bus should work but SPI_EN is active high where /SCS is active low
- Make sure the wires connecting the module are not too long or clock down the SPI clock
I ordered the W5100 Ethernet Module as on the website from alice1101983 and got a red board with funduino on it with pinning:

Checked the board but I see no invertor IC on it so I think NSS is connected to /SCS pin (pin 29). Too bad.
I think the shopping list should be updated to a board that has SPI_EN pin (pin 31) connected.
On:
I think the shopping list should be updated to a board that has SPI_EN pin (pin 31) connected.
Looking at ebay I think for now the Ethernet Shield W5100 is a better option:
- SPI_EN pin (pin 31) connected to the /SCS pin (pin 29) using an invertor
- Additional micro-SD card slot
- Even cheaper
Drawback is the size but that should not be a problem for a gateway I think. It is a pity shipment takes long.
I you want the same form factor, the WIZnet W5500 Ethernet Module - WIZ550io seems a better choice. Can not find it on ebay but at Antratek the price is reasonable.
@Anticimex : Thanks! Good to know what exactly your fix is doing, did not have a look it yet.
-
@Dan-S. I checked again, and I actually think you mixed two things here. I use pin 10, it is the slave select signal for the ethernet shield/module.
It is not to be confused with the SPI_EN signal, which is more of a free-standing GPIO. It could be that having that signal on D4 makes it incompatible with certain shields, but you cannot use pin 10, because that is reserved for SPI slave select on the ethernet shield (and therefore the library).
SPI_EN and SS is not the same thing. And on a Nano D4 is the only one left unless you want to use an analog pin, one of the UART pins or one of the interrupt-pins. I picked D4 since I use a Nano (and the MySensors site reports the Nano as the "officially supported" option). But I did try to make it possible to change this without having to hack the code, so I hope you can still make use of the patch (or create a new pull request for @hek to consider).@Anticimex Thanks for correcting me, still learning all the hardware idiosyncrasies. I always thought I had some hardware issue since my gateway would work for about an hour and then quit. Yesterday my radio (with antenna) died completely. Replaced it with a standard radio and the gateway has been working continuously since last night. So I must be one of the lucky ones to have a ethernet shield that works with the standard sketch (which I reverted back to)
-
I take that back. Looks like the radio not working again--just lasted longer this time. Will make another try at soft spi.
-
My soft spi version is up and running. Didn't work at first (Vera lua errora) till I read that you moved gw.begin in setup() to be done after the delay(1000). After doing that I was up and running. Will keep my fingers crossed for long term reliability.