Running similar code to this example and using the functions:
ulp_riscv_wakeup_main_processor();
ulp_riscv_shutdown();
I would have expected the shutdown function to do exactly as described and the co-processor more into HALT state or just off altogether and not run until initiated in the main CPU.
However this is not the case as demonstrated during power consumption measurements I have taken where the co-processor is meant to turn off while the main CPU is on. I am pulsing LED's during this period which makes it clear that the ULP remains on. I have attached an image showing the ULP and Main processor working at the same time even though the shutdown command is called at the same time as the wake_main_processor command.
When diving into the ulp_riscv_shutdown() function:
Code: Select all
void ulp_riscv_shutdown(void)
{
/* Setting the delay time after RISCV recv `DONE` signal, Ensure that action `RESET` can be executed in time. */
REG_SET_FIELD(RTC_CNTL_COCPU_CTRL_REG, RTC_CNTL_COCPU_SHUT_2_CLK_DIS, 0x3F);
/* suspends the ulp operation*/
SET_PERI_REG_MASK(RTC_CNTL_COCPU_CTRL_REG, RTC_CNTL_COCPU_DONE);
/* Resets the processor */
SET_PERI_REG_MASK(RTC_CNTL_COCPU_CTRL_REG, RTC_CNTL_COCPU_SHUT_RESET_EN);
while(1);
}
Before setting ULP-RISC-V to HALT, users should configure the register RTC_CNTL_COCPU_DONE first,
therefore, it is recommended to end the flashed program with the following pattern
– Set the register RTC_CNTL_COCPU_DONE to end the operation of ULP-RISC-V and put it into halt;
– Set the register RTC_CNTL_COCPU_SHUT_RESET_EN to reset ULP-RISC-V
(See Page 30)
If I remove the line for resetting the processor, the Co-processor crashes.
If I change:
SET_PERI_REG_MASK(RTC_CNTL_COCPU_CTRL_REG, RTC_CNTL_COCPU_SHUT_RESET_EN);
To
SET_PERI_REG_MASK(RTC_CNTL_COCPU_CTRL_REG, RTC_CNTL_COCPU_SHUT);
The co-processor crashes.
My question is simple, how do I turn off the co-processor?
Cheers,
Dylan