Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

QSerialPort max. custom BaudRate



  • Hey Guys,
    I am currently trying to read hardware with 3,000,000 baud. Unfortunately QTSerialPort only offers rates up to 115200 baud. I have seen that it is also possible to enter your own baud rates (see: https://forum.qt.io/topic/38332/qserialport-custom-baudrate) This also works for me. Unfortunately, only baud rates up to 600,000 are possible. The packets sent do not arrive completely at higher baud rates. I hope someone can help me quickly.
    Thanks 😊



  • @MB_1 Hi and welcome to the forum. First which version of Qt you are using? What is the size of your packets?
    On some Qt Version, there are known issues with QSerialPort (Qt 5.12.5 and Qt 5.13.1).
    How do you read data from QSerialPort?



  • Hello @KroMignon , thanks for the quick reply. I am currently using QT 5.12.4 on a Windows 10 system. I am currently trying some things with an Arduino DUE, there the packet size I send is 4Byte. The actual hardware I want to connect is a sensor where the packet size is approximately 2600 bytes. But first I want to try using the Arduino at a higher baud rate. I know the Arduino cannot transmit at 3,000,000 baud, but 1,000,000 should be possible. However, as written above, I am currently only up to 600,000 baud. The call looks like this:

    if(arduino_is_available){
           qDebug() << "Found the arduino port...\n";
           arduino->setPortName(arduino_due_port_name);
           arduino->open(QSerialPort::ReadOnly);
           //arduino->setBaudRate(QSerialPort::Baud115200);
           arduino->setBaudRate(600000);
           arduino->setDataBits(QSerialPort::Data8);
           arduino->setFlowControl(QSerialPort::NoFlowControl);
           arduino->setParity(QSerialPort::NoParity);
           arduino->setStopBits(QSerialPort::OneStop);
          
           QObject::connect(arduino, SIGNAL(readyRead()), this, SLOT(readSerial2()));
           
           
    
    
       }else{.....
    

  • Lifetime Qt Champion

    Hi and welcome to devnet,

    One maybe silly question but do you have another application on your machine that is able to communicate at such high speeds ?

    You could be hitting a limit of your computer and not of your device.



  • Yes, I have software that can read the data of the sensor with the high baud rate. However, this software uses the manufacturer's drivers and the functions of the driver's .dll file are used.



  • @MB_1 I think the hardware layer is USB? As @SGaist suggest you, I would first try it out with a serial terminal to verify that you don't hit hardware limit of your PC.
    You can use something like Realterm to verify it.



  • @MB_1 Hi,
    Are your sure you hardware is able to reach this baud rate ?

    I successfully reached baud rate of 6'300'000 using QSerialPort with FTDI (C32HM-DDHSL-0) device when using this tool:
    https://github.com/hydrabus/hydratool

    I'm on Windows 10 and I used Qt 5.13



  • Most likely it's a problem with specific version of drivers of specific device on specific OS. I've got into similar trouble. Communication via "CP2102 USB to UART" device with 1,5MBaud works under Linux but doesn't work under Windows 10 (with official drivers installed). And HTerm fails to open port too (saying "Error in OpenPort::Baudrate: Value of '1500000' not supported"), so it seems to be not Qt fault.


Log in to reply