Go Down

Topic: Ethernet shield (SPI) data garbled (Read 559 times) previous topic - next topic

Mario_H

Gents,

My official Wiznet Ethernet shield http://arduino.cc/en/Main/ArduinoEthernetShield is driving me crazy.
I've loaded the client sample form the library, modified the top section as shown below but 99 out 100 times it will not work.
Code: [Select]

byte mac[]     = { 0x90, 0xA2, 0xDA, 0x00, 0x06, 0xFA };   // Ethernet shield MAC address
byte ip[]      = { 192, 168, 1, 3 };                       // Ethernet shield IP address
byte gateway[] = { 192, 168, 1, 254 };                     // DSL router
byte subnet[]  = { 255, 255, 255, 0 };                     // Subnet mask
byte server[]  = { 192, 168, 1, 79};                     // Ubuntu LAMP server on internal lan

A laptop connected to the same Ethernet cable that plugs into the shield works just fine so I'm quite sure the LAN itself isn't the problem.
My setup is a ATMEGA328 on a breadboard (tried different breadboards). I do not have a Duemilanove available to do stacked tests. IDE communication is over a USB/Serial converter that works flawless.
I've connected the Ethernet shield using some ribbon cable to the breadboard (SPI pins 10,11,12,13 and gnd and 5 V
The breadboard is powered over USB while the Ethernet shield is powered by a separate power supply. Shield gnd and breadboard gnd are connected.

The problem I have is that most of the time I get a connect failure. Sometimes I do get a connect status, but no data from the remote web server.
This problem also occurs when trying to connect to external servers like Google so this excludes my LAMP server from being the problem.
Yesterday I installed Ethereal http://www.ethereal.com/ to monitor the data going over the lan and noticed that the board is sending out complete garbage most of the time.
After every reset (of the ATMEGA328) I see the shield using a different Mac and IP address and most of the time the mac is 00:00:00:00:00:00
The IP often contains some of the digits of the IP I've put in the sketch (192.168.1.3) but hardly ever is correct.

What I also noticed is that when I use a 10 inch (0.05" spacing) ribbon cable to connect the SPI bus it performs worse than a 0.1" spacing ribbon cable of the same length.
Separate loose wires perform about the same as the 0.1" spacing ribbon cable.

Does anyone have a clue what is going on here?
Is it a problem with the SPI connection (length/cable type) or do I just have a bad Ethernet shield?

Thanks,

Mario

Go Up