Pages: 1 [2]   Go Down
Author Topic: Mighty 1284p SPI / Ethernet how to get it work ?  (Read 2540 times)
0 Members and 1 Guest are viewing this topic.
Global Moderator
Offline Offline
Brattain Member
*****
Karma: 452
Posts: 18694
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Well there is good news and bad news.

The good news is, I've reproduced your problem. smiley

The bad news is, the fix is not totally working. smiley-sad

I hooked up my 1284P to my Ethernet Shield Rev 3, and found that (using the logic analyzer) although the signals were going out as expected, nothing was coming back.

Then I took a closer look and realized that the shield is designed to interface with the ICSP header (underneath) rather than pins 10/11/12/13 because it is designed to be plugged into other boards, like the Mega.

So I moved SCK, MISO, MOSI to the ICSP header.

Code:
       Atmega1284P    Ethernet Shield

SS     pin 5  (D4)      D10 on the shield
MOSI   pin 6  (D5)        ICSP pin 4
MISO   pin 7  (D6)        ICSP pin 1
SCK    pin 8  (D7)        ICSP pin 3

Now at least it got a response. But still rather flaky. It didn't hang on the connection any more. Just "failed".

I made the change I mentioned to the w5100.h file. I experimented with slowing down SPI:

Code:
  // start the Ethernet connection:
  Ethernet.begin(mac, ip);
  SPI.setClockDivider(SPI_CLOCK_DIV16);   // slow down SPI

It connected a couple of times, it got data back a couple of times. You may have more luck with your wiring. I think I have a lot of noise here, I am having trouble uploading the sketch.

This should get you closer.
Logged

Global Moderator
Offline Offline
Brattain Member
*****
Karma: 452
Posts: 18694
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Further to the above, it appears that during testing I crashed the server I was connecting to. So it might be more reliable if you implement all those changes. Maybe. smiley
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 23
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Was any solution to this ever found? I'm experiencing the same with 1284P. I tried both Calunium and Mighty1284 with the same result: a hanging 1284P when I call ethernet.begin(...)
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 23
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I found that the issue only exists when attempting to use DHCP.
Logged

ca
Offline Offline
Jr. Member
**
Karma: 0
Posts: 63
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I just got back from summer hollidays, sorry for not giving back any infos soon after Nick sent his message about a fix. I did not had time to tried.
Really, only DHCP does that ? i tried both fixed IP and DHCP and the result was the same. IIRC last month test.

I found that the issue only exists when attempting to use DHCP.
Logged

Rapa Nui
Offline Offline
Edison Member
*
Karma: 53
Posts: 1991
Pukao hats cleaning services
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Do you have enough power to run the ethernet chip ? - I've seen somewhere it takes up to 180mAps of current while operating (crash at eth.begin??) - check your power generators first.. smiley
p.
« Last Edit: August 08, 2012, 07:30:04 pm by pito » Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 23
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Power should be fine; I had the same circuitry for a 328P-based setup where the same ethernet (wiz820io) module was working fine.

When using a static IP, the atmega does not freeze and I can ping the device from my local PC. The hanging only occurs when calling ethernet.begin() to fetch an IP address from the local DHCP server.

I'm on Arduino 1.0.1 btw.
« Last Edit: August 09, 2012, 01:29:00 am by kfuglsang » Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 23
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I spent some more time on it this morning.

I created a small LAN, straight between my laptop (acting as a DHCP server) and the Wiz820io module. I found that the atmega does in fact not hang; it just never receives a DHCP response.

Using WireShark I found that the laptop never receives a DHCP request. I added some Serial.print()'s in the DHCP.cpp code to verify that send_DHCP_MESSAGE() is called and executed.

The Atmega continues within the parseDHCPResponse() function and loops continously within the loop:
Code:
while (_dhcpUdpSocket.parsePacket <= 0) { ... }
until the responseTimeout is exceeded. After this, the process happens again, still with no DHCP request sent across the wire.
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 23
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Further debugging reveals that using a static IP  I can:
- ping the Atmega from my laptop
- send UDP packet to my laptop (using my laptop's specific IP)
- send UDP broadcast packet and receive it on the laptop

All verified using Wireshark.

Nothing is transferred when I try to use DHCP. My laptop has a DHCP server running, verified working using another PC.

EDIT: Further debugging. Finally saw DHCP requests coming to the PC. Unfortunately, it seems very shaky and I never had it complete the DHCP negotiation.

EDIT2: After letting it run for an extended period I saw it connect a few times and start to send some UDP packets (I added that in the loop() function). Each time when it has connected, it rebooted after 10-15 seconds.
Could it be an issue with my power supply, noise or something else?
« Last Edit: August 09, 2012, 08:13:14 am by kfuglsang » Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 23
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

This morning I tried to use a static IP and let it send an UDP broadcast for every second, while also outputting the IP address of the W5200 module.

I noticed that all of a sudden, perhaps after 10-20 seconds, the IP address starts to change sporadically and packets are no longer being transferred. After this, I need to restart the Arduino to get it working again.

I verified my power supply as well. 5.1v being supplied to the atmega1284p (data sheet specifies 4.5-5.5v for 16MHz operation) and 3.28v going to the Wiz820io.

 smiley-eek
Logged

Rapa Nui
Offline Offline
Edison Member
*
Karma: 53
Posts: 1991
Pukao hats cleaning services
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

What type of voltage regulator for 3.3V do you use?
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 23
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

It's a LM1117-3.3.
« Last Edit: August 10, 2012, 05:42:10 am by kfuglsang » Logged

Pages: 1 [2]   Go Up
Jump to: