Page 1 of 1

ULP equivalent for rtc_gpio_init() ? [solved]

Posted: Mon Jan 28, 2019 1:06 am
by joba-1
Hi ESP32 ULP friends,

I wrote a simple ULP blink programm, and it basically works.

But my goal was to use the main core just for loading and starting the ULP code, nothing else.
Unfortunately the led at GPIO2 stays off if I don't do a rtc_gpio_init(2) in the main core first.
Is it not possible to do the equivalent from within the ULP copro?

Here is what I tried, maybe you see the error?

main.c: https://github.com/joba-1/Blink-ULP/blo ... main.c#L16
blink.S: https://github.com/joba-1/Blink-ULP/blo ... link.S#L18

Code: Select all

// This tries to mimic rtc_gpio_init(GPIO_NUM_2), but does not work yet :(
WRITE_RTC_REG(RTC_IO_TOUCH_PAD2_REG, RTC_IO_TOUCH_PAD2_MUX_SEL_M, 1, 1)
WRITE_RTC_REG(RTC_IO_TOUCH_PAD2_REG, RTC_IO_TOUCH_PAD2_FUN_SEL_M, 1, 0)
Regards, Joachim

Re: ULP equivalent for rtc_gpio_init() ?

Posted: Tue Jan 29, 2019 11:29 pm
by joba-1
This finally did the trick:

Code: Select all

WRITE_RTC_REG(RTC_IO_TOUCH_PAD2_REG, RTC_IO_TOUCH_PAD2_MUX_SEL_S, 1, 1)
Puzzle solved, on to the next level...

Re: ULP equivalent for rtc_gpio_init() ? [solved]

Posted: Mon May 24, 2021 3:53 am
by apuder
Thanks for your example! I'm trying to do the opposite: do the initialization on the main CPU and then let the ULP do the blinking. I commented out the two WRITE_RTC_REG to initialize GPIO_NUM_2 and then tried:

Code: Select all

rtc_gpio_init(GPIO_NUM_2);
rtc_gpio_set_direction(GPIO_NUM_2, RTC_GPIO_MODE_OUTPUT_ONLY);
However, that no longer works. Any idea why?

AP