Skip to content

Trap wakeup #1

Open
Open
@MabezDev

Description

@MabezDev

Moved from esp-rs/embuild#3

Largish: the main CPU does NOT go to sleep as expected, but immediately resets when I tell it to go to sleep. I suspect the ULP bootstrapping code somehow generates a trap (maybe I've still missed an invalid instruction or something in the bootstrapping code I copied from the riscv crate), and because of that, the main CPU is awoken immediately. In the meantime, the ULP program is executed though, the LED (my voltmetter actually) blinks, etc. I'm a bit at a loss what I might be missing here

Commenting out the launching of the ULP app and esp32s2 goes into a deep sleep and stays there for about a minute - it must be ulp related.

I added some code to print the sleep wake up reason and I got the following:

rust_esp32_std_hello: Sleep wake up reason: 0x0B

Looking at the IDF source:

typedef enum {
    ESP_SLEEP_WAKEUP_UNDEFINED,    //!< In case of deep sleep, reset was not caused by exit from deep sleep
    ESP_SLEEP_WAKEUP_ALL,          //!< Not a wakeup cause, used to disable all wakeup sources with esp_sleep_disable_wakeup_source
    ESP_SLEEP_WAKEUP_EXT0,         //!< Wakeup caused by external signal using RTC_IO
    ESP_SLEEP_WAKEUP_EXT1,         //!< Wakeup caused by external signal using RTC_CNTL
    ESP_SLEEP_WAKEUP_TIMER,        //!< Wakeup caused by timer
    ESP_SLEEP_WAKEUP_TOUCHPAD,     //!< Wakeup caused by touchpad
    ESP_SLEEP_WAKEUP_ULP,          //!< Wakeup caused by ULP program
    ESP_SLEEP_WAKEUP_GPIO,         //!< Wakeup caused by GPIO (light sleep only)
    ESP_SLEEP_WAKEUP_UART,         //!< Wakeup caused by UART (light sleep only)
    ESP_SLEEP_WAKEUP_WIFI,              //!< Wakeup caused by WIFI (light sleep only)
    ESP_SLEEP_WAKEUP_COCPU,             //!< Wakeup caused by COCPU int
    ESP_SLEEP_WAKEUP_COCPU_TRAP_TRIG,   //!< Wakeup caused by COCPU crash
    ESP_SLEEP_WAKEUP_BT,           //!< Wakeup caused by BT (light sleep only)
} esp_sleep_source_t;

We can in fact see the wake up cause is ESP_SLEEP_WAKEUP_COCPU_TRAP_TRIG.

However like, I put my multimeter on pin 5 and can see it blinking too - very strange behavior.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions