ULP equivalent for rtc_gpio_init() ? [solved]

User avatar
joba-1
Posts: 10
Joined: Mon Jan 28, 2019 12:26 am

ULP equivalent for rtc_gpio_init() ? [solved]

Postby joba-1 » Mon Jan 28, 2019 1:06 am

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
Last edited by joba-1 on Tue Jan 29, 2019 11:42 pm, edited 1 time in total.

User avatar
joba-1
Posts: 10
Joined: Mon Jan 28, 2019 12:26 am

Re: ULP equivalent for rtc_gpio_init() ?

Postby joba-1 » Tue Jan 29, 2019 11:29 pm

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...

apuder
Posts: 53
Joined: Mon Mar 26, 2018 7:27 pm

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

Postby apuder » Mon May 24, 2021 3:53 am

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

Who is online

Users browsing this forum: jsmith56x and 293 guests