probonopd / WirelessPrinting

Print wirelessly from Cura, PrusaSlicer or Slic3r to your 3D printer connected to an ESP8266 or ESP32 module
352 stars 65 forks source link

ESP32: Seems to completely stall the ESP32 after a few seconds #108

Closed probonopd closed 5 years ago

probonopd commented 5 years ago

Testers and contributors with ESP32 devices needed.

With ESP32-PICO-KIT module:

After flashing the ESP32, the web interface and telnet are working for a very short period of time, until everything freezes and cannot be reactivated anymore without flashing again. Not even power cycling helps.

With no printer connected:

root@host:/home/me# telnet 192.168.0.16
Trying 192.168.0.16...
Connected to 192.168.0.16.
Escape character is '^]'.
Connecting at 115200
>M115
Connecting at 250000
>M115
Connecting at 250000
>M115

(Stalling here. Does not continue. ESP32 no longer reachable over the web. Power cycling the ESP32 does NOT seem to help? But reflashing does)

probonopd commented 5 years ago

This is how a ping looks:

From 192.168.0.15 icmp_seq=64 Destination Host Unreachable
From 192.168.0.15 icmp_seq=65 Destination Host Unreachable
From 192.168.0.15 icmp_seq=66 Destination Host Unreachable
From 192.168.0.15 icmp_seq=70 Destination Host Unreachable
From 192.168.0.15 icmp_seq=71 Destination Host Unreachable
From 192.168.0.15 icmp_seq=72 Destination Host Unreachable
64 bytes from 192.168.0.16: icmp_seq=76 ttl=255 time=3.35 ms ### Flashed new firmware a couple of seconds before
64 bytes from 192.168.0.16: icmp_seq=77 ttl=255 time=18.2 ms
64 bytes from 192.168.0.16: icmp_seq=78 ttl=255 time=39.5 ms
64 bytes from 192.168.0.16: icmp_seq=79 ttl=255 time=65.8 ms
64 bytes from 192.168.0.16: icmp_seq=80 ttl=255 time=84.0 ms
64 bytes from 192.168.0.16: icmp_seq=81 ttl=255 time=107 ms
64 bytes from 192.168.0.16: icmp_seq=82 ttl=255 time=129 ms
64 bytes from 192.168.0.16: icmp_seq=83 ttl=255 time=153 ms
64 bytes from 192.168.0.16: icmp_seq=84 ttl=255 time=176 ms
64 bytes from 192.168.0.16: icmp_seq=85 ttl=255 time=199 ms
64 bytes from 192.168.0.16: icmp_seq=86 ttl=255 time=18.7 ms
64 bytes from 192.168.0.16: icmp_seq=87 ttl=255 time=39.5 ms
64 bytes from 192.168.0.16: icmp_seq=88 ttl=255 time=62.1 ms
64 bytes from 192.168.0.16: icmp_seq=89 ttl=255 time=18.0 ms
64 bytes from 192.168.0.16: icmp_seq=90 ttl=255 time=18.6 ms
64 bytes from 192.168.0.16: icmp_seq=91 ttl=255 time=131 ms
64 bytes from 192.168.0.16: icmp_seq=92 ttl=255 time=154 ms
From 192.168.0.15 icmp_seq=146 Destination Host Unreachable
From 192.168.0.15 icmp_seq=147 Destination Host Unreachable
From 192.168.0.15 icmp_seq=148 Destination Host Unreachable
From 192.168.0.15 icmp_seq=149 Destination Host Unreachable
From 192.168.0.15 icmp_seq=150 Destination Host Unreachable
From 192.168.0.15 icmp_seq=151 Destination Host Unreachable
probonopd commented 5 years ago

When compiled locally with maximum verbosity on, we see

ets Jun  8 2016 00:22:57

rst:0x1 (POWERON_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
flash read err, 1000
ets_main.c 371 
ets Jun  8 2016 00:22:57

rst:0x10 (RTCWDT_RTC_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
configsip: 188777542, SPIWP:0xee
clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
mode:DIO, clock div:1
load:0x3fff0018,len:4
load:0x3fff001c,len:928
ho 0 tail 12 room 4
load:0x40078000,len:9280
load:0x40080400,len:5848
entry 0x40080698
[W][sd_diskio.cpp:471] ff_sd_initialize(): GO_IDLE_STATE failed
[E][sd_diskio.cpp:739] sdcard_mount(): f_mount failed 0x(3)
[D][WiFiGeneric.cpp:342] _eventCallback(): Event: 0 - WIFI_READY
[D][WiFiGeneric.cpp:342] _eventCallback(): Event: 2 - STA_START
[D][WiFiGeneric.cpp:342] _eventCallback(): Event: 4 - STA_CONNECTED
[D][WiFiGeneric.cpp:342] _eventCallback(): Event: 7 - STA_GOT_IP
[D][WiFiGeneric.cpp:385] _eventCallback(): STA IP: 192.168.0.16, MASK: 255.255.255.0, GW: 192.168.0.1
M115
M115
ph⸮ph⸮⸮⸮

What is ph⸮ph⸮⸮⸮?

probonopd commented 5 years ago

Second module (ESP-WROOM-32):

rst:0x1 (POWERON_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
flash read err, 1000
Falling back to built-in command interpreter.
OK
>ets Jun  8 2016 00:22:57

But then the sketch starts, says

me@host:~$ telnet 192.168.0.17
Trying 192.168.0.17...
Connected to 192.168.0.17.
Escape character is '^]'.
Connecting at 115200
>M115
Connecting at 250000
>M115
Connecting at 250000
>M115
Connecting at 500000
>M115
Connecting at 500000
>M115

then stalls. Resetting the module does work here, the sketch starts again.

probonopd commented 5 years ago

This one, with maximum verbosity on, shows on the serial console:

ets Jun  8 2016 00:22:57

rst:0x1 (POWERON_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
configsip: 0, SPIWP:0xee
clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
mode:DIO, clock div:1
load:0x3fff0018,len:4
load:0x3fff001c,len:1100
load:0x40078000,len:10088
load:0x40080400,len:6380
entry 0x400806a4
[W][sd_diskio.cpp:471] ff_sd_initialize(): GO_IDLE_STATE failed
[E][sd_diskio.cpp:739] sdcard_mount(): f_mount failed 0x(3)
[D][WiFiGeneric.cpp:342] _eventCallback(): Event: 0 - WIFI_READY
[D][WiFiGeneric.cpp:342] _eventCallback(): Event: 2 - STA_START
[D][WiFiGeneric.cpp:342] _eventCallback(): Event: 4 - STA_CONNECTED
[D][WiFiGeneric.cpp:342] _eventCallback(): Event: 7 - STA_GOT_IP
[D][WiFiGeneric.cpp:385] _eventCallback(): STA IP: 192.168.0.17, MASK: 255.255.255.0, GW: 192.168.0.1
M115
M115
I⸮E⸮

So this one dies with I⸮E⸮...

probonopd commented 5 years ago

Next try:

M115
M115
T#T⸮⸮
probonopd commented 5 years ago

Next try:

M115
M115
T⸮T⸮

So, some randomness.

probonopd commented 5 years ago

When I replace detectPrinter() with

bool detectPrinter() {
  return false;
}

then it does not stall the module and the web interface stays responsive for more than just a couple of seconds.

probonopd commented 5 years ago

The random characters above are "M115" sent at different baud rates. Looks like the ESP32 crashes when trying 500000.

probonopd commented 5 years ago

With const uint32_t serialBauds[] = { 115200, 250000, 57600 }; we do not crash the ESP32.