Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-95040

[Reg 5.15 -> 6.2] New incoming CAN frames not read into QCanBusDevice

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: P1: Critical P1: Critical
    • 6.2.0 Beta2, 6.3.0 Alpha
    • 6.2.0 Alpha, 6.2.0 Beta1
    • SerialBus: CAN Bus
    • None
    • PCAN-USB Hardware from Peak
    • Windows
    • 117e99dffd800780e3f29f5d88c1cb171739ad50 (qt/qtserialbus/dev) 9e69d0697420409d671bcaf41efa443688b9b5d6 (qt/qtserialbus/6.2)

      I have a CAN bus application that has been working well in Qt 5 (latest Qt 5.15.2). I'm having issues with Qt 6.2.0 Alpha and Beta1.

      With an external CAN node connected and periodically transmitting, a QCanBusDevice on the PC Qt App is initialized and connected. CAN frames can be read once using QCanBusDevice::readAllFrames(), but subsequently, no further CAN frames are available.

      Minimal example code below (readAllFrames() is not used in this example):

      MainWindow::MainWindow(QWidget *parent) 
          : QMainWindow(parent)
          , ui(new Ui::MainWindow)
      { 
          ui->setupUi(this);  
      
          QString errorString; 
          // device is a QCanBusDevice*
          device = QCanBus::instance()->createDevice(
              QStringLiteral("peakcan"),
              QStringLiteral("usb0"), 
              &errorString
          );  
          device->setConfigurationParameter(QCanBusDevice::BitRateKey, 500000);      
          device->connectDevice();
      
          // timer is a QTimer*
          timer = new QTimer(); 
          timer->setInterval(100);
          connect(timer, SIGNAL(timeout()), this, SLOT(timerSlot()));
        
          timer->start();
      } 
      
      void MainWindow::timerSlot()
      { 
          qDebug() << device->busStatus() << device->framesAvailable();
      }
      • In Qt 5.15.2, the framesAvailable() value will keep increasing
      • In Qt 6.2.0, the framesAvailable() is stuck at a small number (approx 100+)
        • I am able to readAllFrames() on those available frames, then framesAvailable() will be stuck at 0, and doing more readAllFrames() will produce empty lists.
        • Calling resetController() will allow a fresh set of frames to be populated, but this is not a valid workaround since many frame are lost.
      • In both cases, the busStatus() is always CanBusStatus::Good

      Using PCAN-USB from Peak Systems.

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

            aha_1980 André Hartmann
            zhouquan zhouquan
            Votes:
            0 Vote for this issue
            Watchers:
            6 Start watching this issue

              Created:
              Updated:
              Resolved:

                There are no open Gerrit changes