ULP Instruction set passing value with global variables
Posted: Sat Apr 02, 2022 11:59 am
Hello there, I'm trying to enable some GPIO's using the ULP while the main processor are in deep sleep mode.
I accomplish this without problems using the ULP examples and enabling the RTC_GPIO_OUT_REG register. Just like the code below:
However, I couldn't enable the RTC GPIO 12 using a variable passed by the main processor. The code below shows the instructions that works and what didn't work and I would like to do.
So, how could I use here a global variable with the GPIO value I want to activate?
Thanks,
Victor
I accomplish this without problems using the ULP examples and enabling the RTC_GPIO_OUT_REG register. Just like the code below:
- // Enable RTC GPIO 12, which is equivalent to GPIO2
- WRITE_RTC_REG(RTC_GPIO_OUT, REG, RTC_GPIO_OUT_DATA_S+12, 1, 1)
- .set gpio_num, 12 // Create a constant with constains the value 12
- .bss
- // Create a variable gpio_var and add the value 12 from the main code as showed in the ULP Example
- .global gpio_var
- gpio_var: .long 0
- // This instruction using a constant works! Because I am passing the value and not the address
- WRITE_RTC_REG(RTC_GPIO_OUT, REG, RTC_GPIO_OUT_DATA_S+gpio_num, 1, 1)
- // This instruction cause an compilation error, probably because I a, passing the address instead the value
- WRITE_RTC_REG(RTC_GPIO_OUT, REG, RTC_GPIO_OUT_DATA_S+gpio_var, 1, 1)
Thanks,
Victor