Hi,
I am trying to run an SD Card and the WIZ820io Ethernet interface on an Arduino Mega 2560
Both work separately but as soon as I add
pinMode(10, OUTPUT);
digitalWrite(10, LOW);
the ethernet interface stops working
Hi,
I am trying to run an SD Card and the WIZ820io Ethernet interface on an Arduino Mega 2560
Both work separately but as soon as I add
pinMode(10, OUTPUT);
digitalWrite(10, LOW);
the ethernet interface stops working
Each device needs its own Slave Select line.
Typically these seem to D10 and D4 on shields.
Check what each device is using.
Hi
With just ethernet device plugged in I enabled the SS pin as an output even if i put it low it stops working, does the ethernet library control this because I had a look on an oscilloscope without mentioning the SS pin and it seemed to output 3.3V but drop it to low whenever there was communication between the two.
When I recently attached two SPI devices (SD Card and LCD) i noticed, that the chip select is not the only problem. Both devices (i mean their libs) did use a different and incompatible SPI setup. And both libs did this setup only during their lib startup phase. This forces me to save the SPI state of both libs and restore the settings, depending which device i want to access next.
Oliver
By "incompatible" do you mean that for example they use different clock edges or something?
If so you could re-run their .begin() funcs each time but that's a bit of a crappy way to do it. As you say you could remember the port state and change back and forth.
But the LCD is a slow device, why not use shiftOut() to talk to it or are you reading data from it as well?
Rob
Indeed the LCD (16x2, doglcd lib) uses Software SPI (something like shiftout). But SdFat makes use of the HW SPI. On the board both devices are connected to the same SPI pins (with different chip select signals). To use the doglcd lib, I had to disable the SPI subsystem. To use SdFat I had to restore the HW SPI .
Oliver
On the board both devices are connected to the same SPI pins
This doesn't make sense if one device is using software SPI. Just move the LCD to different pins if you have spare ones.
Rob
It turns out that if I set the SS pins for the SD.h lib and the Ethernet.h lib (4 and 10 respectively) then they don't work. However if I don't mention anything in the setup they work fine. And the oscilloscope confirms that all the selections seem to be done automatically. Aaaaannnnddd everything works together. XD
A good SPI library would change the SPI settings (clock mode, clock speed) automatically whenever necessary - not sure I've seen one that does this. You also have to ensure every device has its CS line high before any SPI transfers are performed.
The more fundamental problem with SPI libraries is when you want to use SPI in an interrupt routine (not unusual with RF transceivers for instance) - you then need to inhibit interrupts around other calls to the SPI primitives, or some other anti-collision scheme.
Find a better LCD library that uses real SPI.
mrjonny2:
I am trying to run [...] the WIZ820io Ethernet interface on an Arduino Mega 2560
Both work separately [...]
Hello mrjonny2
Can you tell me, please, in detail how you ran WIZ820io on Mega 2560?
WIZ820io is R1.0 ?!
What version of the IDE, Mega, WIZ, libraries, etc...
Pins to pins connection, plz
Thanks!!!
Hi
Sorry for sporadic replies, exam period and all ;(
I am using the module with a 2560 at the moment.
The pinout I am using is:
MISO - 50
MOSI - 51
SCLK - 52
nSS - 10
I am using an arduino mega pro (3.3V version from spark fun)
Version 1.0 of the IDE
Make sure you give it 3.3V Power
Make sure you have the updated libraries - http://www.wiznettechnology.com/sub_modules/en/product/Product_Detail.asp?cate1=5&cate2=42&cate3=0&pid=1161#tab
I can't remember if there were any other changes I had to make to the library, because I had some error messages thrown up but I can't remember what they were. Let me know if you have any other problems.
Hello friends.
You are just the greatest.
Now I have searched and searched for how to do and then I came to your thread. and now it works. IIIIIIHHHAAAAAAAAA many thanks for that you are here XD XD XD XD