<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[WebServer errors - Core Basic + LAN 13.2 (W5500)]]></title><description><![CDATA[<p dir="auto">Hi all,<br />
I have a webserver project in PlatformIO where i want to use the Core Basic together with LAN Module 13.2 (w5500). When I run the code below, I run into several problems:</p>
<ol>
<li>Wrong webserver IP. If I restart M5Stack with restart button, sometimes gives a different ip address to the server than what I add in setup(). This wrong IP are always 0.0.0.0, 192.168.0.176, 192.168.0.177, 192.168.1.176</li>
<li>Client crash. When I can connect the device through ethernet cable and I received HTML page with 5 second autorefresh on pc. Client crash a few minute later.</li>
</ol>
<p dir="auto">This code is M5Stack LAN 13.2 example from here: <a href="https://github.com/m5stack/M5Module-LAN-13.2/tree/main/examples/WebServer" target="_blank" rel="noopener noreferrer nofollow ugc">https://github.com/m5stack/M5Module-LAN-13.2/tree/main/examples/WebServer</a> with minor changes. (direct ip and refresh_counter)</p>
<p dir="auto">Any help of advice would be gratefully received. I've tried looking online but can't seem to find anything!</p>
<p dir="auto">#include &lt;Arduino.h&gt;<br />
#include &lt;M5Unified.h&gt;<br />
#include &lt;M5GFX.h&gt;<br />
#include &lt;SPI.h&gt;<br />
#include &lt;M5Module_LAN.h&gt;</p>
<p dir="auto">#define THEME_COLOR 0x0760</p>
<p dir="auto">uint8_t cs_pin;<br />
uint8_t rst_pin;<br />
uint8_t int_pin;</p>
<p dir="auto">byte mac[] = {0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0x89};<br />
IPAddress ip(192, 168, 1, 177);<br />
IPAddress dns(192, 168, 1, 1);<br />
IPAddress sn(255, 255, 255, 0);<br />
IPAddress gw(192, 168, 1, 1);</p>
<p dir="auto">M5Module_LAN LAN;<br />
EthernetServer server(80);</p>
<p dir="auto">int screen_height;<br />
int screen_width;<br />
int refresh_counter;</p>
<p dir="auto">void setup() {<br />
M5.begin();<br />
M5.Display.begin();<br />
M5.Display.setTextDatum(middle_center);<br />
M5.Display.setTextColor(WHITE);<br />
M5.Display.setTextFont(&amp;fonts::FreeSansBoldOblique18pt7b);<br />
screen_height = M5.Display.height();<br />
screen_width  = M5.Display.width();<br />
M5.Display.fillSmoothRoundRect(2, screen_height / 2 - 20, screen_width - 4,<br />
40, 4, THEME_COLOR);<br />
M5.Display.drawString("Wait For Ethernet", screen_width / 2,<br />
screen_height / 2);</p>
<pre><code>m5::board_t board = M5.getBoard();
switch (board) {
    case m5::board_t::board_M5Stack: {
        cs_pin  = 5;
        rst_pin = 0;
        int_pin = 35;
    } break;
    case m5::board_t::board_M5StackCore2: {
        cs_pin  = 33;
        rst_pin = 0;
        int_pin = 35;
    } break;
    case m5::board_t::board_M5StackCoreS3: {
        cs_pin  = 1;
        rst_pin = 0;
        int_pin = 10;
    } break;
}

SPI.begin(SCK, MISO, MOSI, -1);

LAN.setResetPin(rst_pin);
LAN.reset();
LAN.init(cs_pin);
LAN.begin(mac, ip, dns, gw, sn);


// start the server
server.begin();
Serial.print("server is at ");
Serial.println(Ethernet.localIP());

M5.Display.drawString("server is at:", screen_width / 2,
                      screen_height / 2 - 40);
M5.Display.fillSmoothRoundRect(2, screen_height / 2 - 20, screen_width - 4,
                               40, 4, THEME_COLOR);
M5.Display.drawString(Ethernet.localIP().toString().c_str(),
                      screen_width / 2, screen_height / 2);
</code></pre>
<p dir="auto">}</p>
<p dir="auto">void loop() {<br />
// listen for incoming clients<br />
EthernetClient client = server.available();<br />
if (client) {<br />
Serial.println("new client");<br />
// an http request ends with a blank line<br />
boolean currentLineIsBlank = true;<br />
while (client.connected()) {<br />
if (client.available()) {<br />
char c = client.read();<br />
Serial.write(c);<br />
// if you've gotten to the end of the line (received a newline<br />
// character) and the line is blank, the http request has ended,<br />
// so you can send a reply<br />
if (c == '\n' &amp;&amp; currentLineIsBlank) {<br />
// send a standard http response header<br />
client.println("HTTP/1.1 200 OK");<br />
client.println("Content-Type: text/html");<br />
client.println(<br />
"Connection: close");  // the connection will be closed<br />
// after completion of the<br />
// response<br />
client.println("Refresh: 5");  // refresh the page<br />
// automatically every 5 sec<br />
client.println();<br />
client.println("&lt;!DOCTYPE HTML&gt;");<br />
client.println("&lt;html&gt;");<br />
client.print("&lt;h2&gt;Hello M5Stack LAN Module! Refresh count: " + String(refresh_counter) + "&lt;/h2&gt;");<br />
client.println("&lt;/html&gt;");<br />
refresh_counter++;<br />
break;<br />
}<br />
if (c == '\n') {<br />
// you're starting a new line<br />
currentLineIsBlank = true;<br />
} else if (c != '\r') {<br />
// you've gotten a character on the current line<br />
currentLineIsBlank = false;<br />
}<br />
}<br />
}<br />
// give the web browser time to receive the data<br />
delay(1);<br />
// close the connection:<br />
client.stop();<br />
Serial.println("client disconnected");<br />
}<br />
}</p>
]]></description><link>https://community.m5stack.com/topic/6200/webserver-errors-core-basic-lan-13-2-w5500</link><generator>RSS for Node</generator><lastBuildDate>Sat, 14 Mar 2026 10:01:31 GMT</lastBuildDate><atom:link href="https://community.m5stack.com/topic/6200.rss" rel="self" type="application/rss+xml"/><pubDate>Wed, 13 Mar 2024 11:49:33 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to WebServer errors - Core Basic + LAN 13.2 (W5500) on Fri, 22 Mar 2024 11:23:13 GMT]]></title><description><![CDATA[<p dir="auto">Hello <a class="mention plugin-mentions-user plugin-mentions-a" href="https://community.m5stack.com/uid/86142">@kokany</a></p>
<p dir="auto">interesting... and thank you for sharing.</p>
<p dir="auto">Thanks<br />
Felix</p>
]]></description><link>https://community.m5stack.com/post/24531</link><guid isPermaLink="true">https://community.m5stack.com/post/24531</guid><dc:creator><![CDATA[felmue]]></dc:creator><pubDate>Fri, 22 Mar 2024 11:23:13 GMT</pubDate></item><item><title><![CDATA[Reply to WebServer errors - Core Basic + LAN 13.2 (W5500) on Fri, 22 Mar 2024 11:04:54 GMT]]></title><description><![CDATA[<p dir="auto">Hello <a class="mention plugin-mentions-user plugin-mentions-a" href="https://community.m5stack.com/uid/4037">@felmue</a></p>
<p dir="auto">Finally I solved the problem.</p>
<p dir="auto">The solution is as follows:<br />
in libdeps M5-Ethernet\src\utility\w5100.h must modify SPISettings clock param to 8000000. (in line 21-22)</p>
<p dir="auto">It's working fine now.</p>
<p dir="auto">Thanks for everything<br />
Tom</p>
]]></description><link>https://community.m5stack.com/post/24529</link><guid isPermaLink="true">https://community.m5stack.com/post/24529</guid><dc:creator><![CDATA[kokany]]></dc:creator><pubDate>Fri, 22 Mar 2024 11:04:54 GMT</pubDate></item><item><title><![CDATA[Reply to WebServer errors - Core Basic + LAN 13.2 (W5500) on Fri, 15 Mar 2024 19:46:36 GMT]]></title><description><![CDATA[<p dir="auto">Hello <a class="mention plugin-mentions-user plugin-mentions-a" href="https://community.m5stack.com/uid/86142">@kokany</a></p>
<p dir="auto">hmm, I see. Well, at this point I am out of ideas, sorry.</p>
<p dir="auto">Thanks<br />
Felix</p>
]]></description><link>https://community.m5stack.com/post/24407</link><guid isPermaLink="true">https://community.m5stack.com/post/24407</guid><dc:creator><![CDATA[felmue]]></dc:creator><pubDate>Fri, 15 Mar 2024 19:46:36 GMT</pubDate></item><item><title><![CDATA[Reply to WebServer errors - Core Basic + LAN 13.2 (W5500) on Fri, 15 Mar 2024 09:09:25 GMT]]></title><description><![CDATA[<p dir="auto">Hello <a class="mention plugin-mentions-user plugin-mentions-a" href="https://community.m5stack.com/uid/4037">@felmue</a></p>
<p dir="auto">Of course, I'm already beyond what you advised. I add timeout counter inside while loop, if client not available. It exits the while loop after 10 timeouts. After that the client is connected, but it never available again.<br />
If I trun off the device for some minutes and turn on, it work again for 3-5 refresh cycle.<br />
If I trun off the device for some hours and turn on, it work again for 10-15 minutes.<br />
This phenomenon is very interesting and I don't understand how it can be.</p>
<p dir="auto">I checked network tab on development window of browser. The request sent but not received and it pending "forever".</p>
<p dir="auto">I know it's unbelievable, but I can conjure up these phenomena at any time.<br />
I tested it on 2 different M5Stack Basic Cores, 2 different Lan 13.2 modules, on 2 different laptops with 4 different browsers. The device and the laptop are always connected directly, there is no router or switch between them. I used the power supply from usb and adapter.</p>
<p dir="auto">Thanks<br />
Tom</p>
]]></description><link>https://community.m5stack.com/post/24396</link><guid isPermaLink="true">https://community.m5stack.com/post/24396</guid><dc:creator><![CDATA[kokany]]></dc:creator><pubDate>Fri, 15 Mar 2024 09:09:25 GMT</pubDate></item><item><title><![CDATA[Reply to WebServer errors - Core Basic + LAN 13.2 (W5500) on Thu, 14 Mar 2024 13:00:25 GMT]]></title><description><![CDATA[<p dir="auto">Hello <a class="mention plugin-mentions-user plugin-mentions-a" href="https://community.m5stack.com/uid/86142">@kokany</a></p>
<p dir="auto">I have the code running for more than two hours now - with no issues.</p>
<p dir="auto">That said, your debugging suggests a case where a client (browser) connects but then never sends any data which keeps the execution locked up inside the while loop. I guess you'll need to look into some measures to make the code more robust. Maybe try to add some timeout which when expired allows to exit the while loop as well?</p>
<p dir="auto">Thanks<br />
Felix</p>
]]></description><link>https://community.m5stack.com/post/24376</link><guid isPermaLink="true">https://community.m5stack.com/post/24376</guid><dc:creator><![CDATA[felmue]]></dc:creator><pubDate>Thu, 14 Mar 2024 13:00:25 GMT</pubDate></item><item><title><![CDATA[Reply to WebServer errors - Core Basic + LAN 13.2 (W5500) on Thu, 14 Mar 2024 09:49:23 GMT]]></title><description><![CDATA[<p dir="auto">hello <a class="mention plugin-mentions-user plugin-mentions-a" href="https://community.m5stack.com/uid/443">@ajb2k3</a></p>
<p dir="auto">I set up direct IP, but at now I tested this code with dhcp service disabled and the issue is same after 11 minutes running.</p>
]]></description><link>https://community.m5stack.com/post/24368</link><guid isPermaLink="true">https://community.m5stack.com/post/24368</guid><dc:creator><![CDATA[kokany]]></dc:creator><pubDate>Thu, 14 Mar 2024 09:49:23 GMT</pubDate></item><item><title><![CDATA[Reply to WebServer errors - Core Basic + LAN 13.2 (W5500) on Thu, 14 Mar 2024 08:54:32 GMT]]></title><description><![CDATA[<p dir="auto"><a class="mention plugin-mentions-user plugin-mentions-a" href="https://community.m5stack.com/uid/86142">@kokany</a> more Likely a memory error or a dhcp addressing issue</p>
]]></description><link>https://community.m5stack.com/post/24367</link><guid isPermaLink="true">https://community.m5stack.com/post/24367</guid><dc:creator><![CDATA[ajb2k3]]></dc:creator><pubDate>Thu, 14 Mar 2024 08:54:32 GMT</pubDate></item><item><title><![CDATA[Reply to WebServer errors - Core Basic + LAN 13.2 (W5500) on Thu, 14 Mar 2024 08:37:06 GMT]]></title><description><![CDATA[<p dir="auto">Hello <a class="mention plugin-mentions-user plugin-mentions-a" href="https://community.m5stack.com/uid/4037">@felmue</a></p>
<p dir="auto">I tested again this morning. I can run my code for about 15 minutes, then the problems reappear.</p>
<p dir="auto">I have 2 different devices (basic + lan module) and the issues is same.<br />
I tested some browsers. (Chrome, Opera, Edge)</p>
<p dir="auto">Client crash, I mean when I debug the running code and the "crash" appaers then the client.connected() is true, but client.available() is false. And then the client.available() never go true (manually refreshing in browser or restart the device doesn't help)</p>
<p dir="auto">Is overheating possible?</p>
<p dir="auto">Thanks<br />
Tom</p>
]]></description><link>https://community.m5stack.com/post/24366</link><guid isPermaLink="true">https://community.m5stack.com/post/24366</guid><dc:creator><![CDATA[kokany]]></dc:creator><pubDate>Thu, 14 Mar 2024 08:37:06 GMT</pubDate></item><item><title><![CDATA[Reply to WebServer errors - Core Basic + LAN 13.2 (W5500) on Wed, 13 Mar 2024 16:45:01 GMT]]></title><description><![CDATA[<p dir="auto">Hello <a class="mention plugin-mentions-user plugin-mentions-a" href="https://community.m5stack.com/uid/86142">@kokany</a></p>
<p dir="auto">I am running your code and cannot reproduce either of your issues. I've reset M5Stack multiple times (20) and it always used the correct IP address. I also tried to provoke the client crash (tested with Chrome and Firefox), I even increased the refresh to 1 second, but I don't see a crash.</p>
<p dir="auto">BTW: by client crash, you mean the browser, correct?</p>
<p dir="auto">Maybe it's a power supply issue? Maybe try a different one?</p>
<p dir="auto">Thanks<br />
Felix</p>
]]></description><link>https://community.m5stack.com/post/24347</link><guid isPermaLink="true">https://community.m5stack.com/post/24347</guid><dc:creator><![CDATA[felmue]]></dc:creator><pubDate>Wed, 13 Mar 2024 16:45:01 GMT</pubDate></item></channel></rss>