Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Mobile and Embedded
  4. Error running stm32flash with QProcess
Qt 6.11 is out! See what's new in the release blog

Error running stm32flash with QProcess

Scheduled Pinned Locked Moved Unsolved Mobile and Embedded
7 Posts 3 Posters 815 Views 1 Watching
  • 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.
  • E Offline
    E Offline
    enricrazza
    wrote on last edited by
    #1

    Hi, i'm trying to run stm32flash with qt process, but it gives error.
    but running the same command on terminal, it works.
    the program (stm32flash) should write the firmware to be loaded onto a st micro.
    I therefore tried to monitor the serial communication, and I see that the two processors are actually sending messages.
    i'm running qt on imx8 with yocto warrior distribution. qt 5.12.

    here's what i tried.

    QProcess *loadFirmware = new QProcess();
    loadFirmware->start("stm32flash", QStringList() << "-b" << "9600" << "-w" << path << "/dev/ttyUSB0");
    loadFirmware->waitForFinished(-1);
    qDebug() << loadFirmware->readAllStandardError();
    qDebug() << loadFirmware->readAllStandardOutput();
    

    qutput:

    "Failed to init device after retry.\n"
    "stm32flash 0.7\n\nhttp://stm32flash.sourceforge.net/\n\nUsing Parser : Raw BINARY\nSize         : 301172\nInterface serial_posix: 9600 8E1\n\n"
    

    what is the difference between running a program with qprocess and running it from a terminal?

    thanks for your answer

    jsulmJ 1 Reply Last reply
    0
    • E enricrazza

      Hi, i'm trying to run stm32flash with qt process, but it gives error.
      but running the same command on terminal, it works.
      the program (stm32flash) should write the firmware to be loaded onto a st micro.
      I therefore tried to monitor the serial communication, and I see that the two processors are actually sending messages.
      i'm running qt on imx8 with yocto warrior distribution. qt 5.12.

      here's what i tried.

      QProcess *loadFirmware = new QProcess();
      loadFirmware->start("stm32flash", QStringList() << "-b" << "9600" << "-w" << path << "/dev/ttyUSB0");
      loadFirmware->waitForFinished(-1);
      qDebug() << loadFirmware->readAllStandardError();
      qDebug() << loadFirmware->readAllStandardOutput();
      

      qutput:

      "Failed to init device after retry.\n"
      "stm32flash 0.7\n\nhttp://stm32flash.sourceforge.net/\n\nUsing Parser : Raw BINARY\nSize         : 301172\nInterface serial_posix: 9600 8E1\n\n"
      

      what is the difference between running a program with qprocess and running it from a terminal?

      thanks for your answer

      jsulmJ Offline
      jsulmJ Offline
      jsulm
      Lifetime Qt Champion
      wrote on last edited by
      #2

      @enricrazza said in Error running stm32flash with QProcess:

      what is the difference between running a program with qprocess and running it from a terminal?

      Environment (environment variables)

      https://forum.qt.io/topic/113070/qt-code-of-conduct

      E 1 Reply Last reply
      0
      • jsulmJ jsulm

        @enricrazza said in Error running stm32flash with QProcess:

        what is the difference between running a program with qprocess and running it from a terminal?

        Environment (environment variables)

        E Offline
        E Offline
        enricrazza
        wrote on last edited by
        #3

        @jsulm thanks for your reply. but in my case env. variables are the same

        1 Reply Last reply
        0
        • SGaistS Offline
          SGaistS Offline
          SGaist
          Lifetime Qt Champion
          wrote on last edited by
          #4

          Hi,

          You don't sudo when running it from the command line ?

          Interested in AI ? www.idiap.ch
          Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

          E 2 Replies Last reply
          0
          • SGaistS SGaist

            Hi,

            You don't sudo when running it from the command line ?

            E Offline
            E Offline
            enricrazza
            wrote on last edited by
            #5

            @SGaist Hi, no because i'm root.
            also qt application are root (checked running 'whoami' command)

            1 Reply Last reply
            0
            • SGaistS SGaist

              Hi,

              You don't sudo when running it from the command line ?

              E Offline
              E Offline
              enricrazza
              wrote on last edited by
              #6

              @SGaist i've just tried also to run from qt a bash file.
              bash code:

              #!/bin/bash
              
              PATH_GPIO_EXP="/sys/class/gpio/export"
              PATH_GPIO_DIR="/sys/class/gpio"
              
              RESET="5"
              C_BOOT="4"
              P_BOOT="3"
              
              sudo echo 0 > $PATH_GPIO_DIR/gpio$RESET/value
              sudo echo 1 > $PATH_GPIO_DIR/gpio$C_BOOT/value
              sudo echo 0 > $PATH_GPIO_DIR/gpio$P_BOOT/value
              
              /bin/sleep 4
              
              sudo echo 1 > $PATH_GPIO_GIR/gpio$RESET/value
              sudo stm32flash -w $1 /dev/ttyUSB0
              

              but same result

              SGaistS 1 Reply Last reply
              0
              • E enricrazza

                @SGaist i've just tried also to run from qt a bash file.
                bash code:

                #!/bin/bash
                
                PATH_GPIO_EXP="/sys/class/gpio/export"
                PATH_GPIO_DIR="/sys/class/gpio"
                
                RESET="5"
                C_BOOT="4"
                P_BOOT="3"
                
                sudo echo 0 > $PATH_GPIO_DIR/gpio$RESET/value
                sudo echo 1 > $PATH_GPIO_DIR/gpio$C_BOOT/value
                sudo echo 0 > $PATH_GPIO_DIR/gpio$P_BOOT/value
                
                /bin/sleep 4
                
                sudo echo 1 > $PATH_GPIO_GIR/gpio$RESET/value
                sudo stm32flash -w $1 /dev/ttyUSB0
                

                but same result

                SGaistS Offline
                SGaistS Offline
                SGaist
                Lifetime Qt Champion
                wrote on last edited by
                #7

                How did you call that script ?

                Interested in AI ? www.idiap.ch
                Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                1 Reply Last reply
                0

                • Login

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