Page 1 of 1

Use ULP to blink LED

Posted: Sat Jun 05, 2021 6:03 am
by apuder
Hi,

I have been looking at this example where the author used the ULP to make an LED blink:
https://github.com/joba-1/Blink-ULP

The example uses GPIO 2 (RTC GPIO 12) to connect the LED. I tried unsuccessfully to change the example to make use of GPIO 25. According to table 4.4 of the TRM GPIO 25 is equivalent to RTC GPIO 6. The blink example uses RTC_IO_TOUCH_PAD2_REG to set the digital function for RTC GPIO 12. There is no corresponding register for RTC GPIO 6, so my question is if it is possible to use GPIO 25 and if yes, how to configure RTC IO_MUX.

TIA,
AP

Re: Use ULP to blink LED

Posted: Sat Jun 05, 2021 7:22 am
by WiFive
RTC_IO_PAD_DAC1_REG

Re: Use ULP to blink LED

Posted: Sun Jun 06, 2021 4:15 am
by apuder
Thanks, that helped. I got it to work with:

Code: Select all

WRITE_RTC_REG(RTC_IO_PAD_DAC1_REG, 17, 1, 1)
WRITE_RTC_REG(RTC_IO_PAD_DAC1_REG, 15, 2, 0)
AP

Re: Use ULP to blink LED

Posted: Fri Aug 13, 2021 9:26 pm
by mezzynine
I got it to blink with the following. My LED is on RTC_GPIO6 (RTC_GPIO_OUT_DATA_S+6), same as GPIO25 (see https://www.programmersought.com/article/40455220487/). The code is taken from https://codingfield.com/en/2019/01/15/u ... le-simple/.

Code: Select all

loop1:
    WRITE_RTC_REG(RTC_GPIO_OUT_REG,RTC_GPIO_OUT_DATA_S+6,1,1)
    WAIT 65535
    WAIT 65535
[...]
    WAIT 65535
    WRITE_RTC_REG(RTC_GPIO_OUT_REG,RTC_GPIO_OUT_DATA_S+6,1,0)
    WAIT 65535
    WAIT 65535
[...]
    WAIT 65535
    JUMP loop1