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

    UART invert signal

    Scheduled Pinned Locked Moved FiPy
    5 Posts 2 Posters 70 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.
    • N Offline
      Norbert Szczesny
      last edited by

      Hi, I am trying to connect to serial communication and I need signal inversion on the TX line, but it does not work.
      Maybe someone knows what I'm doing wrong?

      from machine import UART

      uart = UART (1, baudrate = 9600, pins = ('P20', 'P21'))
      uart.init (invert = UART.INV_TX)
      uart.write (bytes (0xAF))
      print ('send')
      uart.read (5)

      In the documentation I found UART.INV_TX inverts Transmitter dataline. But it doesn't work.
      https://development.pycom.io/firmwareapi/pycom/machine/uart/

      robert-hhR 2 Replies Last reply Reply Quote 0
      • robert-hhR Offline
        robert-hh @Norbert Szczesny
        last edited by

        @Norbert-Szczesny uart.init() must contain all settings that are different from the default in one call. You cannot call uart-init() for single changes.But you can put all uart.init() parameters into the constructor. e.g.

        uart = UART (1, baudrate = 9600, pins = ('P20', 'P21'), invert=UART.INV_TX)

        I'm a little bit surprised that the paramter invert= .. is accepted. I made that PR once, but did not see it yet in the Dev or Release/1.20 branch.

        N 1 Reply Last reply Reply Quote 0
        • N Offline
          Norbert Szczesny
          last edited by Norbert Szczesny

          This post is deleted!
          1 Reply Last reply Reply Quote 0
          • N Offline
            Norbert Szczesny @robert-hh
            last edited by

            Hi, @robert-hh thank you for your quick reply.
            Can you send link to your pull request?
            Thank you in advance.

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

              @Norbert-Szczesny The PR is here: https://github.com/pycom/pycom-micropython-sigfox/pull/362
              The only affected file is mods/machuart.c.
              Since it is a change to the sources, you have to rebuild the firmware yourself. But that is not too hard.

              Edit: it is also included in the homebrew branch of my fork, which has also a few other fixes:
              https://github.com/robert-hh/pycom-micropython-sigfox/tree/homebrew

              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