Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. QSerialPort crashes if incoming data is more than 127 bytes at a time
Qt 6.11 is out! See what's new in the release blog

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

Scheduled Pinned Locked Moved Unsolved General and Desktop
2 Posts 2 Posters 490 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A Offline
    A Offline
    Akash_Patil
    wrote on last edited by
    #1

    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.

    aha_1980A 1 Reply Last reply
    0
    • A Akash_Patil

      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.

      aha_1980A Offline
      aha_1980A Offline
      aha_1980
      Lifetime Qt Champion
      wrote on last edited by
      #2

      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

      Qt has to stay free or it will die.

      1 Reply Last reply
      4

      • Login

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved