Page 1 of 1

Questions about ULP in deep sleep

Posted: Sun Dec 08, 2019 12:58 pm
by chegewara
I have few questions about using ULP in deep sleep.
1. Is there option to read RTC clock in ULP code
2. I am looking for ULP I2C example, but not the bitbanging, but using I2C_Read and I2C_Write assembler commands (not very important).

Thanks in advance.

Re: Questions about ULP in deep sleep

Posted: Sun Dec 08, 2019 4:39 pm
by boarchuz
1. It works the same as reading any other register.
The only thing to keep in mind is that you need to flag the RTC controller to update the register with the current tick count beforehand.
Using macros:

Code: Select all

I_WR_REG_BIT(RTC_CNTL_TIME_UPDATE_REG, RTC_CNTL_TIME_UPDATE_S, 1), //Set update bit
I_RD_REG(RTC_CNTL_TIME_UPDATE_REG, RTC_CNTL_TIME_VALID_S, RTC_CNTL_TIME_VALID_S), //Get updated bit
I_BL(-1,1), //Poll until ready
I_RD_REG(RTC_CNTL_TIME0_REG, 0, 15), //eg. Read [15:0]