I have an issue where sometimes the I2C stack seems to get stuck and a soft reset via esp_restart() or abort() does not clear it. A hard reset (power off, power on) does clear it and everything starts working again. I am able to detect this situation but I have not found a way via software to force a CPU reset.
The docs for esp_restart() say "Peripherals (except for WiFi, BT, UART0, SPI1, and legacy timers) are not reset." So, is there a way from software to reset the peripherals that are not reset in that call?
I thought maybe I could do it with a watchdog reset, but I don't see a clear way to do that.
Thanks,
Jason
How to force a CPU reset?
Re: How to force a CPU reset?
Thank you!
Re: How to force a CPU reset?
I had exactly the same issue. Tried 5 or 6 different reset strategies (the functions provided, provoking the watchdogs etc)
Eventually I found that going into deep sleep and waking up on a timer a couple of seconds later would reset i2c. Maybe not always the first time, but it would get it eventually.
HTH.
Eventually I found that going into deep sleep and waking up on a timer a couple of seconds later would reset i2c. Maybe not always the first time, but it would get it eventually.
Code: Select all
static bool go_to_sleep(void)
{
esp_sleep_enable_timer_wakeup(SLEEP_TIME_US);
esp_deep_sleep_start();
}
Re: How to force a CPU reset?
What ESP-IDF version are you each using? (if using Arduino or something else with its own i2c libraries, please mention this.)
In recent ESP-IDF master branch, a change was added to always reset peripherals on startup:
https://github.com/espressif/esp-idf/co ... 1dd21dfde1
In recent ESP-IDF master branch, a change was added to always reset peripherals on startup:
https://github.com/espressif/esp-idf/co ... 1dd21dfde1
-
- Posts: 9708
- Joined: Thu Nov 26, 2015 4:08 am
Re: How to force a CPU reset?
No, not at all. It essentially just resets a bunch of flipflops to a default state, when looking at the chip level. You can theoretically have some higher-level effects, for instance when you reset the CPU in the middle of a flash write when the software cannot handle interrupted flash writes correctly, but the CPU itself doesn't mind being reset.Can forcing a CPU reset harm the CPU in any way btw? I'm just curious.
Re: How to force a CPU reset?
Hi ESP_Angus, sorry, I missed this reply the other day. In any case, I started usingESP_Angus wrote:What ESP-IDF version are you each using? (if using Arduino or something else with its own i2c libraries, please mention this.)
In recent ESP-IDF master branch, a change was added to always reset peripherals on startup:
https://github.com/espressif/esp-idf/co ... 1dd21dfde1
Code: Select all
periph_module_reset(PERIPH_I2C0_MODULE);
Thanks,
Jason
Who is online
Users browsing this forum: No registered users and 130 guests