I’m encountering an issue with a custom ATmega2560 board utilizing the W5500 Ethernet module. The device functions as a TCP server, receiving serial data and forwarding it to connected clients (like a laptop). However, I’ve noticed that whenever a TCP session is in progress and I disconnect the Ethernet cable, upon reconnecting it, the device fails to resume normal operation. Strangely, if there’s no TCP connection ongoing, the device handles cable disconnection and reconnection just fine.
Based on my observations, it seems like the microcontroller might be crashing when this occurs. I’m puzzled because I’m unable to pinpoint how the W5500 could be causing the microcontroller to crash. Additionally, I’m using an Ethernet bootloader, and I’ve noticed that when I disconnect and reconnect the Ethernet cable during a TCP session with data exchange, I can still ping the bootloader’s IP address.
Has anyone experienced a similar issue or have any insights into what might be causing this behavior? I’d greatly appreciate any guidance or suggestions to troubleshoot and resolve this issue.
What i mean by not resuming operation is that the microcontroller is going out of normal operation and getting stuck in the bootloader section ( as i am able to ping the bootloader IP address).
Not proceeding with loading the user program is a separate issue I think because there is continuous data on serial port and it is making the bootloader stuck thinking that some data will come. This is my assumption.
Do you drive W5500 from boot loader? I suspect you must do it from user space, and the fact that something going on the serial port(s) should not bother bootloader unless it uses those same port(s) for its purposes (e.g. console).
Hi,
I’m sorry i do not have my setup currently but as far as I understand the bootloader deals with w5500. It is a bootloader to upload code via ethernet. It waits for 10 seconds for TFTP request on a 192.168.1.128 IP address. https://github.com/loathingKernel/ariadne-bootloader
Whenever my code stops doing what o expect it to do, it starts to respond to ping on this particular IP address.
The serial port is used by the bootloader. It can load user program from both the serial port and the ethernet port.
Normally it is not a problem as the serial device starts after my board so it doesn’t send any data when the system is powered up.
But after the ethernet cable disconnection and IF the controller gets into the bootloader section as I am assuming then the data keeps on coming on the serial port and keeps it stuck there.
Again, i know it has to be proved. I am just stating my intuition. I will do further tests tomorrow and let you know
It seems my microcontroller code was crashing when I removed the LAN or closed TCP session because of a memory leak which was happening if the data coming on serial port was not being processed.
After crashing, it would normally had restarted, but the bootloader was somehow getting confused because of continuous data coming on the serial port and thinking that a code upload is happening. ( This is my assumption, I am unable to modify the bootloader to close the serial port upload till now)