Skip to main content
VTorr.1
Associate
February 11, 2024
Question

Python GUI for STM32MP157F-DK2

  • February 11, 2024
  • 3 replies
  • 7568 views

I am trying to create a GUI on the LCD of the STM32MP157C-DK2 but I get errors.

For example, when I try the code from Shail in this thread, I get:

root@stm32mp1:/tmp# su -l weston -c "env QT_QPA_PLATFORM=wayland-egl python3 /home/weston/filename.py"
[ 1] Failed to open device: No such file or directory, Try again...
[ 2] Failed to open device: No such file or directory, Try again...
[ 3] Failed to open device: No such file or directory, Try again...
[ 4] Failed to open device: No such file or directory, Try again...
[ 5] _OpenDevice(1111): FATAL: Failed to open device, errno=No such file or directory.
[ 6] Failed to open device: No such file or directory, Try again...
[ 7] Failed to open device: No such file or directory, Try again...
[ 8] Failed to open device: No such file or directory, Try again...
[ 9] Failed to open device: No such file or directory, Try again...
[ 10] _OpenDevice(1111): FATAL: Failed to open device, errno=No such file or directory.

-------------------------------

The display works ok and I am able to execute the GTK "hello world" example. 

I am using the kernel from stm32mp1-openstlinux-6.1-yocto-mickledore-mp1-v23.06.21.

I haven't found a guide/tutorial on this topic. Any help would be appreciated.

 

This topic has been closed for replies.

3 replies

Jean-Marc B
ST Employee
February 12, 2024

Hi @VTorr.1 

I take Shail's example:

from PyQt5.QtWidgets import QApplication, QMainWindow, QPushButton
from PyQt5 import sip
app = QApplication([])
mainWin = QMainWindow()
button = QPushButton("Hello, PyQt5!")
mainWin.setCentralWidget(button)
mainWin.show()
app.exec_()

I install the required packages and copy the python script to /home/weston:

root@stm32mp1:~# apt-get install qtwayland python3-pyqt5
[...]
root@stm32mp1:~# cp filename.py /home/weston/filename.py

 Then I execute the program with the command you provided:

root@stm32mp1:~# su -l weston -c "env QT_QPA_PLATFORM=wayland-egl python3 /home/weston/filename.py"

 The Qt window appears on the screen but there is no error message.

Could you confirm you followed the same steps than the one described above, including the contents of the python script filename.py?

Best regards

--JM

VTorr.1
VTorr.1Author
Associate
February 12, 2024

Hi Jean-Marc,

thank you for your help. I appreciate it.

This is the output I get for those commands:

root@stm32mp1:/tmp# cat filename.py

from PyQt5.QtWidgets import QApplication, QMainWindow, QPushButton
from PyQt5 import sip
app = QApplication([])
mainWin = QMainWindow()
button = QPushButton("Hello, PyQt5!")
mainWin.setCentralWidget(button)
mainWin.show()
app.exec_()

root@stm32mp1:/tmp# apt-get install qtwayland python3-pyqt5
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
qtwayland is already the newest version (5.15.9+git0+8f56244ea7-r0).
python3-pyqt5 is already the newest version (5.15.9-r0).
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.


root@stm32mp1:/tmp# cp filename.py /home/weston/filename.py
root@stm32mp1:/tmp# su -l weston -c "env QT_QPA_PLATFORM=wayland-egl python3 /ho
me/weston/filename.py"
[ 1] Failed to open device: No such file or directory, Try again...
[ 2] Failed to open device: No such file or directory, Try again...
[ 3] Failed to open device: No such file or directory, Try again...
[ 4] Failed to open device: No such file or directory, Try again...
[ 5] _OpenDevice(1111): FATAL: Failed to open device, errno=No such file or directory.
[ 6] Failed to open device: No such file or directory, Try again...
[ 7] Failed to open device: No such file or directory, Try again...
[ 8] Failed to open device: No such file or directory, Try again...
[ 9] Failed to open device: No such file or directory, Try again...
[ 10] _OpenDevice(1111): FATAL: Failed to open device, errno=No such file or directory.

 

I don't know if this info helps, but if I execute "weston-terminal", for example, the terminal window pops-up on the screen.

Thank you.

 

Jean-Marc B
ST Employee
February 12, 2024

Hi @VTorr.1 

Thank you for your feedback.

Do you confirm you are using the STM32MP157C-DK2 board?

What is the image you are running on the board? Is it an image you build by yourself?

Best regards,

--JM

VTorr.1
VTorr.1Author
Associate
February 12, 2024

Hi Jean-Marc,

thank you for your help.

It is not the 147C but the 147F version. My bad. 

U-BOOT recognizes it as STM32MP157F-DK2:

Model: STMicroelectronics STM32MP157F-DK2 Discovery Board
Board: stm32mp1 in trusted mode (st,stm32mp157f-dk2)

I compiled the kernel using the stm32mp1-openstlinux-6.1-yocto-mickledore-mp1-v23.06.21 files and then created the SD image using FlashLayout_sdcard_stm32mp157f-dk2-optee.tsv.

 

Jean-Marc B
ST Employee
February 12, 2024

Hi @VTorr.1 

hum, I guess you mean 157F and not 147F ;)

It seems to me your problem looks like this one: https://community.st.com/t5/stm32-mpus-products/can-t-run-st-example-image-qt-qt-examples-on-a-custom-board/td-p/154722

Did you accept the EULA when building your own image?

Best regards

--JM

Jean-Marc B
ST Employee
February 26, 2024

Hi @VTorr.1 

I am glad you successfully reach your goal.

About your last results:

- Running the bitbake commands without errors in your virtual machine means you have some configuration problems with your Ubuntu machine. You have to check if all required packages are installed.

- To include gcc into your image, you can update the file conf/local.conf by adding the line:

IMAGE_INSTALL:append = " gcc"

(see https://docs.yoctoproject.org/ref-manual/variables.html?highlight=image_install#term-IMAGE_INSTALL)

- I would recommend to use a local package repository. Please follow the wiki page: https://wiki.st.com/stm32mpu/wiki/Package_repository_for_OpenSTLinux_distribution#How_to_activate_a_local_package_repository

- For the root file system size, please refer to https://community.st.com/t5/stm32-mpus-embedded-software/increasing-the-rootfs-size-on-a-stm32mp157f-dk2/td-p/205665

 

Hope it helps.

 

Best regards,

--JM

In order to give better visibility on the answered topics, please click on 'Accept as Solution' on the reply which solved your issue or answered your question.

VTorr.1
VTorr.1Author
Associate
February 26, 2024

Hi @Jean-Marc B,

 

I suspect that the problems with bitbake in the host linux came from the version of the "repo" executable used. Right now an image build has just finished without errors in the ubuntu host, not in the virtual machine. I had compilation problems on certain packages (e.g. ffmpeg) before, but I started from scratch using a different repo executable.
Thank for the new tips and all your help before that.