Error running stm32flash with QProcess
-
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
-
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
@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)
-
@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)
@jsulm thanks for your reply. but in my case env. variables are the same
-
Hi,
You don't sudo when running it from the command line ?
-
@SGaist Hi, no because i'm root.
also qt application are root (checked running 'whoami' command) -
@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/ttyUSB0but same result
-
@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/ttyUSB0but same result
How did you call that script ?