These are chat archives for esp8266/Arduino

Jan 2017
Michael Miller
Jan 22 2017 00:18
I think one approach that works well, is get some small piece working, then refactor the code and do the cleanup. Start the next small piece, refactor, and repeat.
Doing something dirty and quick will teach you how to use it so that you can better refactor it. Just don't wait to long before you start a refactor or you will forget to many details ;-)
Jan 22 2017 09:46
...often a good logging mechanism is the only hope you have
Yes, but what sort of mechanismen are available?
I know debug serial output. But this is only for use, if the ESP is connected to a PC
If there is a standalone box, only with connection to the WiFi? OK, you can send sort of debug messages ota (hopefully, but never tried) but if the ESP stucks, there is finish with this sort of debug :-(
Jan 22 2017 09:52
In a calm moment I thought of connecting the ESP (on his dedicated place) to a Raspi and write a debug file on his sd-card......
Clemens Kirchgatterer
Jan 22 2017 10:10
@brutzler for me it's about having options. my logger aproach is: have the frontend functions defines as macros (so i can just compile without them in production code), have a flexible backend with multiple transport mechanisms like serial port, UDP, local file, even ram buffer,...) e.g. log.* is the frontend logger.* is the backend.
Clemens Kirchgatterer
Jan 22 2017 10:17
@brutzler BTW. i can confirm your problem with the watchdog. sometimes the ESP just stops executing the loop() function and still will not trigger the watchdog. my theory is that a internal memory allocation error is not handled properly. if i have plenty of free heap, this hang is less likly.
Jan 22 2017 14:46

has some one experienced esp rebooting when using the function getFreeHeap() ?

15:30:46 **** Build of configuration Default for project HomeAutomation-Project ****
java -jar "C:\\Espressif\\debugging\\EspStrackTraceDecoder-master\\src\\EspStrackTraceDecoder.jar" "C:\\Espressif\\esp-alt-sdk-v1.5.0.258-windows-x86\\xtensa-lx106-elf\\bin\\xtensa-lx106-elf-addr2line.exe" .pioenvs/esp01_1m/firmware.elf debug/StackDump.txt 
Exception Cause: Not found

0x400005cb: ?? ??:0
0x40024b38: ?? ??:0
0x40100744: free at C:\users\orce\.platformio\packages\framework-arduinoespressif8266\cores\esp8266\umm_malloc/umm_malloc.c:1733
0x402296d0: umm_free_heap_size at C:\users\orce\.platformio\packages\framework-arduinoespressif8266\cores\esp8266\umm_malloc/umm_malloc.c:1739
0x40214410: xPortGetFreeHeapSize at C:\users\orce\.platformio\packages\framework-arduinoespressif8266\cores\esp8266/heap.c:59
0x402488b1: system_get_free_heap_size at ??:?
0x40201054: EspClass::getFreeHeap() at C:\users\orce\.platformio\packages\framework-arduinoespressif8266\cores\esp8266/Esp.cpp:67
0x402018d0: Print::print(char const*) at C:\users\orce\.platformio\packages\framework-arduinoespressif8266\cores\esp8266/Print.cpp:87
0x40249b37: wifi_station_get_connect_status at ??:?
0x4020d440: RemoteDebug::processCommand() at C:\DefaultInstall\UserData\workspace_eclipse\Platformio\HomeAutomation-Project/lib\RemoteDebug\src/RemoteDebug.cpp:163
0x4020d759: RemoteDebug::handle() at C:\DefaultInstall\UserData\workspace_eclipse\Platformio\HomeAutomation-Project/lib\RemoteDebug\src/RemoteDebug.cpp:163
0x4021ae6a: WifiMgtLoop() at C:\DefaultInstall\UserData\workspace_eclipse\Platformio\HomeAutomation-Project/src/SETUP_MeshNetwork.h:298
0x4021ab74: RemoteDebugLoop() at C:\DefaultInstall\UserData\workspace_eclipse\Platformio\HomeAutomation-Project/src/SETUP_MeshNetwork.h:298
0x402216a8: loop at C:\DefaultInstall\UserData\workspace_eclipse\Platformio\HomeAutomation-Project/src/HomeAutomation_OTA.cpp:132
0x40202ef2: loop_wrapper at C:\users\orce\.platformio\packages\framework-arduinoespressif8266\cores\esp8266/core_esp8266_main.cpp:56
0x40205320: cont_norm at cont.o:?

The reboot happens only when the esp is connected as client to the AP of another esp. This other esp is connected to my wifi network. Thus it seems that i have this problem only if my esp is not immediately connected to my wifi network. It's now for 1 week i'am investigating the problem but i can't find a solution. I would be very happy if someone could give me a hint where to investigate further.

Clemens Kirchgatterer
Jan 22 2017 15:12
@orcema my guess is heap corruption. somewhere in the codepath you describe the list of maloced memory gets corrupt.
Jan 22 2017 22:15
ESP.getVcc() gives me back "2770" on a Wemos D1 mini. Measuring at the 3,3V-Pin shows me 3,31V.
Imho a little bit far away? Or is the 2770 not to be seen as 2,77V?
Jan 22 2017 22:27
Or is the problem, that ADC/TOUT is connected to a voltage devider (220k/100k) on the dev-board?