Skip to content

noInterrupts() not implemented - can not turn off interrupts #7211

Closed
@caternuson

Description

@caternuson

Board

ESP32-PICO-MINI-02

Device Description

Adafruit Feather ESP32 V2
https://www.adafruit.com/product/5400

Hardware Configuration

No additional hardware attached. However, to run the example sketch to demonstrate the issue, two digital pins need to be connected together somehow. This was done on a breadboard using a jumper wire.

Version

v2.0.4

IDE Name

Arduino IDE

Operating System

Ubuntu

Flash frequency

n/a

PSRAM enabled

yes

Upload speed

921600

Description

The Arduino methods for disabling/enabling interrupts are no implemented:
https://www.arduino.cc/reference/en/language/functions/interrupts/nointerrupts/
https://www.arduino.cc/reference/en/language/functions/interrupts/interrupts/

Interrupts are "always on".

Sketch

#define OUT_PIN 14
#define IN_PIN 32

int count = 0;

void counter() {
  count++;
}

void setup() {
  Serial.begin(9600);

  pinMode(OUT_PIN, OUTPUT);
  digitalWrite(OUT_PIN, LOW);
  pinMode(IN_PIN, INPUT);

  attachInterrupt(digitalPinToInterrupt(IN_PIN), counter, RISING);

  for (int i=0; i<50; i++) {
    digitalWrite(OUT_PIN, HIGH);
    digitalWrite(OUT_PIN, LOW);
  }

  noInterrupts();

  for (int i=0; i<50; i++) {
    digitalWrite(OUT_PIN, HIGH);
    digitalWrite(OUT_PIN, LOW);
  }

  Serial.print("count = "); Serial.println(count);
}

void loop() {
}

Debug Message

No debug messages. Sketch runs without issue. However, the expected output is 50, not 100.


count = 100


### Other Steps to Reproduce

This is the same issue reported in this older thread:
https://github.com/espressif/arduino-esp32/issues/832
that was closed claiming it's not a BSP issue.

### I have checked existing issues, online documentation and the Troubleshooting Guide

- [X] I confirm I have checked existing issues, online documentation and Troubleshooting guide.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions