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. QSerialPort write failure
Forum Updated to NodeBB v4.3 + New Features

QSerialPort write failure

Scheduled Pinned Locked Moved Unsolved General and Desktop
12 Posts 4 Posters 4.4k Views 1 Watching
  • 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.
  • J Offline
    J Offline
    JovanM
    wrote on last edited by
    #1

    Hello.
    I have some problem with writing data to serial COM port. Sometimes the queries do not complete and get "stuck", making port unusable. I'm adding a picture with the problem (captured using PortMon)
    qSerialPort bad behavior

    0	0.06566457	SomeGraphicalA	IRP_MJ_CREATE	VCP0	SUCCESS	Options: Open 	
    1	0.00000279	SomeGraphicalA	IRP_MJ_CLEANUP	VCP0	SUCCESS		
    2	5.09850628	SomeGraphicalA	IRP_MJ_CLOSE	VCP0	SUCCESS		
    3	5.03382300	SomeGraphicalA	IRP_MJ_CREATE	VCP0	SUCCESS	Options: Open 	
    4	0.00000349	SomeGraphicalA	IOCTL_SERIAL_GET_BAUD_RATE	VCP0	SUCCESS		
    5	0.00000105	SomeGraphicalA	IOCTL_SERIAL_GET_LINE_CONTROL	VCP0	SUCCESS		
    6	0.00000070	SomeGraphicalA	IOCTL_SERIAL_GET_CHARS	VCP0	SUCCESS		
    7	0.00000070	SomeGraphicalA	IOCTL_SERIAL_GET_HANDFLOW	VCP0	SUCCESS		
    8	0.00000070	SomeGraphicalA	IOCTL_SERIAL_GET_BAUD_RATE	VCP0	SUCCESS		
    9	0.00000070	SomeGraphicalA	IOCTL_SERIAL_GET_LINE_CONTROL	VCP0	SUCCESS		
    10	0.00000035	SomeGraphicalA	IOCTL_SERIAL_GET_CHARS	VCP0	SUCCESS		
    11	0.00000070	SomeGraphicalA	IOCTL_SERIAL_GET_HANDFLOW	VCP0	SUCCESS		
    12	0.00029044	SomeGraphicalA	IOCTL_SERIAL_SET_BAUD_RATE	VCP0	SUCCESS	Rate: 9600	
    13	0.00036305	SomeGraphicalA	IOCTL_SERIAL_CLR_RTS	VCP0	SUCCESS		
    14	0.00028800	SomeGraphicalA	IOCTL_SERIAL_SET_DTR	VCP0	SUCCESS		
    15	0.00030441	SomeGraphicalA	IOCTL_SERIAL_SET_LINE_CONTROL	VCP0	SUCCESS	StopBits: 1 Parity: NONE WordLength: 8	
    16	0.00000175	SomeGraphicalA	IOCTL_SERIAL_SET_CHAR	VCP0	SUCCESS	EOF:0 ERR:0 BRK:0 EVT:0 XON:11 XOFF:13	
    17	0.00054353	SomeGraphicalA	IOCTL_SERIAL_SET_HANDFLOW	VCP0	SUCCESS	Shake:1 Replace:0 XonLimit:2048 XoffLimit:512	
    18	0.00000175	SomeGraphicalA	IOCTL_SERIAL_GET_TIMEOUTS	VCP0	SUCCESS		
    19	0.00000070	SomeGraphicalA	IOCTL_SERIAL_SET_TIMEOUTS	VCP0	SUCCESS	RI:-1 RM:0 RC:0 WM:0 WC:0	
    20	0.00024087	SomeGraphicalA	IOCTL_SERIAL_SET_WAIT_MASK	VCP0	SUCCESS	Mask: RXCHAR 	
    21	0.00000000	SomeGraphicalA	IOCTL_SERIAL_WAIT_ON_MASK	VCP0			
    22	0.03217006	SomeGraphicalA	IRP_MJ_WRITE	VCP0	* 0xC0000001	Length 7: 10 03 00 01 00 01 D6 	
    

    The last record means that write operation finished with error. I ask the user with parameters in graphical dialog and connect to port like this:

    void MainWindow::connectDevice(DialogCOMPort::Settings inp_settings) {
        if (serialPort!=NULL) {
            //serial port was created before, just closing
            QSerialPortInfo *serialPortInfo = new QSerialPortInfo(*serialPort);
            if (serialPortInfo->isBusy()) {
                qDebug("On connecting Device... Something wrong has happened, serial port is broken");
            }
            if (serialPort->isOpen()) {
                serialPort->close();
            }
        } else {
            serialPort = new QSerialPort();
            this->writeUtil = new SerialPortWriter(serialPort);
            connect(serialPort, &QSerialPort::readyRead, this, &MainWindow::readReady);
        }
        serialPort->setBaudRate(inp_settings.baud);
        serialPort->setPortName(inp_settings.portAddr);
        serialPort->setDataBits(inp_settings.dataBits);
        serialPort->setStopBits(inp_settings.stopBits);
        serialPort->setParity(inp_settings.parity);
        serialPort->open(QSerialPort::ReadWrite);
    
    }
    

    and the Settings structure:

    struct Settings {
            QString portAddr = "";
            QSerialPort::Parity parity = QSerialPort::EvenParity;
            QSerialPort::BaudRate baud = QSerialPort::Baud19200;
            QSerialPort::DataBits dataBits = QSerialPort::Data8;
            QSerialPort::StopBits stopBits = QSerialPort::OneStop;
            int responseTime = 1000;
            int numberOfRetries = 3;
        };
    

    I write to comport like it is shown in example:

    void SerialPortWriter::handleBytesWritten(qint64 bytes)
    {
        m_bytesWritten += bytes;
        if (m_bytesWritten == m_writeData.size()) {
            m_bytesWritten = 0;
            QString msg=QObject::tr("Data successfully sent to port %1").arg(m_serialPort->portName());
            qDebug(msg.toStdString().c_str());
            //m_standardOutput << msg << endl;
            //QCoreApplication::quit();
        }
    }
    

    After I get such state in PortMon, all further writing operations are failing and when I try to close port, I get that IRP_MJ_Cleanup succeeds, but IRP_MJ_CLOSE hangs. So I cannot reopen port, only reboot makes port back online.
    I'm using qt 5.8 on Win7, 32bit (bundled with mingw, installed just a week ago)

    What should I do to make COM port connection working?

    J 1 Reply Last reply
    0
    • J JovanM

      Hello.
      I have some problem with writing data to serial COM port. Sometimes the queries do not complete and get "stuck", making port unusable. I'm adding a picture with the problem (captured using PortMon)
      qSerialPort bad behavior

      0	0.06566457	SomeGraphicalA	IRP_MJ_CREATE	VCP0	SUCCESS	Options: Open 	
      1	0.00000279	SomeGraphicalA	IRP_MJ_CLEANUP	VCP0	SUCCESS		
      2	5.09850628	SomeGraphicalA	IRP_MJ_CLOSE	VCP0	SUCCESS		
      3	5.03382300	SomeGraphicalA	IRP_MJ_CREATE	VCP0	SUCCESS	Options: Open 	
      4	0.00000349	SomeGraphicalA	IOCTL_SERIAL_GET_BAUD_RATE	VCP0	SUCCESS		
      5	0.00000105	SomeGraphicalA	IOCTL_SERIAL_GET_LINE_CONTROL	VCP0	SUCCESS		
      6	0.00000070	SomeGraphicalA	IOCTL_SERIAL_GET_CHARS	VCP0	SUCCESS		
      7	0.00000070	SomeGraphicalA	IOCTL_SERIAL_GET_HANDFLOW	VCP0	SUCCESS		
      8	0.00000070	SomeGraphicalA	IOCTL_SERIAL_GET_BAUD_RATE	VCP0	SUCCESS		
      9	0.00000070	SomeGraphicalA	IOCTL_SERIAL_GET_LINE_CONTROL	VCP0	SUCCESS		
      10	0.00000035	SomeGraphicalA	IOCTL_SERIAL_GET_CHARS	VCP0	SUCCESS		
      11	0.00000070	SomeGraphicalA	IOCTL_SERIAL_GET_HANDFLOW	VCP0	SUCCESS		
      12	0.00029044	SomeGraphicalA	IOCTL_SERIAL_SET_BAUD_RATE	VCP0	SUCCESS	Rate: 9600	
      13	0.00036305	SomeGraphicalA	IOCTL_SERIAL_CLR_RTS	VCP0	SUCCESS		
      14	0.00028800	SomeGraphicalA	IOCTL_SERIAL_SET_DTR	VCP0	SUCCESS		
      15	0.00030441	SomeGraphicalA	IOCTL_SERIAL_SET_LINE_CONTROL	VCP0	SUCCESS	StopBits: 1 Parity: NONE WordLength: 8	
      16	0.00000175	SomeGraphicalA	IOCTL_SERIAL_SET_CHAR	VCP0	SUCCESS	EOF:0 ERR:0 BRK:0 EVT:0 XON:11 XOFF:13	
      17	0.00054353	SomeGraphicalA	IOCTL_SERIAL_SET_HANDFLOW	VCP0	SUCCESS	Shake:1 Replace:0 XonLimit:2048 XoffLimit:512	
      18	0.00000175	SomeGraphicalA	IOCTL_SERIAL_GET_TIMEOUTS	VCP0	SUCCESS		
      19	0.00000070	SomeGraphicalA	IOCTL_SERIAL_SET_TIMEOUTS	VCP0	SUCCESS	RI:-1 RM:0 RC:0 WM:0 WC:0	
      20	0.00024087	SomeGraphicalA	IOCTL_SERIAL_SET_WAIT_MASK	VCP0	SUCCESS	Mask: RXCHAR 	
      21	0.00000000	SomeGraphicalA	IOCTL_SERIAL_WAIT_ON_MASK	VCP0			
      22	0.03217006	SomeGraphicalA	IRP_MJ_WRITE	VCP0	* 0xC0000001	Length 7: 10 03 00 01 00 01 D6 	
      

      The last record means that write operation finished with error. I ask the user with parameters in graphical dialog and connect to port like this:

      void MainWindow::connectDevice(DialogCOMPort::Settings inp_settings) {
          if (serialPort!=NULL) {
              //serial port was created before, just closing
              QSerialPortInfo *serialPortInfo = new QSerialPortInfo(*serialPort);
              if (serialPortInfo->isBusy()) {
                  qDebug("On connecting Device... Something wrong has happened, serial port is broken");
              }
              if (serialPort->isOpen()) {
                  serialPort->close();
              }
          } else {
              serialPort = new QSerialPort();
              this->writeUtil = new SerialPortWriter(serialPort);
              connect(serialPort, &QSerialPort::readyRead, this, &MainWindow::readReady);
          }
          serialPort->setBaudRate(inp_settings.baud);
          serialPort->setPortName(inp_settings.portAddr);
          serialPort->setDataBits(inp_settings.dataBits);
          serialPort->setStopBits(inp_settings.stopBits);
          serialPort->setParity(inp_settings.parity);
          serialPort->open(QSerialPort::ReadWrite);
      
      }
      

      and the Settings structure:

      struct Settings {
              QString portAddr = "";
              QSerialPort::Parity parity = QSerialPort::EvenParity;
              QSerialPort::BaudRate baud = QSerialPort::Baud19200;
              QSerialPort::DataBits dataBits = QSerialPort::Data8;
              QSerialPort::StopBits stopBits = QSerialPort::OneStop;
              int responseTime = 1000;
              int numberOfRetries = 3;
          };
      

      I write to comport like it is shown in example:

      void SerialPortWriter::handleBytesWritten(qint64 bytes)
      {
          m_bytesWritten += bytes;
          if (m_bytesWritten == m_writeData.size()) {
              m_bytesWritten = 0;
              QString msg=QObject::tr("Data successfully sent to port %1").arg(m_serialPort->portName());
              qDebug(msg.toStdString().c_str());
              //m_standardOutput << msg << endl;
              //QCoreApplication::quit();
          }
      }
      

      After I get such state in PortMon, all further writing operations are failing and when I try to close port, I get that IRP_MJ_Cleanup succeeds, but IRP_MJ_CLOSE hangs. So I cannot reopen port, only reboot makes port back online.
      I'm using qt 5.8 on Win7, 32bit (bundled with mingw, installed just a week ago)

      What should I do to make COM port connection working?

      J Offline
      J Offline
      JovanM
      wrote on last edited by
      #2

      @JovanM
      I've checked, I'm using the same port options (baud, parity, start bits, stop bits...) as defined in port's options in device manager.

      This problem appears from time to time, not often, a "ghast" one I'd say.
      Nothing is connected to this port (at the time of testing), just sending bytes to it.

      1 Reply Last reply
      0
      • hskoglundH Offline
        hskoglundH Offline
        hskoglund
        wrote on last edited by
        #3

        Hi, just guessing but perhaps you also need to turn off xon/xoff, try adding:

        serialPort->setStopBits(inp_settings.stopBits);
        ....
        serialPort->setFlowControl(QSerialPort::NoFlowControl);
        ...
        serialPort->setParity(inp_settings.parity);
        serialPort->open(QSerialPort::ReadWrite);
        
        J 1 Reply Last reply
        0
        • hskoglundH hskoglund

          Hi, just guessing but perhaps you also need to turn off xon/xoff, try adding:

          serialPort->setStopBits(inp_settings.stopBits);
          ....
          serialPort->setFlowControl(QSerialPort::NoFlowControl);
          ...
          serialPort->setParity(inp_settings.parity);
          serialPort->open(QSerialPort::ReadWrite);
          
          J Offline
          J Offline
          JovanM
          wrote on last edited by
          #4

          @hskoglund
          The docum. says:

          The default value is NoFlowControl, i.e. no flow control.

          So that construction seems more likely a wizardry, but it gave a result actually the problem is still here:

          0	0.01104905	SomeGraphicalA	IRP_MJ_CREATE	VCP0	SUCCESS	Options: Open 	
          1	0.00000244	SomeGraphicalA	IRP_MJ_CLEANUP	VCP0	SUCCESS		
          2	0.11511006	SomeGraphicalA	IRP_MJ_CLOSE	VCP0	SUCCESS		
          3	0.00302975	SomeGraphicalA	IRP_MJ_CREATE	VCP0	SUCCESS	Options: Open 	
          4	0.00000140	SomeGraphicalA	IOCTL_SERIAL_GET_BAUD_RATE	VCP0	SUCCESS		
          5	0.00000035	SomeGraphicalA	IOCTL_SERIAL_GET_LINE_CONTROL	VCP0	SUCCESS		
          6	0.00000035	SomeGraphicalA	IOCTL_SERIAL_GET_CHARS	VCP0	SUCCESS		
          7	0.00000035	SomeGraphicalA	IOCTL_SERIAL_GET_HANDFLOW	VCP0	SUCCESS		
          8	0.00000035	SomeGraphicalA	IOCTL_SERIAL_GET_BAUD_RATE	VCP0	SUCCESS		
          9	0.00000000	SomeGraphicalA	IOCTL_SERIAL_GET_LINE_CONTROL	VCP0	SUCCESS		
          10	0.00000035	SomeGraphicalA	IOCTL_SERIAL_GET_CHARS	VCP0	SUCCESS		
          11	0.00000035	SomeGraphicalA	IOCTL_SERIAL_GET_HANDFLOW	VCP0	SUCCESS		
          12	0.00010298	SomeGraphicalA	IOCTL_SERIAL_SET_BAUD_RATE	VCP0	SUCCESS	Rate: 9600	
          13	0.00009530	SomeGraphicalA	IOCTL_SERIAL_CLR_RTS	VCP0	SUCCESS		
          14	0.00023948	SomeGraphicalA	IOCTL_SERIAL_SET_DTR	VCP0	SUCCESS		
          15	0.00012393	SomeGraphicalA	IOCTL_SERIAL_SET_LINE_CONTROL	VCP0	SUCCESS	StopBits: 1 Parity: NONE WordLength: 8	
          16	0.00000035	SomeGraphicalA	IOCTL_SERIAL_SET_CHAR	VCP0	SUCCESS	EOF:0 ERR:0 BRK:0 EVT:0 XON:11 XOFF:13	
          17	0.00033233	SomeGraphicalA	IOCTL_SERIAL_SET_HANDFLOW	VCP0	SUCCESS	Shake:1 Replace:0 XonLimit:2048 XoffLimit:512	
          18	0.00000035	SomeGraphicalA	IOCTL_SERIAL_GET_TIMEOUTS	VCP0	SUCCESS		
          19	0.00000035	SomeGraphicalA	IOCTL_SERIAL_SET_TIMEOUTS	VCP0	SUCCESS	RI:-1 RM:0 RC:0 WM:0 WC:0	
          20	0.00009775	SomeGraphicalA	IOCTL_SERIAL_SET_WAIT_MASK	VCP0	SUCCESS	Mask: RXCHAR 	
          21	230.15856027	SomeGraphicalA	IOCTL_SERIAL_WAIT_ON_MASK	VCP0	CANCELLED		
          22	0.00028381	SomeGraphicalA	IRP_MJ_WRITE	VCP0	SUCCESS	Length 7: 10 03 00 01 00 01 D6 	
          23	0.00022796	SomeGraphicalA	IRP_MJ_WRITE	VCP0	SUCCESS	Length 7: 10 03 00 02 00 01 26 	
          24	0.00001466	SomeGraphicalA	IRP_MJ_CLEANUP	VCP0	SUCCESS		
          25	0.10910221	SomeGraphicalA	IRP_MJ_CLOSE	VCP0	SUCCESS		
          26	0.06496813	SomeGraphicalA	IRP_MJ_CREATE	VCP0	SUCCESS	Options: Open 	
          27	0.00000244	SomeGraphicalA	IRP_MJ_CLEANUP	VCP0	SUCCESS		
          28	5.09932105	SomeGraphicalA	IRP_MJ_CLOSE	VCP0	SUCCESS		
          29	5.03467199	SomeGraphicalA	IRP_MJ_CREATE	VCP0	SUCCESS	Options: Open 	
          30	0.00000279	SomeGraphicalA	IOCTL_SERIAL_GET_BAUD_RATE	VCP0	SUCCESS		
          31	0.00000105	SomeGraphicalA	IOCTL_SERIAL_GET_LINE_CONTROL	VCP0	SUCCESS		
          32	0.00000105	SomeGraphicalA	IOCTL_SERIAL_GET_CHARS	VCP0	SUCCESS		
          33	0.00000070	SomeGraphicalA	IOCTL_SERIAL_GET_HANDFLOW	VCP0	SUCCESS		
          34	0.00000105	SomeGraphicalA	IOCTL_SERIAL_GET_BAUD_RATE	VCP0	SUCCESS		
          35	0.00000070	SomeGraphicalA	IOCTL_SERIAL_GET_LINE_CONTROL	VCP0	SUCCESS		
          36	0.00000070	SomeGraphicalA	IOCTL_SERIAL_GET_CHARS	VCP0	SUCCESS		
          37	0.00000035	SomeGraphicalA	IOCTL_SERIAL_GET_HANDFLOW	VCP0	SUCCESS		
          38	0.00027194	SomeGraphicalA	IOCTL_SERIAL_SET_BAUD_RATE	VCP0	SUCCESS	Rate: 9600	
          39	0.00051770	SomeGraphicalA	IOCTL_SERIAL_CLR_RTS	VCP0	SUCCESS		
          40	0.00028835	SomeGraphicalA	IOCTL_SERIAL_SET_DTR	VCP0	SUCCESS		
          41	0.00030022	SomeGraphicalA	IOCTL_SERIAL_SET_LINE_CONTROL	VCP0	SUCCESS	StopBits: 1 Parity: NONE WordLength: 8	
          42	0.00000140	SomeGraphicalA	IOCTL_SERIAL_SET_CHAR	VCP0	SUCCESS	EOF:0 ERR:0 BRK:0 EVT:0 XON:11 XOFF:13	
          43	0.00018118	SomeGraphicalA	IOCTL_SERIAL_SET_HANDFLOW	VCP0	SUCCESS	Shake:1 Replace:0 XonLimit:2048 XoffLimit:512	
          44	0.00000105	SomeGraphicalA	IOCTL_SERIAL_GET_TIMEOUTS	VCP0	SUCCESS		
          45	0.00000105	SomeGraphicalA	IOCTL_SERIAL_SET_TIMEOUTS	VCP0	SUCCESS	RI:-1 RM:0 RC:0 WM:0 WC:0	
          46	0.00019828	SomeGraphicalA	IOCTL_SERIAL_SET_WAIT_MASK	VCP0	SUCCESS	Mask: RXCHAR 	
          47	116.59613788	SomeGraphicalA	IOCTL_SERIAL_WAIT_ON_MASK	VCP0	CANCELLED		
          48	0.03208767	SomeGraphicalA	IRP_MJ_WRITE	VCP0	* 0xC0000001	Length 7: 10 03 00 03 00 01 77 	
          49	0.00000209	SomeGraphicalA	IRP_MJ_CLEANUP	VCP0	SUCCESS		
          50	0.00000000	SomeGraphicalA	IRP_MJ_CLOSE	VCP0			
          

          The first time it was working like a charm, I've sent two requests on COM port (lines 22-23). I closed the program, took some break, restarted it and the problem is back (line 48. On line 50 we see that COM port hangs on closing).
          That's a PortMon's log.

          J 1 Reply Last reply
          0
          • J JovanM

            @hskoglund
            The docum. says:

            The default value is NoFlowControl, i.e. no flow control.

            So that construction seems more likely a wizardry, but it gave a result actually the problem is still here:

            0	0.01104905	SomeGraphicalA	IRP_MJ_CREATE	VCP0	SUCCESS	Options: Open 	
            1	0.00000244	SomeGraphicalA	IRP_MJ_CLEANUP	VCP0	SUCCESS		
            2	0.11511006	SomeGraphicalA	IRP_MJ_CLOSE	VCP0	SUCCESS		
            3	0.00302975	SomeGraphicalA	IRP_MJ_CREATE	VCP0	SUCCESS	Options: Open 	
            4	0.00000140	SomeGraphicalA	IOCTL_SERIAL_GET_BAUD_RATE	VCP0	SUCCESS		
            5	0.00000035	SomeGraphicalA	IOCTL_SERIAL_GET_LINE_CONTROL	VCP0	SUCCESS		
            6	0.00000035	SomeGraphicalA	IOCTL_SERIAL_GET_CHARS	VCP0	SUCCESS		
            7	0.00000035	SomeGraphicalA	IOCTL_SERIAL_GET_HANDFLOW	VCP0	SUCCESS		
            8	0.00000035	SomeGraphicalA	IOCTL_SERIAL_GET_BAUD_RATE	VCP0	SUCCESS		
            9	0.00000000	SomeGraphicalA	IOCTL_SERIAL_GET_LINE_CONTROL	VCP0	SUCCESS		
            10	0.00000035	SomeGraphicalA	IOCTL_SERIAL_GET_CHARS	VCP0	SUCCESS		
            11	0.00000035	SomeGraphicalA	IOCTL_SERIAL_GET_HANDFLOW	VCP0	SUCCESS		
            12	0.00010298	SomeGraphicalA	IOCTL_SERIAL_SET_BAUD_RATE	VCP0	SUCCESS	Rate: 9600	
            13	0.00009530	SomeGraphicalA	IOCTL_SERIAL_CLR_RTS	VCP0	SUCCESS		
            14	0.00023948	SomeGraphicalA	IOCTL_SERIAL_SET_DTR	VCP0	SUCCESS		
            15	0.00012393	SomeGraphicalA	IOCTL_SERIAL_SET_LINE_CONTROL	VCP0	SUCCESS	StopBits: 1 Parity: NONE WordLength: 8	
            16	0.00000035	SomeGraphicalA	IOCTL_SERIAL_SET_CHAR	VCP0	SUCCESS	EOF:0 ERR:0 BRK:0 EVT:0 XON:11 XOFF:13	
            17	0.00033233	SomeGraphicalA	IOCTL_SERIAL_SET_HANDFLOW	VCP0	SUCCESS	Shake:1 Replace:0 XonLimit:2048 XoffLimit:512	
            18	0.00000035	SomeGraphicalA	IOCTL_SERIAL_GET_TIMEOUTS	VCP0	SUCCESS		
            19	0.00000035	SomeGraphicalA	IOCTL_SERIAL_SET_TIMEOUTS	VCP0	SUCCESS	RI:-1 RM:0 RC:0 WM:0 WC:0	
            20	0.00009775	SomeGraphicalA	IOCTL_SERIAL_SET_WAIT_MASK	VCP0	SUCCESS	Mask: RXCHAR 	
            21	230.15856027	SomeGraphicalA	IOCTL_SERIAL_WAIT_ON_MASK	VCP0	CANCELLED		
            22	0.00028381	SomeGraphicalA	IRP_MJ_WRITE	VCP0	SUCCESS	Length 7: 10 03 00 01 00 01 D6 	
            23	0.00022796	SomeGraphicalA	IRP_MJ_WRITE	VCP0	SUCCESS	Length 7: 10 03 00 02 00 01 26 	
            24	0.00001466	SomeGraphicalA	IRP_MJ_CLEANUP	VCP0	SUCCESS		
            25	0.10910221	SomeGraphicalA	IRP_MJ_CLOSE	VCP0	SUCCESS		
            26	0.06496813	SomeGraphicalA	IRP_MJ_CREATE	VCP0	SUCCESS	Options: Open 	
            27	0.00000244	SomeGraphicalA	IRP_MJ_CLEANUP	VCP0	SUCCESS		
            28	5.09932105	SomeGraphicalA	IRP_MJ_CLOSE	VCP0	SUCCESS		
            29	5.03467199	SomeGraphicalA	IRP_MJ_CREATE	VCP0	SUCCESS	Options: Open 	
            30	0.00000279	SomeGraphicalA	IOCTL_SERIAL_GET_BAUD_RATE	VCP0	SUCCESS		
            31	0.00000105	SomeGraphicalA	IOCTL_SERIAL_GET_LINE_CONTROL	VCP0	SUCCESS		
            32	0.00000105	SomeGraphicalA	IOCTL_SERIAL_GET_CHARS	VCP0	SUCCESS		
            33	0.00000070	SomeGraphicalA	IOCTL_SERIAL_GET_HANDFLOW	VCP0	SUCCESS		
            34	0.00000105	SomeGraphicalA	IOCTL_SERIAL_GET_BAUD_RATE	VCP0	SUCCESS		
            35	0.00000070	SomeGraphicalA	IOCTL_SERIAL_GET_LINE_CONTROL	VCP0	SUCCESS		
            36	0.00000070	SomeGraphicalA	IOCTL_SERIAL_GET_CHARS	VCP0	SUCCESS		
            37	0.00000035	SomeGraphicalA	IOCTL_SERIAL_GET_HANDFLOW	VCP0	SUCCESS		
            38	0.00027194	SomeGraphicalA	IOCTL_SERIAL_SET_BAUD_RATE	VCP0	SUCCESS	Rate: 9600	
            39	0.00051770	SomeGraphicalA	IOCTL_SERIAL_CLR_RTS	VCP0	SUCCESS		
            40	0.00028835	SomeGraphicalA	IOCTL_SERIAL_SET_DTR	VCP0	SUCCESS		
            41	0.00030022	SomeGraphicalA	IOCTL_SERIAL_SET_LINE_CONTROL	VCP0	SUCCESS	StopBits: 1 Parity: NONE WordLength: 8	
            42	0.00000140	SomeGraphicalA	IOCTL_SERIAL_SET_CHAR	VCP0	SUCCESS	EOF:0 ERR:0 BRK:0 EVT:0 XON:11 XOFF:13	
            43	0.00018118	SomeGraphicalA	IOCTL_SERIAL_SET_HANDFLOW	VCP0	SUCCESS	Shake:1 Replace:0 XonLimit:2048 XoffLimit:512	
            44	0.00000105	SomeGraphicalA	IOCTL_SERIAL_GET_TIMEOUTS	VCP0	SUCCESS		
            45	0.00000105	SomeGraphicalA	IOCTL_SERIAL_SET_TIMEOUTS	VCP0	SUCCESS	RI:-1 RM:0 RC:0 WM:0 WC:0	
            46	0.00019828	SomeGraphicalA	IOCTL_SERIAL_SET_WAIT_MASK	VCP0	SUCCESS	Mask: RXCHAR 	
            47	116.59613788	SomeGraphicalA	IOCTL_SERIAL_WAIT_ON_MASK	VCP0	CANCELLED		
            48	0.03208767	SomeGraphicalA	IRP_MJ_WRITE	VCP0	* 0xC0000001	Length 7: 10 03 00 03 00 01 77 	
            49	0.00000209	SomeGraphicalA	IRP_MJ_CLEANUP	VCP0	SUCCESS		
            50	0.00000000	SomeGraphicalA	IRP_MJ_CLOSE	VCP0			
            

            The first time it was working like a charm, I've sent two requests on COM port (lines 22-23). I closed the program, took some break, restarted it and the problem is back (line 48. On line 50 we see that COM port hangs on closing).
            That's a PortMon's log.

            J Offline
            J Offline
            JovanM
            wrote on last edited by
            #5

            @JovanM
            After that PortMon dispatches nothing at all. After quiting from program, turning it back I cannot send anything to port, due to 'Access denied' error. (obviously)

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

              Hi,

              What kind of serial port is the device you use ?

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

              J 1 Reply Last reply
              0
              • SGaistS SGaist

                Hi,

                What kind of serial port is the device you use ?

                J Offline
                J Offline
                JovanM
                wrote on last edited by
                #7

                @SGaist
                This is USB Serial Port, produced by FTDI, with the latest drivers I've managed to find on official website.
                It is actually a USB to RS-485 converter, but it maps as COM port in OS (truestory, it is being correctly shown as COM9 under the section 'COM and LPT ports' in device manager).

                1 Reply Last reply
                0
                • hskoglundH Offline
                  hskoglundH Offline
                  hskoglund
                  wrote on last edited by
                  #8

                  Perhaps try another program to see if your COM port hangs the same way, Windows XP had a free program called HyperTerminal, you can download a free 30-day trial for you Windows 7 here

                  J 1 Reply Last reply
                  0
                  • hskoglundH hskoglund

                    Perhaps try another program to see if your COM port hangs the same way, Windows XP had a free program called HyperTerminal, you can download a free 30-day trial for you Windows 7 here

                    J Offline
                    J Offline
                    JovanM
                    wrote on last edited by
                    #9

                    @hskoglund
                    Thank you for your answer. I've found that PuTTY.exe (another connection soft) also has capability to send bytes to COM port. And everything worked like a charm (in putty, sure). Here's a fragment of my testing:

                    5	0.01122259	putty.exe	IRP_MJ_CREATE	VCP0	SUCCESS	Options: Open 	
                    46	0.00000279	putty.exe	IOCTL_SERIAL_GET_BAUD_RATE	VCP0	SUCCESS		
                    47	0.00000105	putty.exe	IOCTL_SERIAL_GET_LINE_CONTROL	VCP0	SUCCESS		
                    48	0.00000105	putty.exe	IOCTL_SERIAL_GET_CHARS	VCP0	SUCCESS		
                    49	0.00000070	putty.exe	IOCTL_SERIAL_GET_HANDFLOW	VCP0	SUCCESS		
                    50	0.00000105	putty.exe	IOCTL_SERIAL_GET_BAUD_RATE	VCP0	SUCCESS		
                    51	0.00000035	putty.exe	IOCTL_SERIAL_GET_LINE_CONTROL	VCP0	SUCCESS		
                    52	0.00000035	putty.exe	IOCTL_SERIAL_GET_CHARS	VCP0	SUCCESS		
                    53	0.00000035	putty.exe	IOCTL_SERIAL_GET_HANDFLOW	VCP0	SUCCESS		
                    54	0.00026182	putty.exe	IOCTL_SERIAL_SET_BAUD_RATE	VCP0	SUCCESS	Rate: 9600	
                    55	0.00015604	putty.exe	IOCTL_SERIAL_SET_RTS	VCP0	SUCCESS		
                    56	0.00013091	putty.exe	IOCTL_SERIAL_SET_DTR	VCP0	SUCCESS		
                    57	0.00021015	putty.exe	IOCTL_SERIAL_SET_LINE_CONTROL	VCP0	SUCCESS	StopBits: 1 Parity: NONE WordLength: 8	
                    58	0.00000105	putty.exe	IOCTL_SERIAL_SET_CHAR	VCP0	SUCCESS	EOF:0 ERR:0 BRK:0 EVT:0 XON:11 XOFF:13	
                    59	0.00019165	putty.exe	IOCTL_SERIAL_SET_HANDFLOW	VCP0	SUCCESS	Shake:1 Replace:40 XonLimit:2048 XoffLimit:512	
                    60	0.00000105	putty.exe	IOCTL_SERIAL_SET_TIMEOUTS	VCP0	SUCCESS	RI:1 RM:0 RC:0 WM:0 WC:0	
                    61	52.21592939	putty.exe	IRP_MJ_READ	VCP0	CANCELLED	Length 1	
                    62	0.00016268	putty.exe	IRP_MJ_WRITE	VCP0	SUCCESS	Length 1: H	
                    63	0.00022097	putty.exe	IRP_MJ_WRITE	VCP0	SUCCESS	Length 1: e	
                    64	0.00021225	putty.exe	IRP_MJ_WRITE	VCP0	SUCCESS	Length 1: l	
                    65	0.00033792	putty.exe	IRP_MJ_WRITE	VCP0	SUCCESS	Length 1: l	
                    66	0.00029114	putty.exe	IRP_MJ_WRITE	VCP0	SUCCESS	Length 1: o	
                    67	0.00021120	putty.exe	IRP_MJ_WRITE	VCP0	SUCCESS	Length 1:  	
                    68	0.00026950	putty.exe	IRP_MJ_WRITE	VCP0	SUCCESS	Length 1: W	
                    69	0.00033024	putty.exe	IRP_MJ_WRITE	VCP0	SUCCESS	Length 1: o	
                    70	0.00019409	putty.exe	IRP_MJ_WRITE	VCP0	SUCCESS	Length 1: r	
                    71	0.00031488	putty.exe	IRP_MJ_WRITE	VCP0	SUCCESS	Length 1: l	
                    72	0.00020422	putty.exe	IRP_MJ_WRITE	VCP0	SUCCESS	Length 1: d	
                    73	0.00014732	putty.exe	IRP_MJ_WRITE	VCP0	SUCCESS	Length 1: l	
                    74	0.00020177	putty.exe	IRP_MJ_WRITE	VCP0	SUCCESS	Length 1: l	
                    75	0.00025239	putty.exe	IRP_MJ_WRITE	VCP0	SUCCESS	Length 1: l	
                    76	0.00033513	putty.exe	IRP_MJ_WRITE	VCP0	SUCCESS	Length 1: .	
                    77	0.00000349	putty.exe	IRP_MJ_CLEANUP	VCP0	SUCCESS		
                    78	0.11307382	putty.exe	IRP_MJ_CLOSE	VCP0	SUCCESS		
                    

                    Everything seems to be the same, but putty does not send IOCTL_SERIAL_SET_WAIT_MASK and IOCTL_SERIAL_WAIT_ON_MASK commands, which QT does

                    Maybe because of this signal my port hangs. Is there any way to control such behavior?

                    J 1 Reply Last reply
                    0
                    • J JovanM

                      @hskoglund
                      Thank you for your answer. I've found that PuTTY.exe (another connection soft) also has capability to send bytes to COM port. And everything worked like a charm (in putty, sure). Here's a fragment of my testing:

                      5	0.01122259	putty.exe	IRP_MJ_CREATE	VCP0	SUCCESS	Options: Open 	
                      46	0.00000279	putty.exe	IOCTL_SERIAL_GET_BAUD_RATE	VCP0	SUCCESS		
                      47	0.00000105	putty.exe	IOCTL_SERIAL_GET_LINE_CONTROL	VCP0	SUCCESS		
                      48	0.00000105	putty.exe	IOCTL_SERIAL_GET_CHARS	VCP0	SUCCESS		
                      49	0.00000070	putty.exe	IOCTL_SERIAL_GET_HANDFLOW	VCP0	SUCCESS		
                      50	0.00000105	putty.exe	IOCTL_SERIAL_GET_BAUD_RATE	VCP0	SUCCESS		
                      51	0.00000035	putty.exe	IOCTL_SERIAL_GET_LINE_CONTROL	VCP0	SUCCESS		
                      52	0.00000035	putty.exe	IOCTL_SERIAL_GET_CHARS	VCP0	SUCCESS		
                      53	0.00000035	putty.exe	IOCTL_SERIAL_GET_HANDFLOW	VCP0	SUCCESS		
                      54	0.00026182	putty.exe	IOCTL_SERIAL_SET_BAUD_RATE	VCP0	SUCCESS	Rate: 9600	
                      55	0.00015604	putty.exe	IOCTL_SERIAL_SET_RTS	VCP0	SUCCESS		
                      56	0.00013091	putty.exe	IOCTL_SERIAL_SET_DTR	VCP0	SUCCESS		
                      57	0.00021015	putty.exe	IOCTL_SERIAL_SET_LINE_CONTROL	VCP0	SUCCESS	StopBits: 1 Parity: NONE WordLength: 8	
                      58	0.00000105	putty.exe	IOCTL_SERIAL_SET_CHAR	VCP0	SUCCESS	EOF:0 ERR:0 BRK:0 EVT:0 XON:11 XOFF:13	
                      59	0.00019165	putty.exe	IOCTL_SERIAL_SET_HANDFLOW	VCP0	SUCCESS	Shake:1 Replace:40 XonLimit:2048 XoffLimit:512	
                      60	0.00000105	putty.exe	IOCTL_SERIAL_SET_TIMEOUTS	VCP0	SUCCESS	RI:1 RM:0 RC:0 WM:0 WC:0	
                      61	52.21592939	putty.exe	IRP_MJ_READ	VCP0	CANCELLED	Length 1	
                      62	0.00016268	putty.exe	IRP_MJ_WRITE	VCP0	SUCCESS	Length 1: H	
                      63	0.00022097	putty.exe	IRP_MJ_WRITE	VCP0	SUCCESS	Length 1: e	
                      64	0.00021225	putty.exe	IRP_MJ_WRITE	VCP0	SUCCESS	Length 1: l	
                      65	0.00033792	putty.exe	IRP_MJ_WRITE	VCP0	SUCCESS	Length 1: l	
                      66	0.00029114	putty.exe	IRP_MJ_WRITE	VCP0	SUCCESS	Length 1: o	
                      67	0.00021120	putty.exe	IRP_MJ_WRITE	VCP0	SUCCESS	Length 1:  	
                      68	0.00026950	putty.exe	IRP_MJ_WRITE	VCP0	SUCCESS	Length 1: W	
                      69	0.00033024	putty.exe	IRP_MJ_WRITE	VCP0	SUCCESS	Length 1: o	
                      70	0.00019409	putty.exe	IRP_MJ_WRITE	VCP0	SUCCESS	Length 1: r	
                      71	0.00031488	putty.exe	IRP_MJ_WRITE	VCP0	SUCCESS	Length 1: l	
                      72	0.00020422	putty.exe	IRP_MJ_WRITE	VCP0	SUCCESS	Length 1: d	
                      73	0.00014732	putty.exe	IRP_MJ_WRITE	VCP0	SUCCESS	Length 1: l	
                      74	0.00020177	putty.exe	IRP_MJ_WRITE	VCP0	SUCCESS	Length 1: l	
                      75	0.00025239	putty.exe	IRP_MJ_WRITE	VCP0	SUCCESS	Length 1: l	
                      76	0.00033513	putty.exe	IRP_MJ_WRITE	VCP0	SUCCESS	Length 1: .	
                      77	0.00000349	putty.exe	IRP_MJ_CLEANUP	VCP0	SUCCESS		
                      78	0.11307382	putty.exe	IRP_MJ_CLOSE	VCP0	SUCCESS		
                      

                      Everything seems to be the same, but putty does not send IOCTL_SERIAL_SET_WAIT_MASK and IOCTL_SERIAL_WAIT_ON_MASK commands, which QT does

                      Maybe because of this signal my port hangs. Is there any way to control such behavior?

                      J Offline
                      J Offline
                      JovanM
                      wrote on last edited by
                      #10

                      And here is the log fragment for HyperTerm.

                      79	0.01420278	hypertrm.exe	IRP_MJ_CREATE	VCP0	SUCCESS	Options: Open 	
                      80	0.00000663	hypertrm.exe	IOCTL_SERIAL_SET_QUEUE_SIZE	VCP0	SUCCESS	InSize: 8192 OutSize: 8192	
                      81	0.00000105	hypertrm.exe	IOCTL_SERIAL_CONFIG_SIZE	VCP0	SUCCESS	Size: 0	
                      82	0.00000105	hypertrm.exe	IOCTL_SERIAL_GET_BAUD_RATE	VCP0	SUCCESS		
                      83	0.00000105	hypertrm.exe	IOCTL_SERIAL_GET_LINE_CONTROL	VCP0	SUCCESS		
                      84	0.00000244	hypertrm.exe	IOCTL_SERIAL_GET_CHARS	VCP0	SUCCESS		
                      85	0.00000105	hypertrm.exe	IOCTL_SERIAL_GET_HANDFLOW	VCP0	SUCCESS		
                      86	0.00000070	hypertrm.exe	IOCTL_SERIAL_GET_BAUD_RATE	VCP0	SUCCESS		
                      87	0.00000070	hypertrm.exe	IOCTL_SERIAL_GET_LINE_CONTROL	VCP0	SUCCESS		
                      88	0.00000070	hypertrm.exe	IOCTL_SERIAL_GET_CHARS	VCP0	SUCCESS		
                      89	0.00000070	hypertrm.exe	IOCTL_SERIAL_GET_HANDFLOW	VCP0	SUCCESS		
                      90	0.00024576	hypertrm.exe	IOCTL_SERIAL_SET_BAUD_RATE	VCP0	SUCCESS	Rate: 9600	
                      91	0.00027927	hypertrm.exe	IOCTL_SERIAL_SET_RTS	VCP0	SUCCESS		
                      92	0.00015220	hypertrm.exe	IOCTL_SERIAL_SET_DTR	VCP0	SUCCESS		
                      93	0.00018781	hypertrm.exe	IOCTL_SERIAL_SET_LINE_CONTROL	VCP0	SUCCESS	StopBits: 1 Parity: NONE WordLength: 8	
                      94	0.00000105	hypertrm.exe	IOCTL_SERIAL_SET_CHAR	VCP0	SUCCESS	EOF:0 ERR:0 BRK:0 EVT:0 XON:11 XOFF:13	
                      95	0.00021469	hypertrm.exe	IOCTL_SERIAL_SET_HANDFLOW	VCP0	SUCCESS	Shake:80000001 Replace:80000040 XonLimit:80 XoffLimit:200	
                      96	0.00000105	hypertrm.exe	IOCTL_SERIAL_SET_TIMEOUTS	VCP0	SUCCESS	RI:10 RM:0 RC:0 WM:0 WC:5000	
                      97	0.00020911	hypertrm.exe	IOCTL_SERIAL_SET_WAIT_MASK	VCP0	SUCCESS	Mask: RLSD ERR 	
                      98	149.25617403	hypertrm.exe	IOCTL_SERIAL_WAIT_ON_MASK	VCP0	SUCCESS		
                      99	149.25617263	hypertrm.exe	IRP_MJ_READ	VCP0	CANCELLED	Length 80	
                      100	0.00033059	hypertrm.exe	IRP_MJ_WRITE	VCP0	SUCCESS	Length 1: H	
                      101	0.00029254	hypertrm.exe	IRP_MJ_WRITE	VCP0	SUCCESS	Length 1: e	
                      102	0.00028695	hypertrm.exe	IRP_MJ_WRITE	VCP0	SUCCESS	Length 1: l	
                      103	0.00032465	hypertrm.exe	IRP_MJ_WRITE	VCP0	SUCCESS	Length 1: l	
                      104	0.00018048	hypertrm.exe	IRP_MJ_WRITE	VCP0	SUCCESS	Length 1: o	
                      105	0.00016966	hypertrm.exe	IRP_MJ_WRITE	VCP0	SUCCESS	Length 1:  	
                      106	0.00026391	hypertrm.exe	IRP_MJ_WRITE	VCP0	SUCCESS	Length 1: T	
                      107	0.00020073	hypertrm.exe	IRP_MJ_WRITE	VCP0	SUCCESS	Length 1: h	
                      108	0.00036096	hypertrm.exe	IRP_MJ_WRITE	VCP0	SUCCESS	Length 1: e	
                      109	0.00016407	hypertrm.exe	IRP_MJ_WRITE	VCP0	SUCCESS	Length 1: r	
                      110	0.00016791	hypertrm.exe	IRP_MJ_WRITE	VCP0	SUCCESS	Length 1: e	
                      111	0.00023215	hypertrm.exe	IRP_MJ_WRITE	VCP0	SUCCESS	Length 1: N	
                      112	0.00025868	hypertrm.exe	IRP_MJ_WRITE	VCP0	SUCCESS	Length 1: o	
                      113	0.00017315	hypertrm.exe	IRP_MJ_WRITE	VCP0	SUCCESS	Length 1: t	
                      114	0.00022726	hypertrm.exe	IRP_MJ_WRITE	VCP0	SUCCESS	Length 1:  	
                      115	0.00030860	hypertrm.exe	IRP_MJ_WRITE	VCP0	SUCCESS	Length 1: H	
                      116	0.00021399	hypertrm.exe	IRP_MJ_WRITE	VCP0	SUCCESS	Length 1: a	
                      117	0.00016756	hypertrm.exe	IRP_MJ_WRITE	VCP0	SUCCESS	Length 1: n	
                      118	0.00019968	hypertrm.exe	IRP_MJ_WRITE	VCP0	SUCCESS	Length 1: g	
                      119	0.00018223	hypertrm.exe	IRP_MJ_WRITE	VCP0	SUCCESS	Length 1: i	
                      120	0.00031069	hypertrm.exe	IRP_MJ_WRITE	VCP0	SUCCESS	Length 1: n	
                      121	0.00019444	hypertrm.exe	IRP_MJ_WRITE	VCP0	SUCCESS	Length 1: g	
                      122	0.00021748	hypertrm.exe	IRP_MJ_WRITE	VCP0	SUCCESS	Length 1: ?	
                      123	0.00026147	hypertrm.exe	IRP_MJ_WRITE	VCP0	SUCCESS	Length 1: W	
                      124	0.00034351	hypertrm.exe	IRP_MJ_WRITE	VCP0	SUCCESS	Length 1: e	
                      125	0.00029149	hypertrm.exe	IRP_MJ_WRITE	VCP0	SUCCESS	Length 1: l	
                      126	0.00016407	hypertrm.exe	IRP_MJ_WRITE	VCP0	SUCCESS	Length 1: l	
                      127	0.00011171	hypertrm.exe	IRP_MJ_WRITE	VCP0	SUCCESS	Length 1: H	
                      128	0.00000349	hypertrm.exe	IOCTL_SERIAL_GET_COMMSTATUS	VCP0	SUCCESS		
                      129	0.00024227	hypertrm.exe	IRP_MJ_WRITE	VCP0	SUCCESS	Length 1: e	
                      130	0.00000140	hypertrm.exe	IOCTL_SERIAL_GET_COMMSTATUS	VCP0	SUCCESS		
                      131	0.00020457	hypertrm.exe	IRP_MJ_WRITE	VCP0	SUCCESS	Length 1: r	
                      132	0.00000175	hypertrm.exe	IOCTL_SERIAL_GET_COMMSTATUS	VCP0	SUCCESS		
                      133	0.00027718	hypertrm.exe	IRP_MJ_WRITE	VCP0	SUCCESS	Length 1: e	
                      134	0.00000175	hypertrm.exe	IOCTL_SERIAL_GET_COMMSTATUS	VCP0	SUCCESS		
                      135	0.00024052	hypertrm.exe	IRP_MJ_WRITE	VCP0	SUCCESS	Length 1:  	
                      136	0.00000175	hypertrm.exe	IOCTL_SERIAL_GET_COMMSTATUS	VCP0	SUCCESS		
                      137	0.00031279	hypertrm.exe	IRP_MJ_WRITE	VCP0	SUCCESS	Length 1: c	
                      138	0.00000209	hypertrm.exe	IOCTL_SERIAL_GET_COMMSTATUS	VCP0	SUCCESS		
                      139	0.00021469	hypertrm.exe	IRP_MJ_WRITE	VCP0	SUCCESS	Length 1: o	
                      140	0.00000175	hypertrm.exe	IOCTL_SERIAL_GET_COMMSTATUS	VCP0	SUCCESS		
                      141	0.00020771	hypertrm.exe	IRP_MJ_WRITE	VCP0	SUCCESS	Length 1: m	
                      142	0.00000140	hypertrm.exe	IOCTL_SERIAL_GET_COMMSTATUS	VCP0	SUCCESS		
                      143	0.00019968	hypertrm.exe	IRP_MJ_WRITE	VCP0	SUCCESS	Length 1: e	
                      144	0.00000175	hypertrm.exe	IOCTL_SERIAL_GET_COMMSTATUS	VCP0	SUCCESS		
                      145	0.00021644	hypertrm.exe	IRP_MJ_WRITE	VCP0	SUCCESS	Length 1: s	
                      146	0.00000140	hypertrm.exe	IOCTL_SERIAL_GET_COMMSTATUS	VCP0	SUCCESS		
                      147	0.00020980	hypertrm.exe	IRP_MJ_WRITE	VCP0	SUCCESS	Length 1:  	
                      148	0.00000175	hypertrm.exe	IOCTL_SERIAL_GET_COMMSTATUS	VCP0	SUCCESS		
                      149	0.00020806	hypertrm.exe	IRP_MJ_WRITE	VCP0	SUCCESS	Length 1: t	
                      150	0.00000140	hypertrm.exe	IOCTL_SERIAL_GET_COMMSTATUS	VCP0	SUCCESS		
                      151	0.00020806	hypertrm.exe	IRP_MJ_WRITE	VCP0	SUCCESS	Length 1: h	
                      152	0.00000175	hypertrm.exe	IOCTL_SERIAL_GET_COMMSTATUS	VCP0	SUCCESS		
                      153	0.00022481	hypertrm.exe	IRP_MJ_WRITE	VCP0	SUCCESS	Length 1: e	
                      154	0.00000140	hypertrm.exe	IOCTL_SERIAL_GET_COMMSTATUS	VCP0	SUCCESS		
                      155	0.00020911	hypertrm.exe	IRP_MJ_WRITE	VCP0	SUCCESS	Length 1:  	
                      156	0.00000140	hypertrm.exe	IOCTL_SERIAL_GET_COMMSTATUS	VCP0	SUCCESS		
                      157	0.00020596	hypertrm.exe	IRP_MJ_WRITE	VCP0	SUCCESS	Length 1: l	
                      158	0.00000209	hypertrm.exe	IOCTL_SERIAL_GET_COMMSTATUS	VCP0	SUCCESS		
                      159	0.00020247	hypertrm.exe	IRP_MJ_WRITE	VCP0	SUCCESS	Length 1: i	
                      160	0.00000175	hypertrm.exe	IOCTL_SERIAL_GET_COMMSTATUS	VCP0	SUCCESS		
                      161	0.00021364	hypertrm.exe	IRP_MJ_WRITE	VCP0	SUCCESS	Length 1: n	
                      162	0.00000175	hypertrm.exe	IOCTL_SERIAL_GET_COMMSTATUS	VCP0	SUCCESS		
                      163	0.00021295	hypertrm.exe	IRP_MJ_WRITE	VCP0	SUCCESS	Length 1: e	
                      164	0.00021609	hypertrm.exe	IOCTL_SERIAL_SET_WAIT_MASK	VCP0	SUCCESS	Mask: RLSD ERR 	
                      165	0.00000733	hypertrm.exe	IOCTL_SERIAL_PURGE	VCP0	SUCCESS	Purge: TXABORT RXABORT 	
                      166	0.00000279	hypertrm.exe	IRP_MJ_CLEANUP	VCP0	SUCCESS		
                      167	0.11072793	hypertrm.exe	IRP_MJ_CLOSE	VCP0	SUCCESS		
                      168	0.00965866	hypertrm.exe	IRP_MJ_CREATE	VCP0	SUCCESS	Options: Open 	
                      169	0.00000175	hypertrm.exe	IRP_MJ_QUERY_INFORMATION	VCP0	SUCCESS	-1567238140	
                      170	0.00000209	hypertrm.exe	IRP_MJ_CLEANUP	VCP0	SUCCESS		
                      171	0.11427330	hypertrm.exe	IRP_MJ_CLOSE	VCP0	SUCCESS		
                      

                      Probably those IOCTLs are not the reason, because hyperterm sends them too.
                      Should I send the data in a single symbol at a time, instead of sending data packages? I'm going to connect to device using a binary protocol and my message contains non-ascii chars (0x00 are pretty common in my messages).

                      1 Reply Last reply
                      0
                      • K Offline
                        K Offline
                        kuzulis
                        Qt Champions 2020
                        wrote on last edited by kuzulis
                        #11
                        1. You can try to open serial port in WriteOnly mode, in this case the RXCHA flag will not be set (if it confuses you).
                        2. You can try to use the Terminal example from QSP examples.

                        Also, please provide an error code and error text if it happens!

                        As I remember, the Putty does not work with serial port in overlapped mode. Also I'm not sure that the HyperTerm also works in overlapped mode (as I can see from your log).

                        PS: History shows, that the FTDI adapter never had problems on Windows. Maybe your PortMon get stuck, maybe latest FTDI drivers get stuck.. Maybe you need to change your HW to another FTDI adapter (as current may broken).

                        1 Reply Last reply
                        0
                        • J Offline
                          J Offline
                          JovanM
                          wrote on last edited by JovanM
                          #12

                          I need not only write bytes but I need to be able to read them from port as defined in the task. Hardware does not belong to me, so I have to work with the provided devices.
                          The code works unreliably, sometimes it works, sometimes it does not.
                          That's weird.

                          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