Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Unsolved
    1. Home
    2. Tags
    3. serialport

    Log in to post
    • All categories
    • M

      Unsolved Serial data received
      General and Desktop • qt c++ serialport data buffer • • manel.sam

      19
      0
      Votes
      19
      Posts
      783
      Views

      M

      @manel-sam said in Serial data received:

      So the append I should do it where§?

      Create a member variable in your imu class.

      // _packetData member variable of imu _packetData.append(serialPort->readAll()); if(_packetData.size()>=PACKET_LENGTH) { // packet complete qInfo() << QStringLiteral("data size is : ") << _packetData.size() << " octets"; qDebug() << "Serial received " << _packetData.toHex(); // go ahead with this packet QDataStream stream(_packetData); // Read The BigIndian value stream.setByteOrder(QDataStream::BigEndian); qint16 headerSignature; stream >> headerSignature; }

      You may also check the data received don't exceed PACKET_LENGTH, cause it means you have already received data from the next packet. (it may be irrelevant in your case, I don't kown)

    • BeaverShallBurn

      Solved Reading data from device via QModbusRtuSerialMaster
      General and Desktop • modbus serialport com-port qmodbusdevice c++ qt • • BeaverShallBurn

      3
      0
      Votes
      3
      Posts
      376
      Views

      BeaverShallBurn

      Hi, @J-Hilk!

      Looks like i found desired method in QModbusDataUnit class docs. Don't know how i missed it being mentioned in List of All Members for QModbusRtuSerialMaster. I guess digging into Qt docs about Modbus was a proper way to solve this :)

      QModbusDataUnit::QModbusDataUnit(QModbusDataUnit::RegisterType type, int address, const QVector<quint16> &data)

      In my case this will be:

      QModbusDataUnit input(QModbusDataUnit::InputRegisters, 3001, data);

      Thanks for joining my journey!

    • E

      Unsolved How I listen serial port with writing client code?
      General and Desktop • qserialport qtserialport cpp serialport virtual • • elypheldia

      6
      0
      Votes
      6
      Posts
      360
      Views

      KroMignon

      @elypheldia said in How I listen serial port with writing client code?:

      Sorry if used the wrong term. I am new on qt. I wanted to indicate that I read the data I wrote to the tnt0 serial port from terminal with using cat /dev/tnt0. But How can I do this with client code instead of reading from terminal. I just wanna open the tnt1 serial port from code., and I wanna read from there.

      You are confusing to me.
      Do you want to use /dev/tnt0 or /dev/tnt1?

      With the code example you have provided, you are writing hello on serial device /dev/tnt0. Is this working?

      You have defined a slot MySerialPort::readData() , which is called when data are ready to be read from serial port.
      I have proposed you some changes to display debug message when slot is called. Is this slot called?

      I don't know:

      what kind of device is connected to this serial port? if the serial port configuration is correct according to attached device? the attached device communication protocol: It is a binary or text protocol? Are carriage return or line feed required?
    • E

      Solved Cannot write a data to a virtual serial port ?
      General and Desktop • qserialport cpp serialport • • elypheldia

      16
      0
      Votes
      16
      Posts
      527
      Views

      E

      @J-Hilk Thank you all guys for your patient and sorry for my basic mistakes :). I fixed my issue. As you said, I expect the read without writing a data to serial port.

    • P

      Solved :-1: error: Project ERROR: Unknown module(s) in QT: serialport multimedia [solved]
      Installation and Deployment • linux serialport multimedia ubuntu pro file • • poggers

      6
      0
      Votes
      6
      Posts
      612
      Views

      P

      @SGaist i just used an older version of qt(5.12 instead of 6.1.2), and it worked

    • D

      Solved Open serial port when clicked the button
      General and Desktop • serialport button crashed • • deleted286

      4
      0
      Votes
      4
      Posts
      315
      Views

      Christian Ehrlicher

      @suslucoder Then mark the topic as solved.

    • D

      Unsolved QIODevice::write (QSerialPort): device not open
      General and Desktop • qt5 serialport com • • deleted286

      5
      0
      Votes
      5
      Posts
      2052
      Views

      J.Hilk

      @suslucoder are you sure com4 is the correct name ? something seems of, I would suggest using https://doc.qt.io/qt-5/qserialportinfo.html
      to query for the correct port and port name

    • A

      Unsolved Serial terminal disconnecting unexpectedly
      General and Desktop • serialport • • Alphy

      5
      0
      Votes
      5
      Posts
      239
      Views

      A

      @J-Hilk said in Serial terminal disconnecting unexpectedly:

      of course not, and there is no guarantee that 20ms will be enough each and every time!
      If new data arrives readyread will signal again. Your job as a programmer is to store the data, identify if all is arrived, and only then do your processing.

      Thank you so much for your quick reply. I store the data in an array and wait for the entire data to come. Now there is no problem with serial communication.

    • raymalifalitiko

      Solved Qt Serial Port "parameter is incorrect" error
      General and Desktop • serialport qtserialport qt 5.14.2 creator 4.11.2 • • raymalifalitiko

      12
      0
      Votes
      12
      Posts
      1407
      Views

      raymalifalitiko

      Thanks, @kuzulis for giving me a reference to look at the device side.

      The problem is solved by adding line coding settings to the CDC buffer on the STM. It is related to the hardware. STM users should bind USBD_CDC_LineCodingTypeDef data structure to CDC_Control_FS function.

      In ready-made examples, this binding does not exist. Users who do not add this binding can face the same problem in long term tests. Maybe it can help people who face the same problem.

      Regards

    • J.Hilk

      Solved QModbusRtuSerialMaster issues with 5.12.x
      General and Desktop • serialport modbus 5.12.1 5.12.0 msvc2015 • • J.Hilk

      2
      0
      Votes
      2
      Posts
      383
      Views

      J.Hilk

      To be continued at bugreports.qt.io

      https://bugreports.qt.io/browse/QTBUG-73965

    • douglas

      Unsolved wrong library or version mismatch when opening QSerialPort
      General and Desktop • serialport debug libraries qt5.7 • • douglas

      11
      0
      Votes
      11
      Posts
      2817
      Views

      jsulm

      @douglas Take a look at http://doc.qt.io/qt-5/linux-deployment.html
      And the question is: which version do you actually want to use?

    • douglas

      Solved Problems when adding serialport module in Qt project
      General and Desktop • serialport qserialport • • douglas

      58
      0
      Votes
      58
      Posts
      22576
      Views

      douglas

      Solved. The missing libQt5SerialPort.so.5 error on the target device was because that library effectively was not present. On the host side I added that library in the package list of the image and rebuild the image itself.

    • P

      Solved Project ERROR: Unknown module(s) in QT: serialport (Raspbian Jessie)
      Mobile and Embedded • raspberry pi 2 serialport jessie raspbian • • pbdot

      8
      0
      Votes
      8
      Posts
      18378
      Views

      I

      This one:

      sudo apt-get install libqt5serialport5 sudo apt-get install libqt5serialport5-dev

      Solved the Issue for me.

    • ktele

      Solved dataarray in QT sent to QSerialPort
      General and Desktop • serialport writedata qbytearray • • ktele

      7
      0
      Votes
      7
      Posts
      2518
      Views

      ktele

      Thanks! It worked!

    • C

      QtSerialPort and memory usage
      General and Desktop • serialport • • codeaway

      18
      0
      Votes
      18
      Posts
      6392
      Views

      K

      Probably it is a bug of QWinOverlappedIoNotifier : https://bugreports.qt.io/browse/QTBUG-48653
      Let's wait for more info about..

    • P

      [SOLVED] QSerialPort fails opening with "File exists" error message
      Mobile and Embedded • embedded serialport file exists • • pschuster

      4
      0
      Votes
      4
      Posts
      3687
      Views

      P

      AWESEOME! Thank you very much. 2) did the trick. I found a file /var/lock/LCK..ttyS3. After removing it the code posted above works fine. I will now try 1) or implement a patch myself.

      Thanks a lot. You made my day.
      Phillip

    • F

      SIGSEGV - segmentation fault
      Tools • sigsegv segmentation fa unexpectedly fi the inferior st debugging serial port serialport exe crashed • • FabioSO

      6
      0
      Votes
      6
      Posts
      2038
      Views

      SGaist

      You're welcome !

      Since you have it working now, please update the thread title prepending [solved] so other forums users may know a solution has been found :)

    • G

      [SOLVED] How to fix QtCreator and add QtSerialPort?
      Installation and Deployment • qtcreator ubuntu serialport • • Gaspard

      4
      0
      Votes
      4
      Posts
      3775
      Views

      G

      Ok, following the wiki worked.

    • M

      Arduino Serial Port Communications - Can't Open Arduino
      General and Desktop • arduino serial port serialport write read • • MagicalJourney

      7
      0
      Votes
      7
      Posts
      3598
      Views

      F

      @yoavmil I have been searching many forum and what was missing for me was the setDataTerminalReady(true);

      Finaly, it is working now!

    • S

      [SOLVED] SIGNAL/SLOT cannot work with Qt:QueuedConnection
      General and Desktop • signal & slot terminal serialport queuedconnectio thread threading • • Sen Li

      5
      0
      Votes
      5
      Posts
      8661
      Views

      S

      @Leonardo said:

      nections, the parameters must be of types that are known to Qt's meta-object system, because Qt needs to copy the arguments to store them in an event behind the scenes.
      ...
      Call qRegisterMetaType() to register the data type before you establish the connectio

      Wow, that really helps!

      Thank you so much!

      I will try it right now