Skip to content

Instantly share code, notes, and snippets.

@boarchuz
Last active January 19, 2022 17:40
Show Gist options
  • Save boarchuz/1a40a66977334feef4d341b61388436f to your computer and use it in GitHub Desktop.
Save boarchuz/1a40a66977334feef4d341b61388436f to your computer and use it in GitHub Desktop.
ESP32 RTC Reset
#include "soc/rtc_cntl_struct.h"
#include "hal/wdt_types.h"
#include "hal/rwdt_ll.h"
void __attribute__((noreturn)) esp_rtc_reset(void)
{
rwdt_ll_write_protect_disable(&RTCCNTL);
rwdt_ll_disable(&RTCCNTL);
rwdt_ll_config_stage(&RTCCNTL, WDT_STAGE0, 0, WDT_STAGE_ACTION_RESET_RTC);
rwdt_ll_disable_stage(&RTCCNTL, WDT_STAGE1);
rwdt_ll_disable_stage(&RTCCNTL, WDT_STAGE2);
rwdt_ll_disable_stage(&RTCCNTL, WDT_STAGE3);
rwdt_ll_set_sys_reset_length(&RTCCNTL, WDT_RESET_SIG_LENGTH_3_2us);
rwdt_ll_feed(&RTCCNTL);
rwdt_ll_enable(&RTCCNTL);
rwdt_ll_write_protect_enable(&RTCCNTL);
for(;;);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment