Hello all!
Is it possible M5 Dial extend with any wired ethernet module, like a W5500?
I'm open to any solution.
Thank you!
Hello all!
Is it possible M5 Dial extend with any wired ethernet module, like a W5500?
I'm open to any solution.
Thank you!
Hello @felmue
Finally I solved the problem.
The solution is as follows:
in libdeps M5-Ethernet\src\utility\w5100.h must modify SPISettings clock param to 8000000. (in line 21-22)
It's working fine now.
Thanks for everything
Tom
Hello @felmue
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.
If I trun off the device for some minutes and turn on, it work again for 3-5 refresh cycle.
If I trun off the device for some hours and turn on, it work again for 10-15 minutes.
This phenomenon is very interesting and I don't understand how it can be.
I checked network tab on development window of browser. The request sent but not received and it pending "forever".
I know it's unbelievable, but I can conjure up these phenomena at any time.
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.
Thanks
Tom
hello @ajb2k3
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.
Hello @felmue
I tested again this morning. I can run my code for about 15 minutes, then the problems reappear.
I have 2 different devices (basic + lan module) and the issues is same.
I tested some browsers. (Chrome, Opera, Edge)
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)
Is overheating possible?
Thanks
Tom
Hi all,
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:
This code is M5Stack LAN 13.2 example from here: https://github.com/m5stack/M5Module-LAN-13.2/tree/main/examples/WebServer with minor changes. (direct ip and refresh_counter)
Any help of advice would be gratefully received. I've tried looking online but can't seem to find anything!
#include <Arduino.h>
#include <M5Unified.h>
#include <M5GFX.h>
#include <SPI.h>
#include <M5Module_LAN.h>
#define THEME_COLOR 0x0760
uint8_t cs_pin;
uint8_t rst_pin;
uint8_t int_pin;
byte mac[] = {0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0x89};
IPAddress ip(192, 168, 1, 177);
IPAddress dns(192, 168, 1, 1);
IPAddress sn(255, 255, 255, 0);
IPAddress gw(192, 168, 1, 1);
M5Module_LAN LAN;
EthernetServer server(80);
int screen_height;
int screen_width;
int refresh_counter;
void setup() {
M5.begin();
M5.Display.begin();
M5.Display.setTextDatum(middle_center);
M5.Display.setTextColor(WHITE);
M5.Display.setTextFont(&fonts::FreeSansBoldOblique18pt7b);
screen_height = M5.Display.height();
screen_width = M5.Display.width();
M5.Display.fillSmoothRoundRect(2, screen_height / 2 - 20, screen_width - 4,
40, 4, THEME_COLOR);
M5.Display.drawString("Wait For Ethernet", screen_width / 2,
screen_height / 2);
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);
}
void loop() {
// listen for incoming clients
EthernetClient client = server.available();
if (client) {
Serial.println("new client");
// an http request ends with a blank line
boolean currentLineIsBlank = true;
while (client.connected()) {
if (client.available()) {
char c = client.read();
Serial.write(c);
// if you've gotten to the end of the line (received a newline
// character) and the line is blank, the http request has ended,
// so you can send a reply
if (c == '\n' && currentLineIsBlank) {
// send a standard http response header
client.println("HTTP/1.1 200 OK");
client.println("Content-Type: text/html");
client.println(
"Connection: close"); // the connection will be closed
// after completion of the
// response
client.println("Refresh: 5"); // refresh the page
// automatically every 5 sec
client.println();
client.println("<!DOCTYPE HTML>");
client.println("<html>");
client.print("<h2>Hello M5Stack LAN Module! Refresh count: " + String(refresh_counter) + "</h2>");
client.println("</html>");
refresh_counter++;
break;
}
if (c == '\n') {
// you're starting a new line
currentLineIsBlank = true;
} else if (c != '\r') {
// you've gotten a character on the current line
currentLineIsBlank = false;
}
}
}
// give the web browser time to receive the data
delay(1);
// close the connection:
client.stop();
Serial.println("client disconnected");
}
}