Chapter 4. API Guides
Note that before using WAKE instruction, ULP program may needs to wait until RTC controller
is ready to wake up the main CPU. This is indicated using RTC_CNTL_RDY_FOR_WAKEUP
bit of RTC_CNTL_LOW_POWER_ST_REG register. If WAKE instruction is executed while
RTC_CNTL_RDY_FOR_WAKEUP is zero, it has no effect (wake up does not occur).
Examples:
1: is_rdy_for_wakeup: // Read RTC_CNTL_RDY_FOR_WAKEUP bit
READ_RTC_FIELD(RTC_CNTL_LOW_POWER_ST_REG, RTC_CNTL_RDY_FOR_WAKEUP)
AND r0, r0, 1
JUMP is_rdy_for_wakeup, eq // Retry until the bit is set
WAKE // Trigger wake up
REG_WR 0x006, 24, 24, 0 // Stop ULP timer (clear RTC_CNTL_ULP_CP_
,→SLP_TIMER_EN)
HALT // Stop the ULP program
// After these instructions, SoC will wake up,
// and ULP will not run again until started by the main program.
WAIT –wait some number of cycles
Syntax WAIT Cycles
Operands
• Cycles –number of cycles for wait
Cycles 2 + Cycles cycles to execute, 4 cycles to fetch next instruction
Description The instruction delays for given number of cycles.
Examples:
1: WAIT 10 // Do nothing for 10 cycles
2: .set wait_cnt, 10 // Set a constant
WAIT wait_cnt // wait for 10 cycles
TSENS –do measurement with temperature sensor
Syntax
• TSENS Rdst, Wait_Delay
Operands
• Rdst –Destination Register R[0..3], result will be stored to this register
• Wait_Delay –number of cycles used to perform the measurement
Cycles 2 + Wait_Delay + 3 * TSENS_CLK to execute, 4 cycles to fetch next instruction
Description The instruction performs measurement using TSENS and stores the result into a general purpose reg-
ister.
Examples:
1: TSENS R1, 1000 // Measure temperature sensor for 1000 cycles,
// and store result to R1
ADC –do measurement with ADC
Syntax
• ADC Rdst, Sar_sel, Mux
• ADC Rdst, Sar_sel, Mux, 0 —deprecated form
Operands
• Rdst –Destination Register R[0..3], result will be stored to this register
• Sar_sel –Select ADC: 0 = SARADC1, 1 = SARADC2
Espressif Systems 1489
Submit Document Feedback
Release v4.4