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. Serial Port setRts(true) returns zero.
Forum Updated to NodeBB v4.3 + New Features

Serial Port setRts(true) returns zero.

Scheduled Pinned Locked Moved Solved General and Desktop
4 Posts 2 Posters 1.0k 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.
  • C Offline
    C Offline
    Corban_Dallas
    wrote on last edited by
    #1

    Hi everyone!

    I am rewriting the old windows application which works with serial port for old research setup, but i have some problem with QSerialPort. After creating a new QSerialPort and performing initial setting i get a false returned value when i'm trying to setRts(true)

    QSerialPort *port = new QSerialPort(QString("ttyS0"));
    port->setBaudRate(QSerialPort::Baud9600);
    port->setDataBits(QSerialPort::Data8);
    port->setStopBits(QSerialPort::TwoStop);
    port->setParity(QSerialPort::NoParity);
    port->setFlowControl(QSerialPort::HardwareControl);
    port->setReadBufferSize(256);
    
    port->open(QIODevice::ReadWrite) // returns true
    port->clear();
    port->setRts(true) // returns false
    

    I had launched the old program and its works well so problem is not in connected device. When i set QSerialPort::SoftwareControl the port->setRts(true) returns true (that is strange) but after some time device freezes and no data arrive in buffer. That can be a reason why i cant setRts(true) when the hardware control is used? I thought that rts signal is used only with hardware control, am i wrong?

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

      When the HW flow control is set, then the RTS changing is prohibited manually. It does automatically by the driver (because it is HARDWARE FLOW CONTROL). The previous implementation of QSP had bugs which allow to change RTS in HW flow control.

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

        UPD: You allowed to change RTS only with NoFlowControl or SoftwareFlowControl.

        1 Reply Last reply
        1
        • K kuzulis

          When the HW flow control is set, then the RTS changing is prohibited manually. It does automatically by the driver (because it is HARDWARE FLOW CONTROL). The previous implementation of QSP had bugs which allow to change RTS in HW flow control.

          C Offline
          C Offline
          Corban_Dallas
          wrote on last edited by
          #4

          wow, didn't know that in hw control it sets automatically, thx @kuzulis!

          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