How to reset the entire system? esp_restart() doesn't work sometimes
Posted: Sun Jul 31, 2022 11:06 pm
Hi Everyone,
In my project, I'm using ESP32-S3, IDF, and have 2 level-5 GPIO interrupts, 1 level-5 timer interrupt, as well as some uart, SPI, USB peripherals. It will have to restart after some parameter changes. Function esp_restart() is called to restart, but sometimes the program will be then stuck at the interrupt registeration (code is shown below). In this case, either power off/on or flashing the same code then 'Hard resetting via RTS pin...' can resolve the problem.
It seems esp_restart() doesn't reset everything, or else it shouldn't be stuck at the interrupt registeration after calling esp_restart(). According to the post https://github.com/espressif/esp-idf/issues/3658, there are CPU reset, Core reset and System reset, and esp_restart() may not reset the rtc.
My question is:
Is there any function other than esp_restart() that reset the entire system?
What did esptool.py do to 'Hard resetting via RTS pin' after flashing the program? Can I do the same 'hard resetting' in the program by either calling some function or operating some 'RTS pin' ?
The following code is where it got stuck after esp_restart(). It can be stuck at the later one of line 2 and line 3, no matter what's the order of them.
Any information will be appreciated!!
Best,
Wayne
In my project, I'm using ESP32-S3, IDF, and have 2 level-5 GPIO interrupts, 1 level-5 timer interrupt, as well as some uart, SPI, USB peripherals. It will have to restart after some parameter changes. Function esp_restart() is called to restart, but sometimes the program will be then stuck at the interrupt registeration (code is shown below). In this case, either power off/on or flashing the same code then 'Hard resetting via RTS pin...' can resolve the problem.
It seems esp_restart() doesn't reset everything, or else it shouldn't be stuck at the interrupt registeration after calling esp_restart(). According to the post https://github.com/espressif/esp-idf/issues/3658, there are CPU reset, Core reset and System reset, and esp_restart() may not reset the rtc.
My question is:
Is there any function other than esp_restart() that reset the entire system?
What did esptool.py do to 'Hard resetting via RTS pin' after flashing the program? Can I do the same 'hard resetting' in the program by either calling some function or operating some 'RTS pin' ?
The following code is where it got stuck after esp_restart(). It can be stuck at the later one of line 2 and line 3, no matter what's the order of them.
Code: Select all
xt_ints_on(1 << 16);
xt_ints_on(1 << 31); //Line 2
intr_matrix_set(0, ETS_GPIO_INTR_SOURCE, 31); //Line 3.
Best,
Wayne