Closed bbernhard closed 2 years ago
Hi Bernhard,
Thanks for reporting this. I will try to set aside time tomorrow to reproduce and debug.
In the meantime, if you load the EthernetReset
sketch after running ReadNetworkSettings
, are you able to ping the server? Or does the device remain inaccessible over Ethernet?
Many thanks for the quick reply!
You were totally right with that one - loading EthernetReset
after ReadNetworkSettings
indeed fixed the problem.
I played a bit more with it and it seems that the ping stops working as soon as I upload any sketch (except the WriteNetworkSettings
and EthernetReset
sketch). After uploading the sketch, the ping stops working and the only thing that makes the ping work again is to run the EthernetReset
. Also tried to power cycle the device when it is in that state, but unfortunately that doesn't help.
For the other sketches, they are not configuring the Ethernet controller at all, so I'm not necessarily surprised that there's no ping. The EthernetReset
server does configure the ethernet hardware and starts a server, so I do expect that to work.
What is concerning to me (and has been reported by one other person) is that the bootloader only seems to be ping-able if we've run an EthernetReset server and told it to reboot into reprogramming mode. It does not seem to respond in my testing when I just boot the device into bootloader and try to ping it.
Digging into that problem is my next task.
Okay, I did a bit more testing and for some reason the official Arduino Ethernet Shield 2 (W5500) behaves different compared to another (cheaper) Arduino Shield (W5100).
My test workflow basically looked like this:
Board: Arduino Uno (Athena Bootloader)
Erase EEPROM: save
Version: Standard w/ Wiznet W5100
/ Standard w/Wiznet W5500
(depending on which Ethernet Shield I used for testing)
WriteNetworkSettings
sketchIf I do the above with the Arduino Uno + cheap Arduino Shield (W5100)
, I can ping the device after pressing the Reset
button on the Arduino Shield. If I just plug in the power supply, the device can't be pinged.
Next, I tried the above with the Arduino Uno + Arduino Shield (W5500)
. Here, I cannot ping the device at all (even after pressing the reset button on the Ethernet Shield).
I think I've found the issue with the Arduino Uno + cheap Arduino Thernet Shield (W5100)
.
Looks like the reset logic of the Arduino Ethernet shields is pretty crappy. The official Arduino Shield had some problems with it in revision 1, but according to this blog entry it should be fixed with Revision 2.
The cheap chinese manufactored Arduino Ethernet Shields aren't any better. I've found a few blog posts, where people are using RC networks to fix the issue. (see here. Unfortunately, this didn't work work for my Arduino Shield.
So, instead I removed the pin header which connects the Arduino RESET pin with the Ethernet Shield's RESET pin and connected it to a digital input of the Arduino.
When the Arduino starts, I manually reset the Ethernet Shield by calling this function in the setup
method:
void init_ethernet()
{
pinMode(RESET_ETH_SHIELD_PIN, OUTPUT);
digitalWrite(RESET_ETH_SHIELD_PIN, LOW);
delay(1000);
digitalWrite(RESET_ETH_SHIELD_PIN, HIGH);
delay(1000);
pinMode(RESET_ETH_SHIELD_PIN, INPUT);
delay(1000);
}
So far, I haven't had any problems with this. After connecting the power supply, I can immediately ping the device.
This seems (I still need to test it a bit more) to fix the issue with the cheap Arduino Ethernet Shield for me. Unfortunately, the issue with the official Arduino Ethernet Shield 2 still persists.
Hi @bbernhard - thanks for your detailed notes and investigations. I really appreciate that.
I will add some documentation around the ethernet reset pin, that is definitely useful for others to know.
Regarding the W5500, I'm going to dig into the initialization code. Given that the W5500 only responds to pings when the EthernetReset server sketch is used, I think that there might be a problem in the init routine in the bootloader. When I originally started using the parent project, I ran into a lot of problems with the W5500, which didn't function at all.
I'm currently swamped with some client work, but this is at the top of my list when I can get some time.
I seem to also be experiencing this problem when working with RoboDyn's Atmega2560 W5500 PoE board https://robotdyn.com/mega-2560-eth-r3-with-poe-atmega2560-w5500-micro-sd-card-reader-usb-uart-cp2104-225db671-8d99-11e8-9100-901b0ebb3621.html
I originally was not able to get the device to ping when flashing it. After seeing @bbernhard's posts above I added in a reset for the board to the sketches (EthernetServerReset, WriteNetworkSettings)
#define SS 10 //W5500 CS
#define RST 7 //W5500 RST
#define CS 4 //SD CS pin
void setup {
pinMode(SS, OUTPUT);
pinMode(RST, OUTPUT);
pinMode(CS, OUTPUT);
digitalWrite(SS, LOW);
digitalWrite(CS, HIGH);
/* If you want to control Reset function of W5500 Ethernet controller */
digitalWrite(RST,HIGH);
}
This seems to have alleviated part of the problem with not being able to ping the board. I am able to get everything to work from the network troubleshooting page, up until I send the reprogram command. The server accepts it but the device stops broadcasting it's IP and I have to hard reset to get it to broadcast again.
Not sure what else to try or do.
Thanks.
-Ryan
So I'm using an Arduino Mega with a Wiznet W5500 ethernet shield. I spent about 7 hours today working with the bootloader. I actually couldn't run into a case where my network settings were properly configured and I couldn't ping the device. I was able to both ping and upload images whether I cycled the USB connection, manually reset the board using the reset button, or placed it into update mode using the reset server path.
I'm a bit stumped at the moment.
In my case, whenever I reset the board while pinging it, I see ~2 pings miss, and then everything resumes properly.
Also, I did check the configuration using a power brick + no USB, that also operated properly
Sorry for the spam, but one final point pops up: I'm using the ReadNetworkSettings
sketch in my testing as well, which was problematic for @bbernhard. This caused no problems with my setup... In fact, I don't need to run the EthernetReset
example at all in order for the device to function; other sketches work fine. (In this case, I either perform a manual reset + upload, or I write to the EEPROM in the sketch and reset it to enable the upload)
I'm going to land a change that will allow you to specify a reset pin in the EEPROM. If this pin is set, the bootloader will perform a reset before initializing the chip.
Thank you for the most recent change @phillipjohnston regarding the Ethernet reset pin in EEPROM. Just got to testing today on my RoboDyn's Atmega2560 W5500 PoE board and it works wonderfully. Can successfully ping after reset and reprogram are triggered. Was also able to do a successful tftp of Blink to the board.
Hi,
first of all thanks for creating & maintaining this Ariadne fork - that's very much appreciated!
I just checked out the master branch and flashed my Arduino with the latest Athena bootloader. After that, I used the
WriteNetworkSettings
example to configure the MAC address, the IP address and the gateway. At that point, my Arduino can be pinged successfully - so everything seems to be working fine at that point.Next, I decided to use the
ReadNetworkSettings
example to read back the interface settings that I've configured. But although the program outputs the correct IP, MAC and gateway, the ping stops working as soon as theReadNetworkSettings
program is running.If I use the
WriteNetworkSettings
example again to configure my interface settings, the ping starts working again.I have the feeling that I am doing something wrong here, but I can't figure out what it is. Any help is really appreciated!
Thanks, Bernhard