Unable to open I2C device: No such file or directory on Boot2Qt
-
wrote on 21 Apr 2021, 13:28 last edited by
Hi everyone,
I'm trying to run a Qt5 application wrote from us that use the i2c interface to communicate to some buttons. We followed this guide https://doc.qt.io/archives/qt-5.8-devicecreation/qtee-preparing-hardware-rasberrypi.html on how to configure the sd card and Qt Creator.Once we compiled the and deployed the application, at first the rpi3 reported an error on missing wiringPi libraries. To solve that problem we copied a compiled version of libwiringPi.so.2.50 and libwiringPiDev.so.2.50 in the /usr/lib/ rpi3 directory using scp. But now, if we try to run the application this error comes out:
Unable to open I2C device: No such file or directory Process exited with exit code 1 quit
We tried, by mounting /dev/mmcblk0p1, to edit the config.txt file enabling:
dtparam=i2c_arm=on dtparam=spi=on
Nothing changed.
Thank you in advance for your help. If you also know some other guides to develop Qt5 applications using the i2c interface on Boot2Qt it would be awsome.
-
Hi and welcome to devnet,
This is just a wild guess but did you check that you indeed have the corresponding devices active ?
There's this guide that seemed to be quite complete in that reguard.
Hope it helps
-
wrote on 22 Apr 2021, 09:01 last edited by
Hi,
Thanks for your reply. I'm currently using Boot2Qt from Qt for device creation so I cannot open raspi-config.
I found a thread that almost solved my problem: https://www.raspberrypi.org/forums/viewtopic.php?t=188248.
Basically by running:modprobe i2c-dev
the i2c turns on and my application does work. The problem is that I need the i2c to be active at boot time.
Can I write a script that can automatically be executed at boot time in which I run the command above?
-
wrote on 22 Apr 2021, 10:41 last edited by
Ok I solved my problem thanks to this guide: https://retifrav.github.io/blog/2017/12/08/b2qt-startup-script/.
Basically I created a script which run:
modprobe i2c-dev
and my application.
Everything works fine.
-
Or you can edit
/etc/modules
which lists the modules you want to be explicitly loaded at boot time. -
wrote on 15 May 2021, 06:02 last edited by Harish18
Thank you in advance for your help. If you also know some other guides to develop Qt5 applications using the i2c interface on Boot2Qt it would be awsome.
Download Piano Music Tiles 2 Mod