arduino-libraries / Ethernet

Ethernet Library for Arduino
http://arduino.cc/
254 stars 257 forks source link

Library causes memory corruption #112

Open gschaden opened 5 years ago

gschaden commented 5 years ago

When using this library I got strange behavior in combination with my timer interrupt code.

Calling EthernetUDP::parsePacket in loop modified my IO registers somtimes. I could not find the root cause, it seems to be time critical. Calling this function with delay seems to make the issue to occur less often. The problem is not related to reading data from the network just checking for the availability of data shows the problem.

Using the library from https://github.com/Wiznet/WIZ_Ethernet_Library solved the problem.

Basically it is a Atmega 328p with the w5500 very similar to an arduino nano with w5500 shield but with chip select on pin 5 not on pin 10.

I will try to reduce the code to the bare limit still causing the problem

SapientHetero commented 5 years ago

When you say "modified my IO registers sometimes" do you mean W5500 registers or processor registers? If W5500, which specific register(s) were affected?

PaulStoffregen commented 5 years ago

For that matter, which processor or board was used?

@gschaden - can you give us more details? How about a complete program which calls parsePacket() and together with step-by-step instructions for sending the UDP packets to the board+shield, demonstrates this problem?