Open
Description
I'm using this library in PlatformIO on STM32F401 with both W5100 and W5500. In my application I'm using HTTP server and WebSocket server - that's where I've discovered this issue. When I have WS connected and I'm sending some HTTP requests, it randomly gets stuck in this loop, just stays there forever. SnIR
returns 0
and SnSR
returns 0x14
.
I've managed to replicate the issue with just this piece of code:
#include <Ethernet.h>
byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED };
EthernetServer server{23};
void setup() {
Ethernet.init(PB6);
Ethernet.begin(mac);
server.begin();
}
void loop() {
auto client = server.accept();
while (true) {
if (client) {
client.write("xxx");
client.write("xxx");
} else {
break;
}
delay(10);
}
}
This fails 100% of the time, just quicker than my main app, like in 1-10 seconds.
My observations:
- when I keep only one
client.write("xxx");
, it looks like it works just fine (I waited for just like 20 minutes, not too long) - when I connected two clients and was alternating the writing between them, it also looked stable
I don't know if I'm just doing something wrong or if this is a bug in this library / in STM SPI / in Wiznet / ...
Any ideas please?
Thanks!