How to write to the RTC slow memory using ULP ?

alok.yadav
Posts: 4
Joined: Thu Nov 22, 2018 10:03 am

How to write to the RTC slow memory using ULP ?

Postby alok.yadav » Thu Nov 22, 2018 10:36 am

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.

User avatar
ESP_krzychb
Posts: 400
Joined: Sat Oct 01, 2016 9:05 am
Contact:

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

Postby ESP_krzychb » Thu Nov 22, 2018 11:44 am

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

alok.yadav
Posts: 4
Joined: Thu Nov 22, 2018 10:03 am

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

Postby alok.yadav » Thu Nov 22, 2018 12:00 pm

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 ?

User avatar
ESP_krzychb
Posts: 400
Joined: Sat Oct 01, 2016 9:05 am
Contact:

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

Postby ESP_krzychb » Thu Nov 22, 2018 12:28 pm

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.

Who is online

Users browsing this forum: No registered users and 20 guests