Navigation

    Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Search
    • Unsolved
    1. Home
    2. Tags
    3. qserialport
    Log in to post

    • UNSOLVED How to write and read without interrupts using QSerialPort
      General and Desktop • qserialport • • timob256  

      2
      0
      Votes
      2
      Posts
      60
      Views

      @timob256 said in How to write and read without interrupts using QSerialPort: but I couldn't read it all the time. What does this mean? You show code reading from/writing to serial port but say nothing about which functions you are calling/testing. Why do you keep closing and re-opening the serial port between reads & writes?
    • UNSOLVED Receive Data QserialPort
      General and Desktop • c++ qt creator qserialport readyread • • manel.sam  

      10
      0
      Votes
      10
      Posts
      143
      Views

      @JonB @mrjj It's coming back to me. I once had the same problem with an IMU sensor that I could not solve under windows. But once under linux with the same code, I receive the data perfectly. Same thing, I just tested under linux for the GPS, I receive the data but not under Windows. To this day I don't know where the problem comes from
    • SOLVED Running just one slot in a different Thread
      General and Desktop • qthread qserialport qobject • • Kevin470  

      17
      0
      Votes
      17
      Posts
      168
      Views

      @kuzulis Thank you so much for your response. That is a great idea. But you are right, the communication protocol would make a lot more sense if it followed the <length><data><crc> structure. @JonB 's Idea works well with my existing Program structure.
    • SOLVED QSerialPort & QDataStream - Data not sent to the Serial Device
      General and Desktop • qt6 qserialport serial qdatastream hex • • Kevin470  

      3
      0
      Votes
      3
      Posts
      164
      Views

      @Christian-Ehrlicher Yup, it worked! Thanks a lot.
    • SOLVED Issue receiving data weighing scale Ohaus aviator 7000
      General and Desktop • c++ qserialport • • Yina  

      3
      0
      Votes
      3
      Posts
      117
      Views

      The issue was that it had to be byte \x05 and QByteArray.setnum(5) will result in \x35 so I had to use QByteArray::append()
    • SOLVED Unable to read from QSerialPort using MSVC compiler
      General and Desktop • qserialport mingw msvc read serial • • Turi  

      25
      0
      Votes
      25
      Posts
      783
      Views

      Here the bug report for this issue: https://bugreports.qt.io/browse/QTBUG-78086
    • UNSOLVED How I listen serial port with writing client code?
      General and Desktop • qserialport cpp serialport qtserialport virtual • • elypheldia  

      6
      0
      Votes
      6
      Posts
      182
      Views

      @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?
    • SOLVED Cannot write a data to a virtual serial port ?
      General and Desktop • qserialport cpp serialport • • elypheldia  

      16
      0
      Votes
      16
      Posts
      303
      Views

      @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.
    • UNSOLVED RTU Serial port isn't opening
      General and Desktop • qserialport rtu client • • Tague Carlyon  

      5
      0
      Votes
      5
      Posts
      229
      Views

      @Tague-Carlyon the event loop of QCoreApplications needs to be running, otherwise this won't work at all.
    • SOLVED QSerialPort Timeout Using waitForReadyRead on Windows
      General and Desktop • linux windows qserialport arduino • • cfallon61  

      4
      0
      Votes
      4
      Posts
      528
      Views

      Ok well here's an interesting discovery I've made, for anyone who finds this thread in the future: There seems to be an issue with the driver for the off-brand Arduino Nanos possibly not signalling to the OS correctly, or the implementation that Qt uses just really doesn't like the way that the driver responds. I am referring specifically to the nano clone which uses the QinHeng HL-340 serial peripheral. Not sure why this caused a problem, but there it is. Once I used an official Uno the code worked no problem. If I were more patient and had better resources I could possibly trace back the issue, but I do not, so sorry everyone lol. As such I'm marking this as resolved.
    • SOLVED QSerialPort Async read - How to ensure full packet read
      Mobile and Embedded • qt5 qserialport • • Michal Poplawski  

      11
      0
      Votes
      11
      Posts
      515
      Views

      @SGaist That's precisely the idea! :)
    • UNSOLVED How to include <QSerialPort> correctly?
      General and Desktop • qserialport • • BurSer  

      6
      0
      Votes
      6
      Posts
      2283
      Views

      @BurSer if your issue is solved please don't forget to mark your post as such!
    • UNSOLVED readyRead() signal is working strange
      Qt for MCUs • qserialport serial port readyread rs485 • • IRBaboon  

      14
      0
      Votes
      14
      Posts
      979
      Views

      @IRBaboon If your PC have no obvious lagging, my issue is an error direction. Here are some ideas you can try: read help doc seriously or test one other poeple's credible demo on your devie, is it possible to call it incorrectly?(for serial device, It is difficult for others to run your demo) try the lastest verion of QT
    • SOLVED Windows (10) and QSerialPort
      General and Desktop • qserialport windows10 • • mzimmers  

      12
      0
      Votes
      12
      Posts
      1085
      Views

      Here's my solution for this, in case anyone's interested: The header file: #include <windows.h> #include <dbt.h> #include <QObject> #include <QAbstractNativeEventFilter> class DeviceEventFilter: public QObject, public QAbstractNativeEventFilter { Q_OBJECT public: DeviceEventFilter(QObject *parent); bool nativeEventFilter(const QByteArray &eventType, void *message, long *result) Q_DECL_OVERRIDE; Q_SIGNALS: void notify(); }; And the source file: #include "eventfilter.h" DeviceEventFilter::DeviceEventFilter(QObject *parent) { Q_UNUSED(parent) } bool DeviceEventFilter::nativeEventFilter(const QByteArray &eventType, void *message, long *result) { Q_UNUSED(eventType) // unneeded as long as we're only running on Windows Q_UNUSED(result) MSG *msg = (MSG *)(message); if ((msg->message == WM_DEVICECHANGE) && (msg->wParam == DBT_DEVNODES_CHANGED)) { emit notify(); } return false; }
    • UNSOLVED QSerialPort::waitForReadyRead() delays at least 5-10ms, how to make it respond faster?
      General and Desktop • qserialport serial slow delay synchronous • • DerManu 0  

      3
      0
      Votes
      3
      Posts
      448
      Views

      Sounds like you should not be using QSerial and instead design a custom solution outside of Qt. Qt is not for real-time processing and your description of the task seems to imply real-time constraints.
    • SOLVED QSerialPort is(n't) sending data to ESP8266
      General and Desktop • qserialport esp8266 • • Gh0stShell  

      6
      0
      Votes
      6
      Posts
      340
      Views

      Thank you, the problem was, that I didn't wait for the Bytes to be written.
    • SOLVED QSerialPort - Cannot read more than 64 bytes - Windows - CP2102
      General and Desktop • qserialport read • • Guillaume Girardot  

      7
      0
      Votes
      7
      Posts
      510
      Views

      @hskoglund thanks for the help! I did not try your solution, but I guess it should work because the solution from @KroMignon works and you have the same diagnostic.
    • UNSOLVED QSerialport did not emit readyRead () signal,but USB monitor data received.Only occasionally problem
      General and Desktop • qserialport • • Crawl.W  

      17
      0
      Votes
      17
      Posts
      1306
      Views

      @J-Hilk Tks, I will do a test. Btw, I want to know more the root cause of QSerialport did not emit readyRead () signal.
    • UNSOLVED About QSerialPort
      General and Desktop • qserialport qt 5.12 • • ALONELUR  

      3
      0
      Votes
      3
      Posts
      241
      Views

      Hi and welcome to devnet, This is a known issue: QTBUG-78086. It's fixed and will be part of Qt 5.12.6 and 5.13.2.
    • SOLVED How to solve the QSerialPort::ResourceError on Linux platform?
      General and Desktop • linux qthread qserialport ubuntu 18.04 qt 5.13.1 • • Yash001  

      18
      0
      Votes
      18
      Posts
      1989
      Views

      Few place I read, it is generated due to some issue with kernel. So I just update the Ubuntu LTS, and Now it is working with same code.
    • SOLVED QSerialPort Issues after upgrading from QT 5.11 to QT 5.13
      General and Desktop • windows 10 qserialport 5.13 5.11.2 • • DanT  

      4
      0
      Votes
      4
      Posts
      866
      Views

      yup looks like it is that bug, thanks guys
    • UNSOLVED QSerialPort compatibility between 5.2 and 5.10
      General and Desktop • qserialport • • wrleisge  

      5
      0
      Votes
      5
      Posts
      342
      Views

      @kent-dorfman Flow control is not implemented on this receiver. GPSD is also not a concern as this receiver does not speak NMEA it conforms to ICD-GPS-153c.
    • SOLVED How to send the lecture of a Serial Port through a QTcpServer to a Client
      General and Desktop • qserialport qtcpsocket qtcpserver • • Dooham  

      5
      0
      Votes
      5
      Posts
      825
      Views

      @fcarney You were right. I changed the line where I initialize the serialport to a position before the connect and that works. Thanks!
    • UNSOLVED QSerialPort permissions problem (No. Not the easy problem)
      General and Desktop • qserialport • • dhkaplan  

      17
      0
      Votes
      17
      Posts
      1665
      Views

      @Kent-Dorfman Out of curiosity, and not wanting to start a flame war, I'm slightly surprised that you ship I/O access out-of-process. It may well be convenient for debugging/testing, but for production? Then again I know nothing about hardware, so you may so that serial port top speed is slow it doesn't matter, I don't know....
    • SOLVED How to create a QByteArray to send in QSerialPort
      General and Desktop • qserialport struct qbytea • • Dooham  

      7
      0
      Votes
      7
      Posts
      1444
      Views

      @Dooham You're OK, you are not the first (or the last) here to ask/state this! :)
    • SOLVED Connecting several readyRead() signals to one slot (QSerialPort)
      General and Desktop • qserialport signals & slots • • smnsmn  

      19
      0
      Votes
      19
      Posts
      2225
      Views

      @smnsmn said in Connecting several readyRead() signals to one slot (QSerialPort): Qt::QueuedConnection The slot is invoked when control returns to the event loop of the receiver's thread. The slot is executed in the receiver's thread. This is for queued connections which are not used by default for signals/slots in same thread. You really need to differentiate between connections in same thread and such between different threads. "Can signal thread == receiver thread?" - sure, it is like this most of the time. Only if you use more than one thread you can have signals and slots in different threads. For signals and slots in same thread queued connection is NOT used, unless you tell Qt to do so (last parameter in connect() call).
    • SOLVED How to get uint8_t from a QByteArray
      General and Desktop • qserialport qbytearray • • Dooham  

      3
      0
      Votes
      3
      Posts
      3580
      Views

      @Christian-Ehrlicher Thanks, that was exactly my problem.
    • SOLVED QSerialPort Issue:: reading an undesired write message.
      General and Desktop • qserialport write readyread read serial issue • • Factao  

      4
      0
      Votes
      4
      Posts
      634
      Views

      @aha_1980 I'm expecting to read and write data with a serial port, but, for some reason, the data sent by my pc is also read by my pc, so the problems is that the data sent is somehow triggering the readyRead signals. @J-Hilk I noticed that ,effectively, the echo wasn't turned off on the pi. For whatever reason, it completely broke my programs when I'm turning it of, so I'm going to install qt and try again on the pi before calling it a win.
    • UNSOLVED QSerialPort stops receiving with latest QT > 5.7
      General and Desktop • qserialport • • Inok  

      3
      0
      Votes
      3
      Posts
      452
      Views

      @kuzulis I installed com0com and have written a sender, but the behaviour is completely different and I can't reproduce the problem. The sent datablocks are received in the same size (up to 4096bytes) and the same time independent of the blocksize and speed I use to send the data. I don't think this approach helps... PS: The errorOccurred is handled and I doen't get an error. I commented it out for using QT5.7
    • UNSOLVED GUI freezes even with multithreading
      General and Desktop • qthread qserialport qt 5.5 qnetwork @dheerendra • • dev_512  

      17
      0
      Votes
      17
      Posts
      10965
      Views

      @dheerendra At this point, we are fairly certain that the problem is in the main thread code. I have uploaded the main thread code in the previous comment. Please suggest any necessary changes that could solve the issue. thank you.
    • UNSOLVED Turning off power to a running QSerialPort
      General and Desktop • qserialport segfault asynchronous • • sykac  

      14
      0
      Votes
      14
      Posts
      2181
      Views

      @sykac said in Turning off power to a running QSerialPort: One problem starts probably in the hardware. The COM port of the device disconnects from the PC (I don't why, it could be some driver/firmware issue) Reading you topic title, could it be that the USB connection between PC and FTDI is interrupted? And that's what I said, this may lead to endless loops in the device driver. This kind of problems can hardly be solved in the user space.
    • SOLVED Worker threads with shared resources in Qt application
      General and Desktop • qthread qserialport qt5.8 workerthread • • mkaze  

      8
      0
      Votes
      8
      Posts
      2943
      Views

      I agree you need to use a state machine for that case. http://doc.qt.io/qt-5/qstatemachine.html probably helps putting down the skeleton already
    • SOLVED In multithreading, the data received by the serial port is incorrect
      General and Desktop • qserialport readall • • HermesSJC  

      13
      0
      Votes
      13
      Posts
      2511
      Views

      Please try while (true) { if (SerialPort.waitForReadyRead(100)) { while (SerialPort.canReadLine()) qDebug() << SerialPort.readLine(); } } Now you can work on the already ready buffer obtained from "SerialPort.readLine();"
    • SOLVED Having SIGSEGV when setting serial port name
      Tools • qserialport sigsegv setportname • • cesar93  

      4
      0
      Votes
      4
      Posts
      904
      Views

      @cesar93 so if your problem is solved, please mark this topic as SOLVED too. Thanks
    • SOLVED Problems when adding serialport module in Qt project
      General and Desktop • qserialport serialport • • douglas  

      58
      0
      Votes
      58
      Posts
      20071
      Views

      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.
    • SOLVED Cannot read QSerialPort without event loop
      General and Desktop • qserialport library • • Hetsh  

      18
      0
      Votes
      18
      Posts
      5271
      Views

      As an option, you can create a separate thread in your DLL, e.g. QThread. Then, create the QSerialPort and then move it to that thread... Maybe it will help... An idea is that QSerialPort should get a QThread as a parent. AFAIK, it is not simple to use the Qt classes in the separate DLL's. It belongs not only to QSerialPort, it belongs also to other QIODevice and other classes. e.g. that classess can use the QTimer internally, which does not work without of an event loop... So, it is hard... I have not ideas.
    • SOLVED QSerialPort::readyRead() seems not get emitted on one installation while on other works normally
      General and Desktop • qserialport usb versions • • pmendl  

      8
      0
      Votes
      8
      Posts
      3294
      Views

      @aha_1980 Thank you so much for your ideas. Both problems solved. After reconfiguring aptitude stuff to use "stable" instead of hard-coded "jessie" and half-a-day-long upgrades and cleaning the mess I really got not only higher version of Qt, but as well QParallelPort working as planned. Definitely worth the effort (even if I did not expect the upgrade to take so much time.) My mistake. I missed this single character overload to append(). Thank you for pointing me there. Now I got completely rid of that development/release conditionals. Case closed, thanks to all who assisted.
    • SOLVED QSerialPort setting echo flags
      General and Desktop • qserialport • • matone1  

      2
      0
      Votes
      2
      Posts
      1359
      Views

      Hi, You can get the native handle with QSerialPort::handle and then modify its properties. Hope it helps
    • UNSOLVED Adding Serial Port Module with QT += serialport
      General and Desktop • qserialport 5.7 5.7.1 • • Orkun  

      4
      0
      Votes
      4
      Posts
      1967
      Views

      How did you install Qt ?