[GH-ISSUE #854] timer crash when using it with this library #718

Closed
opened 2026-02-28 01:26:44 +03:00 by kerem · 6 comments
Owner

Originally created by @Adrianotiger on GitHub (Mar 20, 2019).
Original GitHub issue: https://github.com/tzapu/WiFiManager/issues/854

Basic Infos

Hardware

WiFimanager Branch/Release: Development

Esp8266/Esp32: ESP32

Hardware: DevKit 1.0

ESP Core Version: 1.0.1 and 1.0.2 RC1

Description

If using this library with a timer, the esp will crash with this error:
Guru Meditation Error: Core 1 panic'ed (Cache disabled but cached memory region accessed)

Sketch


#include "esp32-hal-timer.h"
#include <WiFiManager.h>

hw_timer_t *timer = NULL;
WiFiManager wifiManager;

void IRAM_ATTR _onTimer() {
  dacWrite(25, random(0,255));
}

void setup() {
  Serial.begin(115200);
  
  timer = timerBegin(0, 80, true);          // 800 = 80MHz / 80 = 1000kHz (1us pulse)
  timerAttachInterrupt(timer, &_onTimer, true);
  timerAlarmWrite(timer, 10, true);       // every 1ms
  timerAlarmEnable(timer);
  Serial.println("Timer started");
  
  wifiManager.autoConnect("Test", "test1234"); // <-- Crash!
  Serial.println("WiFi started");
}

void loop() {
  delay(1000);
}


Debug Messages

Timer started
*WM: [1] AutoConnect 
Guru Meditation Error: Core  1 panic'ed (Cache disabled but cached memory region accessed)
Guru Meditation Error: Core  1 panic'ed (IllegalInstruction). Exception was unhandled.
Memory dump at 0x40154aa0: bad00bad bad00bad bad00bad
Guru Meditation Error: Core  1 panic'ed (IllegalInstruction). Exception was unhandled.
Memory dump at 0x40154aa0: bad00bad bad00bad bad00bad
Guru Meditation Error: Core  1 panic'ed (IllegalInstruction). Exception was unhandled.
Memory dump at 0x40154aa0: bad00bad bad00bad bad00bad
Guru Meditation Error: Core  1 panic'ed (IllegalInstruction). Exception was unhandled.
Memory dump at 0x40154aa0: bad00bad bad00bad bad00bad
Guru Meditation Error: Core  1 panic'ed (IllegalInstruction). Exception was unhandled.
Memory dump at 0x40154aa0: bad00bad bad00bad bad00bad
Guru Meditation Error: Core  1 panic'ed (IllegalInstruction). Exception was unhandled.
Memory dump at 0x40154aa0: bad00bad bad00bad bad00bad
Guru Meditation Error: Core  1 panic'ed (IllegalInstruction). Exception was unhandled.
Memory dump at 0x40154aa0: bad00bad bad00bad bad00bad
Guru Meditation Error: Core  1 panic'ed (IllegalInstruction). Exception was unhandled.
Memory dump at 0x40154aa0: bad00bad bad00bad bad00bad
Guru Meditation Error: Core  1 panic'ed (IllegalInstruction). Exception was unhandled.
Memory dump at 0x40154aa0: bad00bad bad00bad bad00bad
Guru Meditation Error: Core  1 panic'ed (IllegalInstruction). Exception was unhandled.
Memory dump at 0x40154aa0: bad00bad bad00bad bad00bad
Guru Meditation Error: Core  1 panic'ed (IllegalInstruction). Exception was unhandled.
Memory dump at 0x40154aa0: bad00bad bad00bad bad00bad
...
Originally created by @Adrianotiger on GitHub (Mar 20, 2019). Original GitHub issue: https://github.com/tzapu/WiFiManager/issues/854 ### Basic Infos #### Hardware **WiFimanager Branch/Release: Development** **Esp8266/Esp32: ESP32** **Hardware: DevKit 1.0** **ESP Core Version: 1.0.1 and 1.0.2 RC1** ### Description If using this library with a timer, the esp will crash with this error: Guru Meditation Error: Core 1 panic'ed (Cache disabled but cached memory region accessed) ### Sketch ```cpp #include "esp32-hal-timer.h" #include <WiFiManager.h> hw_timer_t *timer = NULL; WiFiManager wifiManager; void IRAM_ATTR _onTimer() { dacWrite(25, random(0,255)); } void setup() { Serial.begin(115200); timer = timerBegin(0, 80, true); // 800 = 80MHz / 80 = 1000kHz (1us pulse) timerAttachInterrupt(timer, &_onTimer, true); timerAlarmWrite(timer, 10, true); // every 1ms timerAlarmEnable(timer); Serial.println("Timer started"); wifiManager.autoConnect("Test", "test1234"); // <-- Crash! Serial.println("WiFi started"); } void loop() { delay(1000); } ``` ### Debug Messages ``` Timer started *WM: [1] AutoConnect Guru Meditation Error: Core 1 panic'ed (Cache disabled but cached memory region accessed) Guru Meditation Error: Core 1 panic'ed (IllegalInstruction). Exception was unhandled. Memory dump at 0x40154aa0: bad00bad bad00bad bad00bad Guru Meditation Error: Core 1 panic'ed (IllegalInstruction). Exception was unhandled. Memory dump at 0x40154aa0: bad00bad bad00bad bad00bad Guru Meditation Error: Core 1 panic'ed (IllegalInstruction). Exception was unhandled. Memory dump at 0x40154aa0: bad00bad bad00bad bad00bad Guru Meditation Error: Core 1 panic'ed (IllegalInstruction). Exception was unhandled. Memory dump at 0x40154aa0: bad00bad bad00bad bad00bad Guru Meditation Error: Core 1 panic'ed (IllegalInstruction). Exception was unhandled. Memory dump at 0x40154aa0: bad00bad bad00bad bad00bad Guru Meditation Error: Core 1 panic'ed (IllegalInstruction). Exception was unhandled. Memory dump at 0x40154aa0: bad00bad bad00bad bad00bad Guru Meditation Error: Core 1 panic'ed (IllegalInstruction). Exception was unhandled. Memory dump at 0x40154aa0: bad00bad bad00bad bad00bad Guru Meditation Error: Core 1 panic'ed (IllegalInstruction). Exception was unhandled. Memory dump at 0x40154aa0: bad00bad bad00bad bad00bad Guru Meditation Error: Core 1 panic'ed (IllegalInstruction). Exception was unhandled. Memory dump at 0x40154aa0: bad00bad bad00bad bad00bad Guru Meditation Error: Core 1 panic'ed (IllegalInstruction). Exception was unhandled. Memory dump at 0x40154aa0: bad00bad bad00bad bad00bad Guru Meditation Error: Core 1 panic'ed (IllegalInstruction). Exception was unhandled. Memory dump at 0x40154aa0: bad00bad bad00bad bad00bad ... ```
kerem 2026-02-28 01:26:44 +03:00
Author
Owner

@tablatronix commented on GitHub (Mar 20, 2019):

This might be a esp lib bug, you would have to debug or get a stack trace to find out

<!-- gh-comment-id:474810892 --> @tablatronix commented on GitHub (Mar 20, 2019): This might be a esp lib bug, you would have to debug or get a stack trace to find out
Author
Owner

@Adrianotiger commented on GitHub (Mar 20, 2019):

Thank you for the fast reply.
Yes, I am trying to find out what it can be. But I don't get any stack trace to find out what it can be.

I saw that if I try to access a preference variable once the timer is started, the sketch will crash too. I just noticed it with this library and posted it here. Sorry.

<!-- gh-comment-id:474812585 --> @Adrianotiger commented on GitHub (Mar 20, 2019): Thank you for the fast reply. Yes, I am trying to find out what it can be. But I don't get any stack trace to find out what it can be. I saw that if I try to access a preference variable once the timer is started, the sketch will crash too. I just noticed it with this library and posted it here. Sorry.
Author
Owner

@tablatronix commented on GitHub (Mar 20, 2019):

not sure how you debug esp32, maybe someone else can.

is IRAM_ATTR correct?

<!-- gh-comment-id:474816088 --> @tablatronix commented on GitHub (Mar 20, 2019): not sure how you debug esp32, maybe someone else can. is IRAM_ATTR correct?
Author
Owner
<!-- gh-comment-id:474817455 --> @tablatronix commented on GitHub (Mar 20, 2019): https://github.com/espressif/arduino-esp32/issues/1907 https://github.com/espressif/esp-idf/issues/1299 https://github.com/NeoCat/ESP32-P3RGB64x32MatrixPanel/issues/4
Author
Owner

@tablatronix commented on GitHub (Mar 20, 2019):

See if those provide any answers

<!-- gh-comment-id:474817719 --> @tablatronix commented on GitHub (Mar 20, 2019): See if those provide any answers
Author
Owner

@Adrianotiger commented on GitHub (Mar 21, 2019):

I got an answer directly on the espressif page:
I am accessing the hardware from an interrupt and this should never be done if the interrupt occurs so fast (every 10us - 100us).
dacWrite need to access some registers and is not so fast like "digitalRead/digitalWrite". If this happens during another access to parameters or memory-call, this can cause a crash.

Since this WiFiManager-library access the nvs, no interrupt routines with hardware access should be executed in background, as this could cause a crash.

Shortly: it was my error. Thanks you for the links!

<!-- gh-comment-id:475146945 --> @Adrianotiger commented on GitHub (Mar 21, 2019): I got an answer directly on the espressif page: I am accessing the hardware from an interrupt and this should never be done if the interrupt occurs so fast (every 10us - 100us). dacWrite need to access some registers and is not so fast like "digitalRead/digitalWrite". If this happens during another access to parameters or memory-call, this can cause a crash. Since this WiFiManager-library access the nvs, no interrupt routines with hardware access should be executed in background, as this could cause a crash. Shortly: it was my error. Thanks you for the links!
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/WiFiManager#718
No description provided.