Espressif ESP32-S2 Programming Manual page 1500

Table of Contents

Advertisement

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.
RTC_CNTL_RDY_FOR_WAKEUP is zero, it has no effect (wake up does not occur).
Examples:
1: is_rdy_for_wakeup:
READ_RTC_FIELD(RTC_CNTL_LOW_POWER_ST_REG, RTC_CNTL_RDY_FOR_WAKEUP)
AND r0, r0,
JUMP is_rdy_for_wakeup, eq
WAKE
REG_WR 0x006, 24, 24,
SLP_TIMER_EN)
HALT
//
After these instructions, SoC will wake up,
//
and
ULP will
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
2:
.set
wait_cnt,
WAIT
wait_cnt
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
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
1
0
not
run again until started by the main
//
Do nothing
10
//
Set a constant
//
wait
for
R1,
1000
//
Measure temperature sensor
//
and
Submit Document Feedback
If WAKE instruction is executed while
//
Read RTC_CNTL_RDY_FOR_WAKEUP bit
//
Retry until the bit
//
Trigger wake up
//
Stop ULP timer (clear RTC_CNTL_ULP_CP_
//
Stop the ULP program
for
10
cycles
10
cycles
store result to R1
1489
is set
program.
for
1000
cycles,
Release v4.4

Advertisement

Table of Contents
loading
Need help?

Need help?

Do you have a question about the ESP32-S2 and is the answer not in the manual?

Table of Contents

Save PDF