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

Read/write virtual serial port ttyRPMSG0



  • I'm using the STM32MP157-DK2 and have a Qt 5.11.3 application that I'd like to talk back and forth with the co-processor M4 through OpenAMP virtual serial port ttyRPMSG0.

    Initially I had success sending a message to the M4 core with this code:

        QProcess sh;
        sh.start("sh", QStringList() << "-c" << "echo 'hello virtual uart - QT'>/dev/ttyRPMSG0");
        sh.waitForFinished();
        QByteArray output = sh.readAll();
        qDebug()<< output;
        sh.close();
    

    The M4 core echo's what it receives and I can read this on a terminal session using:

    stty -onlcr -echo -F /dev/ttyRPMSG0
    cat /dev/ttyRPMSG0 &
    echo “hello virtual uart0” >/dev/ttyRPMSG0
    

    However, I'm having a problem receiving the response from the M4 core to my Qt application. I've looked into using Qserial but Qt cannot find the library (Ubuntu problem??) and compiling the library myself did not go well. But I think I should be able to get the job done using a QProcess.

    Can anyone help me receive the data from ttyRPMSG0?


  • Qt Champions 2019

    @oparmerman said in Read/write virtual serial port ttyRPMSG0:

    I am using Buildroot to make the target Linux image. Could the Qt packages selected for Buildroot make a difference in the libraries that Qt Creator knows about?

    You need to install Qt serial port stuff in your Buildroot/sysroot


  • Qt Champions 2019



  • @jsulm I tried that but QSerialPort is not found. I've spent the better part of a day trying to add QSerialPort to my Qt install but nothing works. First I tried:

    sudo apt-get install libqt5serialport5
    sudo apt-get install libqt5serialport5-dev
    

    But Qt still doesn't know about QSerial. Here's a few links I've tried and the result:

    Trouble with QSerialPort with qtcreator on Debian which led me to try building the QSerialPort library. But trying to make the QSerialPort library results in:

    fatal error: private/qiodevice_p.h: No such file or directory
    

    Which led to this link which fixed the issue with:

    sudo apt-get install qtbase5-private-dev
    
    

    But then I still get errors in compilation.

    I am using Buildroot to make the target Linux image. Could the Qt packages selected for Buildroot make a difference in the libraries that Qt Creator knows about?


  • Qt Champions 2019

    @oparmerman said in Read/write virtual serial port ttyRPMSG0:

    I am using Buildroot to make the target Linux image. Could the Qt packages selected for Buildroot make a difference in the libraries that Qt Creator knows about?

    You need to install Qt serial port stuff in your Buildroot/sysroot



  • @jsulm This was the solution. Thank you.


Log in to reply