Difference between esp_reset_reason() and rtc_get_reset_reason(int cpuNo)

LGermano
Posts: 3
Joined: Wed Nov 30, 2022 12:13 am

Difference between esp_reset_reason() and rtc_get_reset_reason(int cpuNo)

Postby LGermano » Mon Jul 31, 2023 1:01 pm

What is the difference between esp_reset_reason() and rtc_get_reset_reason(int cpuNo) for ESP32 and respective descriptions of the return codes of each of the functions?

ESP_igrr
Posts: 2067
Joined: Tue Dec 01, 2015 8:37 am

Re: Difference between esp_reset_reason() and rtc_get_reset_reason(int cpuNo)

Postby ESP_igrr » Mon Jul 31, 2023 9:51 pm

esp_reset_reason is a public API provided in IDF, you can find the description here: https://docs.espressif.com/projects/esp ... set-reason


rtc_get_reset_reason is a lower level function implemented in the ROM code, which simply returns the reset reason value captured by the hardware. As such it can't distinguish between various causes of software reset (for example: esp_restart() being called or a CPU exception occurring). Return values of this function are chip-specific, the values can be found in rom/rtc.h header file.

In pretty much every case in an IDF application it is better to use esp_reset_reason().

Who is online

Users browsing this forum: No registered users and 88 guests