RTC Boot (Slow Memory)

boarchuz
Posts: 601
Joined: Tue Aug 21, 2018 5:28 am

RTC Boot (Slow Memory)

Postby boarchuz » Mon Jun 26, 2023 1:11 am

The ESP32 TRM describes two RTC boot methods in 31.3.13. The second method, using RTC fast memory, is implemented in ESP-IDF (eg. esp_set_deep_sleep_wake_stub), however I can't find any references for the little-known first method. This uses RTC slow memory, and the TRM suggests that it might be a bit quicker:
The first method is to use the RTC slow memory:
1. Set register RTC_CNTL_PROCPU_STAT_VECTOR_SEL for PRO_CPU (or register RTC_CNTL_APPCPU_STAT_VECTOR_for APP_CPU) to 0.
2. Put the chip into sleep.
3. When the CPU is powered up, the reset vector starts from 0x50000000, instead of 0x40000400. ROM
unpacking & SPI boot are not needed. The code in RTC memory has to do itself some initialization for the C
program environment.
I've tried following the steps described with a simple stub setup like this:

Code: Select all

0x50000000: my_rtc_slow_stub // Very basic function to ensure entry is 0x50000000
	call4 my_rtc_slow_stub_loop
0x50001000: my_rtc_slow_stub_loop
	for(;;) REG_SET_PIN_LEVEL(rtc_pin_num, 1);	
I've confirmed that the stub entry is at 0x50000000, RTC slow memory is powered up, however all I'm getting is WDT resets. Interestingly, the stub even works correctly using the second method, despite not being in RTC fast mem.

Does anyone have any insight? Would any "initialization for C" actually be required here?

boarchuz
Posts: 601
Joined: Tue Aug 21, 2018 5:28 am

Re: RTC Boot (Slow Memory)

Postby boarchuz » Sat Mar 30, 2024 12:26 pm

If anyone is curious, I now have a working example of this here: https://github.com/boarchuz/esp32_rtc_boot

For reference, it takes about 500us from my EXT1 pin going low to my function being called. This is less than half the time it takes to enter the typical RTC wakeup stub.

MicroController
Posts: 1605
Joined: Mon Oct 17, 2022 7:38 pm
Location: Europe, Germany

Re: RTC Boot (Slow Memory)

Postby MicroController » Sun Mar 31, 2024 1:18 pm

boarchuz wrote:
Sat Mar 30, 2024 12:26 pm
If anyone is curious, I now have a working example of this here: https://github.com/boarchuz/esp32_rtc_boot

For reference, it takes about 500us from my EXT1 pin going low to my function being called. This is less than half the time it takes to enter the typical RTC wakeup stub.
Pretty cool 8-) Thanks for sharing that info.

Who is online

Users browsing this forum: Bing [Bot] and 72 guests