Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. RS-232 signals inverted with QSerialPort
QtWS25 Last Chance

RS-232 signals inverted with QSerialPort

Scheduled Pinned Locked Moved Unsolved General and Desktop
6 Posts 4 Posters 1.4k Views
  • 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.
  • M Offline
    M Offline
    mgreenish
    wrote on last edited by mgreenish
    #1

    I have written a program to download some data/settings to a MCU on a PCB through RS-232 communication. On the PC-side, I use a USB-to-serial converter. The application has been running with problems for 2 - 3 months with only minor edits here and there and nothing related to the port initialization.
    This week, the communication stopped working. My MCU received data very different from what was expected. The header bytes is 0xAB and my board gets 0x3F. By using of my PC scope and its serial decoder,, I was able to determine the the serial signals are inverted, namely, the idle state is -12v and the start bit goes high to 12v, rather than the standard (opposite) levels of idle high with start bit going low. I have looked around for a setting that perhaps I didn't set when I initialize the port but can't seem to find anything that relates to inverting the RS-232 levels. I have repeated the problem on two different computers (one Mac, one PC) with two separate USB-to-serial converters. Does anyone have any ideas?

    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi and welcome to devnet,

      Sounds rather like hardware related. What version of Qt and OS are you running ?

      @kuzulis does this remind you of something ?

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      0
      • K Offline
        K Offline
        kuzulis
        Qt Champions 2020
        wrote on last edited by kuzulis
        #3

        I was able to determine the the serial signals are inverted, namely, the idle state is -12v and the start bit goes high to 12v

        What is signals? Is It Rx/Tx?

        @kuzulis does this remind you of something ?

        No. Most likelly, it is HW issue.

        1 Reply Last reply
        0
        • M Offline
          M Offline
          mgreenish
          wrote on last edited by
          #4

          After further troubleshooting, I think the issue is on the board side, probably hardware as suggested. The RS-232 levels coming out of the USB-to-serial are correct but they are not being inverted by the level shifter. In addition, the RX pin on the MCU is idle low, when it should be idle high.

          1 Reply Last reply
          2
          • M Offline
            M Offline
            mgreenish
            wrote on last edited by
            #5

            I still don't know the cause but the TTL levels going into the board are definitely inverted. Fortunately my MCU offers an option to invert the TTL RX which negates the inverted levels and allows me to bypass the issue in the short term.

            1 Reply Last reply
            0
            • R Offline
              R Offline
              Rondog
              wrote on last edited by Rondog
              #6

              The odds of the signal levels being inverted are very unlikely. You mentioned you are using a PC scope. My guess is you have the gnd/signal connections swapped and this would make it look inverted. Could be a software setting that inverts the signal too. A simple way to test this is to connect an AA battery to the input as you know which ends of the battery are positive and negative.

              I would suggest replacing your 'device' with another computer that has a serial port and some sort of serial terminal (like Hyperterminal). It sounds like it is working but there is something wrong which is why you started looking at this with a scope. If you have the time you could write a software simulator that would emulate the hardware you are trying to talk to so you can bypass all the clumsy stuff (like USB-Serial adapters, cables, actual device, ...).

              1 Reply Last reply
              0

              • Login

              • Login or register to search.
              • First post
                Last post
              0
              • Categories
              • Recent
              • Tags
              • Popular
              • Users
              • Groups
              • Search
              • Get Qt Extensions
              • Unsolved