Esp32-s2 Co-processor does not shutdown with shutdown command

DylanWork
Posts: 32
Joined: Wed Jun 02, 2021 4:27 am

Esp32-s2 Co-processor does not shutdown with shutdown command

Postby DylanWork » Tue Jan 11, 2022 3:30 am

Hi all,

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);
}
The technical reference guide shows this as how the shutdown process should occur:
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
Attachments
MCUandULP.png
MCUandULP.png (25.96 KiB) Viewed 4873 times

DylanWork
Posts: 32
Joined: Wed Jun 02, 2021 4:27 am

Re: Esp32-s2 Co-processor does not shutdown with shutdown command

Postby DylanWork » Thu Jan 13, 2022 1:25 am

Hi all,

Just bumping this and hoping to ask an open question to whoever is looking through my posts.

I have posted a few questions relating to the ESP32-S2 co-processor and related items, but I don't appear to be getting answers.

Am I not giving enough detail, or is my posting style confusing, or is this topic just more technical than people are able to answer?

Would be great if I could get any response even if it's just "Sorry, too hard" or "You don't make any sense".

Cheers,
Dylan

ESP_Sprite
Posts: 9766
Joined: Thu Nov 26, 2015 4:08 am

Re: Esp32-s2 Co-processor does not shutdown with shutdown command

Postby ESP_Sprite » Thu Jan 13, 2022 9:48 am

I think it's too technical. Given the fact that this can be seen as a bug (as in: a function that purports to shut down the ULP does not do that), you may have more luck posting it on the ESP-IDF Github repo as an issue.

DylanWork
Posts: 32
Joined: Wed Jun 02, 2021 4:27 am

Re: Esp32-s2 Co-processor does not shutdown with shutdown command

Postby DylanWork » Thu Jan 13, 2022 12:15 pm

Ok, thank you for responding.

I'll submit an issue on github and post back here when it gets resolved to help with anyone in the future.

Cheers,
Dylan

Who is online

Users browsing this forum: No registered users and 105 guests