ESP32-C3 hangs randomly in light sleep

Hi !
Despite my countless tests and all my research, I can't solve my problem.

In order to help you help me, I made a simple test circuit and a simple test program.

Here is my simple test circuit:

Here is my simple test programming:

void setup() {

pinMode(10, OUTPUT); 
digitalWrite(10, LOW); 

pinMode(5, INPUT);  
pinMode(6, INPUT); 

gpio_wakeup_enable(GPIO_NUM_5, GPIO_INTR_LOW_LEVEL);
gpio_wakeup_enable(GPIO_NUM_6, GPIO_INTR_LOW_LEVEL);
esp_sleep_enable_gpio_wakeup();

delay(2000);
}

void loop() {

esp_light_sleep_start();

if (digitalRead(5) == LOW) {digitalWrite(10, HIGH); delay(100); digitalWrite(10, LOW);} 
if (digitalRead(6) == LOW) {digitalWrite(10, HIGH); delay(100); digitalWrite(10, LOW);} 

delay(100);
}

Here is the link for ESP32-C3 board: https://www.aliexpress.com/item/1005006461886182.html

By pressing switch 1 and switch 2 alternately quickly, after several times, the ESP32-C3 board hangs. I must press RESET after that...

I tried with other ESP32-C3 boards and they hang too.

Do you have any idea what the problem is?

Thanks!

Are you following standard operating procedures?
1. Put your MCU into sleep.
2. Inject wake-up trigger signal.
3. Observe that the MCU has wake-up u flashing LED.
4. Goto Step-1.

Why are you injecting interrupting signal by pressing SW2 when the MCU is not in sleep?

Are you following standard operating procedures?

Yes.

Why are you injecting interrupting signal by pressing SW2 when the MCU is not in sleep?

My goal is to make a specialized infrared remote control, with 5 buttons, running on battery.

So, I plan to use the light sleep function to use as little power as possible.

It is absolutely necessary that the user of this remote control can press the button of his choice, at the speed he wants, and in the order he wants, without the remote control freezing.

So, in my test, I press the buttons of my choice and, necessarily, the ESP32-C3 must not freeze.

With some adaptation of the circuit and programming, I know it works fine on an ESP32-S3 and an ESP-WROOM-32... But I still need to find a solution for the ESP32-C3...

Have you checked the V3 migration documentation to see if there are any issues outstanding?

Try changing GPIO6 to another pin. In this MCU this pin is also VDD3P3_RTC. EDIT: it's not the problem.

Just try different pins. For testing a minimal setup, you could also remove the LED and use the internal one at GPIO8.

I would recommend to connect a real IR Sensor with ESP32 C3 Super Mini and wake it up from a Remote Controller using one or more alternate buttons.

I tried other pins and the problem is still there.

No need to press SW1 and SW2 very quickly. Just pressing them alternately is enough.

My plan B is to use a PCF8574 and put my switches on this I2C chip. But that adds unnecessary hardware.

It would be interesting if someone could cross-check my test circuit and test programming with the same ESP32-C3 board.

Ok, I have setup the circuit with the same board and for me it works fine, with the same pins.
The difference is only that I use the internal pullups instead of the resistors:

#define SW1_PIN GPIO_NUM_5
#define SW2_PIN GPIO_NUM_6
...
  pinMode( SW1_PIN, INPUT_PULLUP);  
  pinMode( SW2_PIN, INPUT_PULLUP);

The rest is the same. Instead of switches I short the pins with a jump wire to a GND ring that I have in the breadboard, to hook clip leads, etc.
I switch both fast, at the same time, alternatively... and it works fine.

I suppose that you know that when the board is sleeping, to program it you have to reset it while pressing also the boot button, to enter programming mode. And after programming you have to press the reset button again to restart.

Thanks to all and especially to stonemk for the cross-check.

Your posts made me think a lot and I finally found the culprit... the switches...

I was using this kind of switch because I wanted silent switches:
https://www.aliexpress.com/item/4000030086505.html

But this kind of switch (with a kind of carbon washer inside) does not give a clean contact closure and gives a contact around 100 ohms. It probably works well with an ADC, but it seems that the ESP32-C3 does not appreciate it.

I am currently using standard switches and it works very very well.

Thanks!