RTC slow memory appears to be cleared after ULP wakeup

jtleniger
Posts: 1
Joined: Sun Jan 16, 2022 9:32 pm

RTC slow memory appears to be cleared after ULP wakeup

Postby jtleniger » Sun Jan 16, 2022 9:40 pm

I'm using the ulpcc compiler to generate assembly for the ULP coprocessor. I have two arrays declared:

Code: Select all

unsigned int rain_readings[MAX_READING];
unsigned int wind_readings[MAX_READING];
The ulpcc compiler creates globals from these in assembly:

Code: Select all

    .global wind_readings
wind_readings:
    .space 120
    .global rain_readings
rain_readings:
    .space 120
And I can access them as expected in the main code using:

Code: Select all

extern uint32_t ulp_wind_readings;
extern uint32_t ulp_rain_readings;
The ULP code watches for edges on some GPIO and sets values in these arrays as it runs, and after a certain amount of time, issues a wake command.

I don't believe there are issues with the ULP code, as when I run it without entering deep sleep, these arrays are populated as expected and can be read by the main program.

However, if run the ULP code and enter deep sleep as follows:

Code: Select all

  err = ulp_load_binary(0, ulp_main_bin_start, (ulp_main_bin_end - ulp_main_bin_start) / sizeof(uint32_t));
  ESP_ERROR_CHECK(err);

  ulp_set_wakeup_period(0, 20000);

  err = esp_sleep_enable_ulp_wakeup();
  ESP_ERROR_CHECK(err);

  err = ulp_run(&ulp_entry - RTC_SLOW_MEM);
  ESP_ERROR_CHECK(err);

  esp_deep_sleep_start();
Upon waking, the memory appears to be cleared, as both arrays only contain zeroes.

Any ideas?

Who is online

Users browsing this forum: ESP_Dazz, Majestic-12 [Bot], MicroController and 108 guests