Skip to content

Commit

Permalink
ulp-riscv: always force COCPU clock on S3
Browse files Browse the repository at this point in the history
The coprocessor cpu trap signal doesnt have a stable reset value,
force ULP-RISC-V clock on to stop RTC_COCPU_TRAP_TRIG_EN from waking the CPU
  • Loading branch information
ESP-Marius committed Oct 25, 2022
1 parent dbf8cd5 commit cd634f7
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions components/ulp/ulp_riscv/ulp_riscv.c
Original file line number Diff line number Diff line change
Expand Up @@ -73,12 +73,15 @@ esp_err_t ulp_riscv_config_and_run(ulp_riscv_cfg_t* cfg)

#elif CONFIG_IDF_TARGET_ESP32S3
/* Reset COCPU when power on. */
SET_PERI_REG_MASK(RTC_CNTL_COCPU_CTRL_REG, RTC_CNTL_COCPU_CLK_FO);
SET_PERI_REG_MASK(RTC_CNTL_COCPU_CTRL_REG, RTC_CNTL_COCPU_SHUT_RESET_EN);
esp_rom_delay_us(20);
CLEAR_PERI_REG_MASK(RTC_CNTL_COCPU_CTRL_REG, RTC_CNTL_COCPU_CLK_FO);
CLEAR_PERI_REG_MASK(RTC_CNTL_COCPU_CTRL_REG, RTC_CNTL_COCPU_SHUT_RESET_EN);

/* The coprocessor cpu trap signal doesnt have a stable reset value,
force ULP-RISC-V clock on to stop RTC_COCPU_TRAP_TRIG_EN from waking the CPU*/
SET_PERI_REG_MASK(RTC_CNTL_COCPU_CTRL_REG, RTC_CNTL_COCPU_CLK_FO);


/* Disable ULP timer */
CLEAR_PERI_REG_MASK(RTC_CNTL_ULP_CP_TIMER_REG, RTC_CNTL_ULP_CP_SLP_TIMER_EN);
/* wait for at least 1 RTC_SLOW_CLK cycle */
Expand Down

0 comments on commit cd634f7

Please sign in to comment.