Blinking an LED in ULP crashes when an external interrupt is setup from the main CPU
Posted: Fri Dec 10, 2021 5:20 am
Hi all,
I have been attempting to set up a button press interrupt from the main CPU (easily done) while having the ULP still running.
I have run into an unexpected issue with using the function:
esp_sleep_enable_ext0_wakeup(Button, 0);
The ULP program is:
The main function in ULP works when "esp_sleep_enable_ext0_wakeup(Button, 0);" is commented out in the main processor, but crashes when its enabled (the interrupt function continues to work after the crash, doesn't work when commented out for obvious reasons).
The functions example_ulp_gpio_xxxx can be found here:
https://github.com/espressif/esp-idf/tr ... /gpio/main
The reason I know the processor is crashing is because it wakes up after about 3 flashes with the cause = ESP_SLEEP_WAKEUP_COCPU_TRAP_TRIG
Which is described here as a crash
Any idea how enabling an interrupt can crash the co-processor while doing basic LED operations?
Any help would be greatly appreciated.
Cheers
I have been attempting to set up a button press interrupt from the main CPU (easily done) while having the ULP still running.
I have run into an unexpected issue with using the function:
esp_sleep_enable_ext0_wakeup(Button, 0);
The ULP program is:
Code: Select all
[Codebox=c file=Untitled.c]
int main (void)
{
if (counter_state_for_ULP % 16 == 0) //Blink the LED every 4 seconds (ULP is setup to run every 250ms)
{
example_ulp_gpio_init(Membrane_LED_Yellow); //Intiate Yellow LED
example_ulp_gpio_output_enable(Membrane_LED_Yellow); //Enable output
example_ulp_gpio_output_level(Membrane_LED_Yellow, 1); //Set HIGH
wait(150000);//Small delay
example_ulp_gpio_output_level(Membrane_LED_Yellow, 0); //Set LOW
}
}
[/Codebox]
The functions example_ulp_gpio_xxxx can be found here:
https://github.com/espressif/esp-idf/tr ... /gpio/main
The reason I know the processor is crashing is because it wakes up after about 3 flashes with the cause = ESP_SLEEP_WAKEUP_COCPU_TRAP_TRIG
Which is described here as a crash
Any idea how enabling an interrupt can crash the co-processor while doing basic LED operations?
Any help would be greatly appreciated.
Cheers