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

QSerialPort crashes if incoming data is more than 127 bytes at a time



  • Following code is implemented and crashes if data is more than 127bytes at a time.

    serial->setPortName(currentPortName);
    serial->open(QSerialPort::ReadWrite);
    serial->setBaudRate(currentBaudRate.toInt());
    serial->setDataBits(QSerialPort::Data8);
    serial->setParity(QSerialPort::NoParity);
    serial->setStopBits(QSerialPort::OneStop);
    serial->setFlowControl(QSerialPort::NoFlowControl);

    connect(serial,SIGNAL(readyRead()),this,SLOT(serialReceived()));
    

    serialReceived()
    {
    int byte_count;
    byte_count = serial->bytesAvailable();
    QByteArray data = serial->readAll();
    }

    Please help to solve the above issue.


  • Lifetime Qt Champion

    Hi @Akash_Patil,

    where exactly does it crash? From the snippet you provided, nothing obvious is seen.

    Run your program in a debugger and provide the stack trace after the crash.

    Regards


Log in to reply