Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

UDP Debugging is broken #397

Closed
xoseperez opened this issue Jan 12, 2018 · 6 comments
Closed

UDP Debugging is broken #397

xoseperez opened this issue Jan 12, 2018 · 6 comments

Comments

@xoseperez
Copy link
Owner

Originally reported by: Michael Murton (Bitbucket: crazyivan359, GitHub: crazyivan359)


I have a device that I am having stability issues with that I wanted to try to debug via UDP because the serial port pins are being used for sensors. Upon uploading a build with UDP debugging enabled, the device crashes (and ends up in AP mode because of SYSTEMCHECK).

Here is the stack trace I get from a WEMOS D1 MINI using env:wemos-d1mini-relayshield and DEBUG_UDP_SUPPORT=1. I have also included the full log as an attachment

Exception 9: LoadStoreAlignmentCause: Load or store to an unaligned address
Decoding 19 results
0x401049b4: ets_timer_setfn at ?? line ?
0x4024e57a: udp_sendto at core/udp.c line 450
0x40104be0: ets_timer_arm_new at ?? line ?
0x402068ac: WiFiUDP::endPacket() at C:\users\mikey\.platformio\packages\framework-arduinoespressif8266\libraries\ESP8266WiFi\src/WiFiUdp.cpp line 282
0x40203b4c: delay at C:\users\mikey\.platformio\packages\framework-arduinoespressif8266\cores\esp8266/core_esp8266_wiring.c line 46
0x40221280: debugSend_P(char const*, ...) at N:/Projects/Home Automation/Software/Sonoff/ESPurna/ESPurna 1.11.3/code/espurna/debug.ino line 179
0x402236cc: std::vector   >::size() const at N:/Projects/Home Automation/Software/Sonoff/ESPurna/ESPurna 1.11.3/code/espurna/debug.ino line 179
:  (inlined by) relaySave() at N:/Projects/Home Automation/Software/Sonoff/ESPurna/ESPurna 1.11.3/code/espurna/relay.ino line 252
0x4023377f: scan_start at ?? line ?
0x40223727: relaySave() at N:/Projects/Home Automation/Software/Sonoff/ESPurna/ESPurna 1.11.3/code/espurna/debug.ino line 179
0x40233ca5: scan_remove_probe_ssid at ?? line ?
0x40233820: scan_start at ?? line ?
0x40243ab5: ets_timer_handler_isr at ?? line ?
0x40243afa: ets_timer_handler_isr at ?? line ?
0x402032cb: loop_task at C:\users\mikey\.platformio\packages\framework-arduinoespressif8266\cores\esp8266/core_esp8266_main.cpp line 132
@xoseperez
Copy link
Owner Author

Looks like the culprit is the delay() after the endPacket in debug.ino. Removing it makes it work smoothly. Truth is that I can't remember why I added that delay...

@xoseperez
Copy link
Owner Author

Original comment by Michael Murton (Bitbucket: crazyivan359, GitHub: crazyivan359):


Sorry that post was so short, I was quite focused on getting that device working and was already trying to telnet into in. Thanks for finding that bug, I wasn't sure what to make of that stack trace. How did you know it was the delay call from looking at that though?

Also I should mention that I was trying UDP debugging because I couldn't get telnet to work in STA mode. In the end I used my wemos test device to show me a serial log when I tried to connect via telnet in STA mode. Turns out the check of TELNET_STA == 1 was always coming up false in _telnetNewClient

#!arduino
bool telnetSTA = getSetting("telnetSTA", TELNET_STA).toInt() == 1;

I just declared it as true to get around it last night since I saw no problems with that line itself and I didn't have time to go looking back through the settings code

@xoseperez
Copy link
Owner Author

I also find stack traces hard to "decode" by a human. But I just saw the "delay" there and a delay is a usual suspect.

About enabling TELNET in "STAtion mode". The TELNET_STA setting is the default value for a new installation. The "telnetSTA" key has precedence. You can change that setting from the web UI under the "Admin" tab.

@xoseperez
Copy link
Owner Author

Original comment by Michael Murton (Bitbucket: crazyivan359, GitHub: crazyivan359):


Good to know, I'll watch for that in the future.

I had set TELNET_STA = 1 in the general.h config file, but I had already uploaded the same binary before with TELNET_STA = 0. I have noticed that this same device, that I have flashed with 2 different hardware configurations, retains the configurations for each separately, regardless of how many times I have flashed it. Is it possible that the previously saved settings took precedence over the change I made in general.h?

@xoseperez
Copy link
Owner Author

Yes. If telnetSTA is set in EEPROM then it takes precedence over TELNET_STA.

@xoseperez
Copy link
Owner Author

Released with 1.12.1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant