Stranges characters first ready read qserialport Linux or mac



  • I have probem with qt qserialport
    5.5 or 5.6.
    With a terminal project exemple.

    Sometimes at start in first ready read. Characters is stranges
    Lot of characters incorrectly

    I have platform why send 28 bytes

    with 5aa5 at begining.

    Linux or mac same problems

    With Windows works with the same project.

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

    No characters available after open
    But in ready read receive incorrectly characters

    Please Help.



  • I think you should try clearing port after initialization like:

    QSerialPort *port = new QSerialPort(); 
    port->clear(QSerialPort::AllDirections);
    

    You can read more about it here: http://doc.qt.io/qt-5/qserialport.html#clear



  • no change because no character available after open.

    in my mac:

    connecté: "cu.usbserial-FTB4CPZG"
    Recu : "5aa591327210074b3800190000000000000000000000c8000001014e5aa592327c10074b3800160000000000000000000000c700000101475aa593328610" len: 62
    Recu : "5aa5dead7410074b3800160000000000000000000000c70000010188" len: 28
    Recu : "5aa5dfad7e10074b38" len: 9
    Recu : "00180000000000000000000000c8000001017a" len: 19
    Recu : "5aa5" len: 2
    Recu : "e0ad8810074b3800180000000000000000000000c8000001016f" len: 26
    Recu : "5aa5e1ad9210074b3800180000000000000000000000c700000101" len: 27
    Recu : "65" len: 1

    with clear:
    nb bytes avaible before open 0
    nb bytes avaible after open with clear() 0
    connecté: "cu.usbserial-FTB4CPZG"
    Recu : "a5 fe aeb410074b3800180000000000000000000000c70000010125
    5aa5 ff aebe10074b3800180000000000000000000000c7000001011a
    5aa5 00 aec81007
    5aa5 00 fec810074b3800140000000000000000" len: 81

    first packet is all the time wrong....!!!!
    it's crazy....!
    byte after 5aa5 represent counter frame of protocole

    2 frames have the same id!

    Recu : "000000c800000101c2" len: 9

    Recu : "5aa501fed210074b3800140000" len: 13
    Recu : "000000000000000000c700000101b8" len: 15

    Recu : "5aa502fedc1007" len: 7
    Recu : "4b3800160000000000000000000000c800000101aa" len: 21

    Recu : "5aa503fee610074b3800160000000000000000000000c700000101a0" len: 28

    sometimes
    all is wrong:
    nb bytes avaible avant open 0
    nb bytes avaible apres open 0
    connecté: "cu.usbserial-FTB4CPZG"
    Recu : "83090d610a0000080000000a006083080c610601000000000009006083080f6106010000000000090020832900610602000000000009008033290b610e01" len: 62
    Recu : "5aa5e8e7d810074b3800180000000000000000000000c70000" len: 25
    Recu : "0101de" len: 3
    Recu : "5aa5e9e7e210074b3800180000000000000000" len: 19
    Recu : "000000c800000101d2" len: 9

    i clear after open,
    i clear before close.

    software coolTerm have same Problem... linux problem???



Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.