Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Requesting a WAKE example #75

Open
@wz2b

Description

@wz2b

I would like an example of how to use WAKE because I'm not quite sure how it's supposed to work. I'll contribute one if I can, but right now it doesn't work. Should it?

## Example of putting the main processor to sleep then waking it up# via the ULP after a while#fromesp32importULPfrommachineimportmem32importmachinefromesp32_ulpimportsrc_to_binarysource="""\#define RTC_CNTL_LOW_POWER_ST_REG 0x3FF480c0#define RTC_CNTL_RDY_FOR_WAKEUP BIT(19)entry:        MOVE r0, 2000loop:        WAIT 40000  // at 8 MHz this is 5 msec, if we do this 1000 times that's 5 seconds        SUB r0, r0, 1        jump is_rdy_for_wakeup, eq        jump loopis_rdy_for_wakeup:                   // Read RTC_CNTL_RDY_FOR_WAKEUP bit## This test was described in https://github.com/espressif/esp-idf/issues/8341# See reference manual 31.19.## The main issue with this is that it will hang if the main CPU wasn't in deep sleep.#       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       HALT                          // Stop the ULP program"""## Compile the ULP code#binary=src_to_binary(source)load_addr,entry_addr=0,0ULP_MEM_BASE=0x50000000ULP_DATA_MASK=0xffff# ULP data is only in lower 16 bitsulp=ULP()ulp.load_binary(load_addr,binary)## The ULP starts out asleep (halted), so set a timer to wake it# up the first time.## ulp.set_wakeup_period(0, 50000)  # use timer0, wakeup after 50.000 cyclesmem32[ULP_MEM_BASE+load_addr]=0x1000ulp.run(entry_addr)print("going to sleep")# I think this should enable ULP wakeupmem32[0x3ff48038 ]=0x200<<10machine.deepsleep()## We won't ever reach this, because WAKE is going to cause the main# processor to reset and start over at the beginning.#print("I am awake again")

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions


      [8]ページ先頭

      ©2009-2025 Movatter.jp