noInterrupts() function resets ESP32-S2.

frotaitalos
Posts: 13
Joined: Tue Nov 01, 2022 8:32 pm

noInterrupts() function resets ESP32-S2.

Postby frotaitalos » Wed Nov 09, 2022 1:52 pm

Hi, I'm new to using ESP32-S2, I've always worked with Atmega328p and now I'm using ESP.

I created a PCB with an ESP32-S2 on it, I didn't use any module, but the chip soldered directly to the board. Everything has been working fine, PWM, ADC, I2C, UART, etc. But when I use the noInterrupts() function, the ESP32-S2 simply restarts, I've done several tests, I used the cli(), portDISABLE_INTERRUPTS() functions and they keep putting the ESP in a restart cycle every time it arrives at the function.

I'm using a 40Mhz crystal with 18pF capacitors.

I will attach a print of the ESP32-S2 connections in my project and a small arduino code that makes my ESP restart.

Code: Select all

void setup() {
  // put your setup code here, to run once:
  gpio_set_direction(GPIO_NUM_17, GPIO_MODE_INPUT_OUTPUT);
  delay(2000);
  gpio_set_level(GPIO_NUM_17, !gpio_get_level(GPIO_NUM_17));
  cli();
  

}

void loop() {
  // put your main code here, to run repeatedly:

}
Attachments
Arduino IDE.png
Arduino IDE.png (19.26 KiB) Viewed 1722 times
PCB.png
PCB.png (115.13 KiB) Viewed 1722 times
ESP32-S2.png
ESP32-S2.png (36.04 KiB) Viewed 1722 times

ESP_Sprite
Posts: 9727
Joined: Thu Nov 26, 2015 4:08 am

Re: noInterrupts() function resets ESP32-S2.

Postby ESP_Sprite » Fri Nov 11, 2022 3:56 am

You can't just go and disable interrupts indefinitely: the OS needs those to handle WiFi, housekeeping etc. As such, interrupts that are disabled for a long time are seen as a symptom of a program gone awry, and we have a watchdog that resets the ESP in that case.

Who is online

Users browsing this forum: Baidu [Spider] and 73 guests