Welcome to the Pycom forum Forum
    • \[\[global:header.categories\]\]
    • \[\[global:header.recent\]\]
    • \[\[global:header.tags\]\]
    • \[\[global:header.popular\]\]
    • Login

    Explore Pybytes | Official Documentation | Report a Firmware Bug/Issue | GitHub

    ESP register access

    Scheduled Pinned Locked Moved MicroPython
    2 Posts 2 Posters 218 Views 2 Watching
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • E Offline
      Elizar
      last edited by

      Hi folks,

      I try to use P20 of Gpy as a digital input but the pin is constantly read as zero. There is an external pull-up and the pin is configured for input, too. The other pins around are working perfectly.

      According to the manual P20 is internally connected to GPIO33 of the ESP. And there appears to be a configuration problem regarding the RTC (realtime clock).

      I need to do something like (C-Code):

      /* gpio33 route to digital io_mux */
      REG_CLR_BIT(RTC_IO_XTAL_32K_PAD_REG, RTC_IO_X32N_MUX_SEL);

      in micropython. Is that possible?

      Via uctypes? Inline-Assembler? Any ideas?

      Or, to ask more general: is it possible to access the ESP32 configuration registers from micropython at all?

      robert-hhR 1 Reply Last reply Reply Quote 0
      • robert-hhR Offline
        robert-hh @Elizar
        last edited by robert-hh

        @Elizar P20 can be used for the XTAL, but you have to attach it. Otherwise you can use it as normal GPIO pin.
        You can access the GPIO registers via machine.mem32.
        hex(machine.mem32[0x3FF44004]) will give you the hex value of the GPIO output register. Writing to it will change the output bits.
        machine.mem32[0x3FF44008] = 0x10 will set GPIO4 (P3) to high, without affecting the other GPIO pins, if it was configure for output.

        See the esp32 reference manual for the set of GPIO registers and it's options.
        Edit: Inline-Assembler or Viper code in not supported by the Pycom dialect of MicroPython

        1 Reply Last reply Reply Quote 0

        Hello! It looks like you're interested in this conversation, but you don't have an account yet.

        Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

        With your input, this post could be even better 💗

        Register Login
        • 1 / 1
        • First post
          Last post

        Pycom on Twitter

        Pycom