Page 1 of 1

How to write to the RTC slow memory using ULP ?

Posted: Thu Nov 22, 2018 10:36 am
by alok.yadav
So I am trying to write an assembly code in which I want to store a 16 bits and 8 bits and 1 bit data to be available after wakeup. But due to some basic misunderstanding I am not able to comprehend how to do that. There are WRITE_RTC_FIELD nad WRITE_RTC_REG which need an rtc_reg to be specified. But all registers have some purpose and I am not able to find a register which i am sure of have been unused.

Also as I saw the RTC register addresses defined in the soc.h, rtc_io_reg.h and rtc_i2c_reg.h. lying in the peripheral memory.
Kindly guide me as to can I define registers like in above files, to store the data. If yes then how?

Also if there is something very basic I am missing out kindly tell me.
how to store data to be accessed by ULP on wakeup.

Re: How to write to the RTC slow memory using ULP ?

Posted: Thu Nov 22, 2018 11:44 am
by ESP_krzychb
Hi alok.yadav,

Both WRITE_RTC_FIELD and WRITE_RTC_REG are dedicated macros to write information to ESP32 configuration registers, not to store some user data in general.

If you like to store your data then check example how to write an array in ULP documentation.

There are some more examples how to manipulate user values in:
- esp-idf/examples/system folder. e.g. increment sample counter
- esp-iot-solution/examples/ulp_examples, e.g. store last_result

Re: How to write to the RTC slow memory using ULP ?

Posted: Thu Nov 22, 2018 12:00 pm
by alok.yadav
Hello krzychb

Thank you for such a prompt reply. So do you eman to say that when use the store instruction as shown in the examples you have mentioned. They are retained even after the deep sleep ?

Re: How to write to the RTC slow memory using ULP ?

Posted: Thu Nov 22, 2018 12:28 pm
by ESP_krzychb
Hello alok.yadav,
Yes, but the best way to check it, is by running the ULP program by yourself :)
Try ULP Pulse Counting Example. In this case pulse count (edge_count) is retained.