Questions about ULP in deep sleep

chegewara
Posts: 2240
Joined: Wed Jun 14, 2017 9:00 pm

Questions about ULP in deep sleep

Postby chegewara » Sun Dec 08, 2019 12:58 pm

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.

boarchuz
Posts: 566
Joined: Tue Aug 21, 2018 5:28 am

Re: Questions about ULP in deep sleep

Postby boarchuz » Sun Dec 08, 2019 4:39 pm

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]

Who is online

Users browsing this forum: No registered users and 241 guests