Git Product home page Git Product logo

Comments (3)

wnienhaus avatar wnienhaus commented on August 28, 2024 1

@wz2b I have now merged the fix. Thanks again for reporting it.

from micropython-esp32-ulp.

wnienhaus avatar wnienhaus commented on August 28, 2024

You are very correct. That code is indeed incorrect. Some bad copy-pasting that happened to work(ish).

The correct way would be to set the port to output enabled once with this instruction:

WRITE_RTC_REG(RTC_GPIO_ENABLE_W1TS_REG, RTC_GPIO_ENABLE_W1TS_S + gpio, 1, 1)

and then to toggle the LED on and off with these instructions:

//on
WRITE_RTC_REG(RTC_GPIO_OUT_REG, RTC_GPIO_OUT_DATA_S + gpio, 1, 1)

//off
WRITE_RTC_REG(RTC_GPIO_OUT_REG, RTC_GPIO_OUT_DATA_S + gpio, 1, 0)

Alternatively one can use the RTC_GPIO_OUT_W1TS_REG and RTC_GPIO_OUT_W1TC_REG registers, but I prefer the RTC_GPIO_OUT_REG approach. I am not sure why there are two ways to do this.

I just tested this with a power profiler (nordic PPK2), which supports reading in logic signals alongside the power profile. When I connect my GPIO output to the logic port with the current (wrong) blink.py code, I can see the initial low to high transition, but the logic port never "sees" a low again (I guess with "output enable" turned off the pull-down is also disabled and the pin is left floating).

When I instead fix the code as per above, I correctly see the highs and lows of the GPIO output from via the logic port.

Thanks for picking this up. I will create a PR for this soon.

from micropython-esp32-ulp.

wz2b avatar wz2b commented on August 28, 2024

Great, thanks explaining - I thought that was what was going on, but I'm using these examples to learn how to make a virtual SPI port in the ULP and I'm not quite used to the GPIO/RTC muxes in this thing yet.

from micropython-esp32-ulp.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.