Qeustions re: the ULP Timer and RTC register manipulation

wevets
Posts: 112
Joined: Sat Mar 09, 2019 2:56 am

Qeustions re: the ULP Timer and RTC register manipulation

Postby wevets » Sat Nov 02, 2019 9:58 pm

I can’t figure out how to set a bit, specifically, RTC_CNTL_ULP_CP_SLP_TIMER_EN in the RTC_CNTL_STATE0_REG at 0x3FF48018 (page 645 of the TRM)
What I want to do is to clear this bit from the ULP when waking the system and halting the ULP so the ULP doesn’t restart when the system is awake.
I can do that with “reg_wr 0x006, 24, 24, 0” within the ULP code after a “wake” instruction and before a “halt” instruction. This works, but also seems to prevent the ULP timer from running again.

As near as I can tell, the ULP does not run if the RTC_CNTL_ULP_CP_SLP_TIMER_EN bit is reset. Before restarting the ULP and putting the system in to deep sleep again, to re-enable the ULP timer, to set that bit, I’ve tried
#include "soc/rtc_cntl_reg.h"
#include "soc/dport_access.h"

WRITE_RTC_FIELD(RTC_CNTL_STATE0_REG, RTC_CNTL_ULP_CP_SLP_TIMER_EN, 1)
And alternately:
DPORT_REG_SET_FIELD(RTC_CNTL_STATE0_REG, RTC_CNTL_ULP_CP_SLP_TIMER_EN, 1 );

Either way, my minimal test programs compile and assemble without error. But neither of these macro calls seems to actually set the …TIMER_EN bit from within the C program running on the system.
What am I doing wrong and/or how to I accomplish what I want to do? There seem to be no examples (that I can find) of writing/reading to these ULP control registers from C.

Documentation of these things is pretty sparse. And while I’m talking about documentation, in the TRM documentation for the ULP REG_RD and REG_WR instructions, there’s mention of the DR_REG_RTCCNTL_BASE, DR_REG_RTCIO_BASE, DR_REG_SENS_BASE and DR_REG_RTC_I2C_BASE registers, but no there is there mention of what those things mean in the TRM. I had to search through the esp_idf, grepping for those strings, to find out their definitions precisely. It makes sense to me now (apparently not enough sense), but documentation should be clearer than that.


wevets
Posts: 112
Joined: Sat Mar 09, 2019 2:56 am

Re: Qeustions re: the ULP Timer and RTC register manipulation

Postby wevets » Sun Nov 03, 2019 3:55 am

Thanks very much for the quick response. I'll check it out.

Who is online

Users browsing this forum: No registered users and 119 guests