I'm trying to use an Arduino Ethernet board to capture some data on the SPI pins and thereafter uploading them to a webservice. It seems like the board working ok as a SPI slave until I call Ethernet.begin(). Is there a way to disable ethernet?
Another related question is why Ethernet.begin() has to be called in setup? If I move the call to the main loop ethernet stops working.
Haven't used an Arduino Ethernet board, but have used the shield. Pin 10 is slave select for the W5100 Ethernet chip and pin 4 is SS for the SD card. So be sure to de-select both devices (i.e. make their SS pins high) before trying to use another device on the SPI bus. I believe this functionality is the same for the board vs. the shield.
NB: Pins 10, 11, 12 and 13 are reserved for interfacing with the Ethernet module and should not be used otherwise.
Not sure why that would be. Pins 4 and 10 certainly aren't available as they're dedicated SS, but I'd think that other SPI devices could share the bus, i.e. pins 11, 12, 13, but they'd also need their own SS pin. I'd want to (a) Logically close out all Ethernet activity, then (b) Deselect the device by driving pin 10 high. Only one SPI device can be active at a time.
There is no reason that Ethernet.begin() has to be called from any particular place. It may or may not make sense for it to be in the main loop, depending on the logic. It's certainly not something I'd expect to be calling again and again in rapid succession.