Skip to content

EEPROM.commit() blocks interrupts for 30ms #8169

Closed
@kachurovskiy

Description

@kachurovskiy

Board

ESP32-S3-WROOM-1U-N16R2

Device Description

See https://github.com/kachurovskiy/nanoels/tree/main/h4 but I don't think it's relevant.

Hardware Configuration

My board schematic is available on https://github.com/kachurovskiy/nanoels/tree/main/h4#main-board-schematic but I don't think it's relevant.

Version

v2.0.9

IDE Name

Arduino IDE

Operating System

Windows 10

Flash frequency

Espressif Systems

PSRAM enabled

no

Upload speed

115200

Description

With commit() call it looks like this:

image

Without commit() it's all working well:

image

This problem also affects hardware PCNT pulse counter and likely other interrupt logic.

Sketch

#define ENC_A 15
#define OUT 11

#include <EEPROM.h>

void IRAM_ATTR spinEnc() {
  digitalWrite(OUT, digitalRead(ENC_A));
}

void setup() {
  EEPROM.begin(256);
  pinMode(ENC_A, INPUT);
  pinMode(OUT, OUTPUT);
  attachInterrupt(digitalPinToInterrupt(ENC_A), spinEnc, CHANGE);
}

void loop() {
  EEPROM.write(0, digitalRead(ENC_A));
  // EEPROM.commit(); // uncommend this line to get 30ms periods of ignored interrupts
  delay(10);
}

Debug Message

Not relevant.

Other Steps to Reproduce

No response

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

  • I confirm I have checked existing issues, online documentation and Troubleshooting guide.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions