Skip to content

attachinterrupt crash on latest git but works on 2.4.1 (latest stable) #4870

Closed
@minida28

Description

@minida28

Basic Infos

  • This issue complies with the issue POLICY doc.
  • I have read the documentation at readthedocs and the issue is not addressed there.
  • I have tested that the issue is present in current master branch (aka latest git).
  • I have searched the issue tracker for a similar issue.
  • If there is a stack dump, I have decoded it.
  • I have filled out all fields below.

Platform

  • Hardware: ESP-12E
  • Core Version: 2.4.1 & latest git
  • Development Env: Arduino IDE ver 1.8.5
  • Operating System: Windows 10

Settings in IDE

  • Module: Nodemcu Lolin
  • Upload Using: SERIAL

capture

Problem Description

attachinterrupt in the sketch below crashes on latest git but works on 2.4.1 (latest stable).

Crash happened as soon soon as interrupt was triggered (in this case, when interrupt pin goes from HIGH to LOW, i.e. interrupt pin is connected to GND pin).

MCVE Sketch

const byte interruptPin = 5; //pin D1 on NodeMcu
volatile bool state = 0;
bool state_old = 0;

void setup() {
  Serial.begin(115200);
  pinMode(interruptPin, INPUT_PULLUP);
  attachInterrupt(digitalPinToInterrupt(interruptPin), SwapState, FALLING);
}

void SwapState() {
  state = !state;
}

void loop()
{
  if (state != state_old)
  {
    state_old = state;
    static int counter;    ;
    Serial.print("Interrupt counter: ");
    Serial.println(counter++);
  }
}

Debug Messages

Please advise what debug mode I should turn on..?

Stack DUMP

Exception 28: LoadProhibited: A load referenced a page mapped with an attribute that does not permit loads
Decoding 27 results
0x401065b1: interrupt_handler at G:\arduino-1.8.5\hardware\esp8266com\esp8266\cores\esp8266/core_esp8266_wiring_digital.c line 150
0x40100f22: pp_post at ?? line ?
0x40100f22: pp_post at ?? line ?
0x40104304: lmacTxFrame at ?? line ?
0x40100f22: pp_post at ?? line ?
0x40103523: lmacRecycleMPDU at ?? line ?
0x40100f22: pp_post at ?? line ?
0x40103986: lmacRecycleMPDU at ?? line ?
0x40103523: lmacRecycleMPDU at ?? line ?
0x40106566: interrupt_handler at G:\arduino-1.8.5\hardware\esp8266com\esp8266\cores\esp8266/core_esp8266_wiring_digital.c line 138
0x40102192: wDev_ProcessFiq at ?? line ?
0x4010652c: interrupt_handler at G:\arduino-1.8.5\hardware\esp8266com\esp8266\cores\esp8266/core_esp8266_wiring_digital.c line 132
0x40202f98: run_scheduled_functions() at G:\arduino-1.8.5\hardware\esp8266com\esp8266\cores\esp8266/Schedule.cpp line 67
0x40202eab: loop_wrapper at G:\arduino-1.8.5\hardware\esp8266com\esp8266\cores\esp8266/core_esp8266_main.cpp line 126
0x40202eab: loop_wrapper at G:\arduino-1.8.5\hardware\esp8266com\esp8266\cores\esp8266/core_esp8266_main.cpp line 126
0x40202c97: String::changeBuffer(unsigned int) at G:\arduino-1.8.5\hardware\esp8266com\esp8266\cores\esp8266/WString.cpp line 148
0x40202830: HardwareSerial::write(unsigned char const*, unsigned int) at G:\arduino-1.8.5\hardware\esp8266com\esp8266\cores\esp8266/HardwareSerial.cpp line 88
0x401066ba: __attachInterruptArg at G:\arduino-1.8.5\hardware\esp8266com\esp8266\cores\esp8266/core_esp8266_wiring_digital.c line 190
0x401002ac: _umm_free at G:\arduino-1.8.5\hardware\esp8266com\esp8266\cores\esp8266\umm_malloc/umm_malloc.c line 1295
0x40202668: SwapState() at C:\Users\iqbal\AppData\Local\Temp\arduino_modified_sketch_157196/sketch_jul01b.ino line 16
0x4010077c: free at G:\arduino-1.8.5\hardware\esp8266com\esp8266\cores\esp8266\umm_malloc/umm_malloc.c line 1755
0x401066dc: __attachInterrupt at G:\arduino-1.8.5\hardware\esp8266com\esp8266\cores\esp8266/core_esp8266_wiring_digital.c line 195
0x402026e1: setup at C:\Users\iqbal\AppData\Local\Temp\arduino_modified_sketch_157196/sketch_jul01b.ino line 13
0x40202e3d: esp_schedule at G:\arduino-1.8.5\hardware\esp8266com\esp8266\cores\esp8266/core_esp8266_main.cpp line 95
0x40202ea8: loop_wrapper at G:\arduino-1.8.5\hardware\esp8266com\esp8266\cores\esp8266/core_esp8266_main.cpp line 125
0x401000e5: cont_wrapper at G:\arduino-1.8.5\hardware\esp8266com\esp8266\cores\esp8266/cont.S line 81

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions