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

    Access to all 3 UARTS on ESP32

    Scheduled Pinned Locked Moved Firmware
    esp32
    11 Posts 4 Posters 6.7k Views 4 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.
    • T Offline
      TravisT
      last edited by

      Hello,

      I have an application were I need a UART, REPL and SD Card. It would appear that the SD card uses pins from UART 1, and UART 0 us used by the REPL and for programming. There is a 3rd UART on the ESP32 but it does not appear to be available on the Pycom modules.

      Is there access to UART2? If so how can it be configured?

      Thanks

      J 1 Reply Last reply Reply Quote 0
      • J Offline
        jmarcelino @TravisT
        last edited by jmarcelino

        @travist
        As with other peripherals you can remap the UART1 pins to ones which don’t conflict, just add the additional parameter pins=(TXD, RXD, RTS, CTS) when you init the UART, replacing TXD,RXD etc with your desired pin numbers

        1 Reply Last reply Reply Quote 0
        • T Offline
          TravisT
          last edited by

          Thanks,

          This sounds almost too easy. Can you provide more concrete example or link to documentation using Micropython to reassign pins?

          I guess I figured that it was more involved and possibly a compile time configuration.

          J 1 Reply Last reply Reply Quote 0
          • J Offline
            jmarcelino @TravisT
            last edited by jmarcelino

            @travist
            It’s easy because the ESP32 has an internal multiplex. You can do this for SPI and I2C as well, only very high speed ports (e.g Ethernet RMII) don’t.

            The explanation is on the UART doc page for UART.init()

            https://docs.pycom.io/chapter/firmwareapi/pycom/machine/UART.html

            pins is a 4 or 2 item list indicating the TXD, RXD, RTS and CTS pins (in that order). Any of the pins can be None if one wants the UART to operate with limited functionality. If the RTS pin is given the the RX pin must be given as well. The same applies to CTS. When no pins are given, then the default set of TXD (P1) and RXD (P0) pins is taken, and hardware flow control will be disabled. If pins=None, no pin assignment will be made.

            1 Reply Last reply Reply Quote 0
            • T Offline
              TravisT
              last edited by

              Thanks,

              I have found hints of this many places, but nothing seems very explicit. To me when I read the documentation on UART it does not seem much different than many MCU that are implying to use any default UART pins. I guess this is why I assumed it was not that straight forward.

              I feel like it would be nice to have a section in the manual that explicitly talks about PIN assignments and reassignments. Even if it is obvious after you understand it, just so there is no confusion for less experiences, or new adopters.

              1 Reply Last reply Reply Quote 0
              • S Offline
                Shaun
                last edited by

                @TravisT
                To complete the answer to your question;
                Yes, UART2 is accessible even though the pycom documentation only mentions UART 0 & 1, simply use a 2 in the place of 1 or 0.

                1 Reply Last reply Reply Quote 1
                • T Offline
                  TravisT
                  last edited by

                  Thanks

                  This all makes sense, but left unclear in the documentation. Maybe a section on pin mux fictionality and what peripherals can change pins and which cannot.

                  J 1 Reply Last reply Reply Quote 0
                  • J Offline
                    jmarcelino @TravisT
                    last edited by

                    @travist
                    It’s not very complex, you can remap all Pycom supported peripherals except the SD card.

                    T 1 Reply Last reply Reply Quote 0
                    • T Offline
                      TravisT @jmarcelino
                      last edited by

                      @jmarcelino

                      From a product support perspective complexity isn't usually the issue, clarity is. I have experiences with similar products so I can only image how people new to this might think. It is simple, but it was not even clear it was possible with Micropython. If it was not for this more direct answer and some obscure post I had to dig around for, I would not have been able to confirm it.

                      Also I am guessing that the input only pins should not have outputs mapped to them.

                      All I am saying is that if this subject is clearer it could of save me and other people time, and increase confidence in the Pycom products.

                      1 Reply Last reply Reply Quote 1
                      • C Offline
                        Colateral
                        last edited by

                        For UART0 and UART1 pins are mentioned in pinout digram, but what are the default pins for UART2 ? Is it hardware or software?

                        Does anybody tried UART2 and which pins?

                        J 1 Reply Last reply Reply Quote 0
                        • J Offline
                          jmarcelino @Colateral
                          last edited by

                          @colateral
                          There aren't default pins for UART2 as far as know, just choose them at initialisation with pins=(TXD, RXD, RTS, CTS) option.

                          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