Results 1 to 2 of 2

Thread: QSerialPort not working in startup stage with Atmel D20 on board USB to serial port

  1. #1
    Join Date
    May 2015
    Qt products
    Qt5 Qt/Embedded
    MacOS X Windows Android

    Default QSerialPort not working in startup stage with Atmel D20 on board USB to serial port

    I work base on windows8.1 with QT5.4 environment and using QSerialPort example (terminal) to connect to my Atmel SAMD21 board USB-Serial port. When 1st time connect this board to my USB port, it doesn't have any response on this terminal workspace. But if I use other terminal tool (like teraterm), it will work properly everytime. Then after connect successful by that way, I switch back to execute my Qt terminal sample, it works as normal.

    It is strange for me. Then I add serial=->clear() after serial->open() successfully, it will cause this application hang. My modification as below:
    void MainWindow:penSerialPort()
    SettingsDialog::Settings p = settings->settings();
    if (serial->open(QIODevice::ReadWrite)) {
    ui->statusBar->showMessage(tr("Connected to %1 : %2, %3, %4, %5, %6")
    .arg( aBits)
    .arg(p.stringParity).arg(p.stringStopBits).arg(p.s tringFlowControl));
    serial->clear(); // << The only line I add
    } else {
    QMessageBox::critical(this, tr("Error"), serial->errorString());

    ui->statusBar->showMessage(tr("Open error"));

    Does anybody have same issue before as mine? Please help.

  2. #2
    Join Date
    Mar 2009
    Brisbane, Australia
    Thanked 1,595 Times in 1,523 Posts
    Qt products
    Qt4 Qt5
    Unix/X11 Windows
    Wiki edits

    Default Re: QSerialPort not working in startup stage with Atmel D20 on board USB to serial po

    You need to get the right baud rate, data bits, parity etc. to be able to talk. The serial port will open if the parameters are acceptable to your PC's serial hardware and no other software has a hold over the port. Opening the port does not guarantee anything about the other end of the comms link. Depending on the wiring of your serial link and the expectations of the remote device you may need to set the Data Terminal Ready (DTR) signal and/or hardware handshaking.

Similar Threads

  1. How can i get data from com port use qserialport?
    By netvan42 in forum Qt Programming
    Replies: 0
    Last Post: 1st June 2014, 14:35
  2. QSerialPort :: read - Serial Comms noob.
    By llaregyb in forum Qt Programming
    Replies: 2
    Last Post: 8th January 2014, 13:18
  3. Replies: 3
    Last Post: 2nd December 2012, 15:10
  4. Replies: 3
    Last Post: 22nd December 2011, 06:39
  5. Replies: 1
    Last Post: 16th June 2009, 10:09

Tags for this Thread


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.