setLogLevel: ERROR | STARTUP |

So im trying to code with painless mesh and i keep getting this error and and when i open serial monitor i blue screen. HELP
Rebooting...

ets Jul 29 2019 12:21:46

rst:0xc (SW_CPU_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:0x3fff0030,len:4916

load:0x40078000,len:16436

load:0x40080400,len:4

ho 8 tail 4 room 4

load:0x40080404,len:3524

entry 0x400805b8

Blue Screen is an old Windows term, is your problem with Windows or Arduino?

Okay, a blue screen (likely a crash/reboot loop) coupled with the boot log you provided, and your mention of "painless mesh," points to some likely causes:

1. Memory Issues (Most Likely):

  • Painless Mesh's memory requirements: Painless Mesh, especially with larger networks, can be memory-intensive. The "ho 8 tail 4 room 4" line, while not definitively diagnostic, could indicate memory management issues.
  • Heap fragmentation: Repeated allocations and deallocations of memory can lead to fragmentation, where there's free memory, but not in contiguous blocks large enough for the application's needs.
  • Stack overflow: If your code has deep recursion or allocates large local variables on the stack, it can overflow, causing a crash.
  • Heap overflow: If your code writes beyond the allocated bounds of a memory block, it can corrupt the heap, leading to unpredictable behavior and crashes.
  • Insufficient RAM: The ESP devices do not have a lot of ram, and it is easy to use it all.

2. Painless Mesh Configuration Problems:

  • Incorrect network settings: If your mesh network settings (e.g., SSID, password, port) are incorrect or conflicting, it can lead to instability.
  • Too many nodes: If you're trying to create a mesh network with too many nodes for your hardware, it can overload the system.
  • Conflicting libraries: Ensure that you are not using any other libraries that are conflicting with painless mesh.
  • Incorrect version: Make sure that you are using the correct version of the painless mesh library.

3. Code Issues:

  • Null pointer dereferences: If your code tries to access memory through a null pointer, it will cause a crash.
  • Infinite loops: If your code gets stuck in an infinite loop, it can prevent the system from responding and eventually lead to a crash.
  • Interrupt conflicts: If multiple interrupts are trying to access the same resources, it can lead to conflicts and crashes.
  • Incorrect data types: Using incorrect data types can cause unexpected behavior and crashes.

Troubleshooting Steps:

  1. Simplify your code:
  • Start with the most basic Painless Mesh example code.
  • Remove any unnecessary code, libraries, or features.
  • This helps isolate the problem.
  1. Check memory usage:
  • Use the ESP.getFreeHeap() function to monitor the available heap memory.
  • Add debug print statements to track memory usage at critical points in your code.
  1. Reduce mesh complexity:
  • If you're using a large mesh network, try reducing the number of nodes.
  • Simplify your network topology.
  1. Update libraries:
  • Ensure that you're using the latest version of the Painless Mesh library.
  • Update your ESP32/ESP8266 board definitions in the Arduino IDE.
  1. Serial debug:
  • Add extensive serial print statements to your code to track the execution flow and identify where the crash occurs.
  • If you can get any output before the crash, that will be very valuable.
  1. Check for memory leaks:
  • Make sure that every time you use malloc() or new, you also use free() or delete when you are done.
  1. Check for large local variables:
  • If you are creating large arrays or other large variables inside of functions, consider making them global or using dynamic memory allocation.
  1. Verify your board and wiring:
  • If you are using external hardware, verify that it is wired correctly.
  • Ensure that your ESP board is functioning correctly.
  1. Example Code:
  • When asking for help, provide the code that is producing the error. That will greatly increase the ability for others to help you.

Example of basic memory checking code:

`C++
#include "painlessMesh.h"

painlessMesh mesh;

void setup() {
  Serial.begin(115200);
  Serial.println("Starting...");
  mesh.init(MESH_PREFIX, MESH_PASSWORD, &userScheduler, MESH_PORT);
  Serial.print("Free Heap: ");
  Serial.println(ESP.getFreeHeap());
}

void loop() {
  mesh.update();
  Serial.print("Free Heap: ");
  Serial.println(ESP.getFreeHeap());
  delay(1000);
}`

By systematically working through these steps, you should be able to identify and resolve the issue causing your blue screen.

1 Like

when i uppload the code to my esp32 and go in to serial monitor and if i wait like 5 sec a blue screen commes up

1 Like

is this for fixing blue screen or fix so the code works

Are you saying your computer gets a blue screen?

How can code running on an Arduino cause a Windows Blue Screen?

are you using windows ten or newer? if so what version of ide are you using?

That code you are showing runs on the ESP board, how does that cause a Windows Blue Screen?

yes

Im uisng windows 11 and arduino ide 2.3.4

You've got some kind of Windows software problem... No matter what the ESP32 does, it cannot crash Windows. I suspect perhaps something along the lines of COM port busy or unavailable.

Have you checked Windows system logs?

1 Like

no i can try to check but i tried on both my pc and it happend on both

it is something with the board. make sure you press the rst button while opening the serial monitor and try again! if it still blue screens, I will be happy to help

try opening the serial plotter before the monitor and see what happens!

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.