Tiny Core Linux
Tiny Core Base => Raspberry Pi => Topic started by: Juanito on October 17, 2022, 08:39:43 AM
-
libcamera and libcamera-apps added to the armv* repos - note that piCore-13.1 is required.
Add the following to config.txt: to enable the camera: camera_auto_detect=0
dtoverlay=imx219
Load libcamera-apps and then: sudo chown tc:staff /dev/media*
sudo chown tc:staff /dev/dma_heap/*
Check things are OK with: libcamera-hello -n
libcamera-still -r -n -o test.jpg
* tested with an RPi3
* RPi camera v2.1 used - a different dtoverlay will be required for other cameras
* there is a fix for /dev/media permissions in tc git
-
Are there any official plans to upgrade the libcamera extension?
I just tested installed libcamera on piCore v14, which results in an error with libtiff.so.
I also just tested it withe the same hardware, but running piCore v13 and there it works fine,
using: camera_auto_detect=1
Machine: Raspberry Pi 2 Model B V1.1
Camera: picamera v2.1
-
Hi segfault
I think libtiff.tcz needs to be changed to libtiff5.tcz in libcamera-apps.tcz.dep.
Try this:
tce-load -wi libtiff5.tcz
and let us know if that fixes the issue.
-
tce-load -wi libtiff5.tcz
and let us know if that fixes the issue.
Success. Yes that fixes the issue with libtiff. Yeay!!!!
The camera is still not working. Now I got another error.
Using the same config.txt camera config (which is a single line: camera_auto_detect=1) and same hardware (swiching SDCARD on device I get repeated and 100% reproduceability, so not likely HW issue), I did the following on both piCore v13 and v14:
sudo chown tc:staff /dev/media*
sudo chown tc:staff /dev/dma_heap/*
export LIBCAMERA_LOG_LEVELS=0
libcamera-hello -n
Then I compared the logs. The logs were first very similar, but on piCore v14 I get this error:
[0:08:32.444569804] [1699] DEBUG DeviceEnumerator device_enumerator_udev.cpp:320 All dependencies for media device /dev/media1 found
[0:08:32.444826314] [1699] DEBUG DeviceEnumerator device_enumerator.cpp:252 Added device /dev/media1: bcm2835-isp
[0:08:32.445415116] [1699] DEBUG Camera camera_manager.cpp:149 Found registered pipeline handler 'PipelineHandlerRPi'
[0:08:32.445719543] [1699] DEBUG RPI raspberrypi.cpp:1163 Unable to acquire a Unicam instance
ERROR: *** no cameras available ***
While on piCore v13 I first get:
[0:04:48.718246712] [889] DEBUG DeviceEnumerator device_enumerator.cpp:252 Added device /dev/media0: unicam
Then:
[0:04:48.718126556] [889] DEBUG DeviceEnumerator device_enumerator_udev.cpp:320 All dependencies for media device /dev/media0 found
[0:04:48.718246712] [889] DEBUG DeviceEnumerator device_enumerator.cpp:252 Added device /dev/media0: unicam
[0:04:48.718732285] [889] DEBUG Camera camera_manager.cpp:149 Found registered pipeline handler 'PipelineHandlerRPi'
[0:04:48.718939004] [889] DEBUG DeviceEnumerator device_enumerator.cpp:312 Successful match for media device "unicam"
[0:04:48.719118379] [889] DEBUG DeviceEnumerator device_enumerator.cpp:312 Successful match for media device "bcm2835-isp"
[0:04:48.719868118] [889] DEBUG V4L2 v4l2_device.cpp:627 'imx219 10-0010': Control: Exposure (0x00980911)
So it seems as though on piCore v14 the software is unable to register unicam.
From what I gather it could be either kernel mismatch or some bad permission.
Im going to look into this tomorrow.
-
Hi segfault
I changed libtiff.tcz to libtiff5.tcz in libcamera-apps.tcz.dep.
Seems a little odd to me TC13 finds it on /dev/media0 but TC14 is
looking at /dev/media1.
I'm not up on piCore or cameras but could this be related:
https://github.com/raspberrypi/libcamera/issues/44
-
Thank for the input Rich! 8)
I'm a JavaScript developer and not well versed in the intricacies of Linux, so there be dragons. Anyway since I don't know much about how Linux works, I created a delta between TC13 and TC14 and started to compare the two.
Studying the delta of dmesg logs, I noticed that something called imx219 was not showing up in TC14 while in TC13 it is ("imx219 10-0010: Consider updating driver imx219 to match on endpoints"). imx219 sees to be related to picamera. It also seems as though imx219 is dependent on i2c. While lsmod on TC14 does lists i2c, when I run cat /lib/modules/<piCore-version>/modules.dep and compared the two, there was a lot of i2c use on TC13, but in the kernel dep on TC14, i2c is barely mentioned. There is only one mention of imx219 on both of the systems: kernel.tclocal/drivers/media/i2c/imx219.ko but while im219 depends on kernel.tclocal/drivers/media/v4l2-core/v4l2-fwnode.ko kernel on TC13, on TC14 it depends on v4l2-async.ko (a ko that does not exist on TC13).
i2c and v4l2-async seems to serve different purposes.
Adding to config.txt: dtoverlay=imx219, startx=1 doesn't fix the problem, so this is where I'm at right now:
Maybe i2c is not properly loaded or something on TC14, or maybe v4l2-async fails at registering the camera.
Will investigate further...
-
On TC13 lsmod does list i2c-mux and i2c-mux-pinctrl-pinctrl along with imx219, but on TC14 it does not. I discovered a useful tool insmod with which I could load imx219 from the kernel.tclocal and then it shows up in lsmod also on TC14. But I don't find the i2c muxes folder on TC14 at all... maybe it was built into the kernel and just a red herring.
But I guess that perhaps it's noteworthy that imx219 doesn't show up on TC14, even though I got camera_auto_detect, start_x and dtoverlay=im219 in the config file, along with dtparam=i2c_arm=on.
-
Issue reproduced on my RBP 4 Model B.
-
Hi segfault
Juanito said:
... Add the following to config.txt: to enable the camera:
camera_auto_detect=0
dtoverlay=imx219
...
You used:
camera_auto_detect=1
See it works better with 0. There may be a driver related timing issue trying
to auto detect while booting. libcamera should load any drivers it needs on
its own.
-
Hi segfault
... But I don't find the i2c muxes folder on TC14 at all ...
Maybe under:
/lib/modules/KERNEL/kernel/drivers/i2c/muxes/
... But I guess that perhaps it's noteworthy that imx219 doesn't show up on TC14, even though I got camera_auto_detect, start_x and dtoverlay=im219 in the config file, along with dtparam=i2c_arm=on.
You meant imx219 , right?
-
Hi segfault
I just took a look in modules-6.1.68-piCore-v7l.gz and though the
i2c-mux* drivers are listed in modules.order , they don't seem to
appear anywhere else in modules-6.1.68-piCore-v7l.gz.
They also don't appear to be listed in any extensions.
-
... But I guess that perhaps it's noteworthy that imx219 doesn't show up on TC14, even though I got camera_auto_detect, start_x and dtoverlay=im219 in the config file, along with dtparam=i2c_arm=on.
You meant imx219 , right?
Yes, this was a typo in my forum post.
camera_auto_detect=1
See it works better with 0. There may be a driver related timing issue....
I've tried with 1 and with 0, and tried different combinations with start_x=1 along with camera_auto_detect=1 and 0, and specifying the dtoverlay and not specyfying it too. Nothing seems to work on TC14, while TC13 different kind of combinations works.
Hi segfault
I just took a look in modules-6.1.68-piCore-v7l.gz and though the
i2c-mux* drivers are listed in modules.order , they don't seem to
appear anywhere else in modules-6.1.68-piCore-v7l.gz.
They also don't appear to be listed in any extensions.
Just just learned how to do find -L /lib -name "*mux*" and also tried to find "*pin*" but on TC14 there is only one hit: video-mux.ko. However I'm beginning to think that it might be a red herring this thing with i2c, because after I learned how to check kernel dependencies, I noticed that the imx219.ko don't have a dep to i2c_mux_pinctrl.
I took at look at the link you posted previously related to "no camera detected" when running libcamera-hello, but I'm not sure if it is related. From what I gather tinycore works like this: the config.txt is being parsed, the computer encounters dtoveraly or camera_auto_detect and tries to register the camera, but for some reason it fails. Thus the camera is never even registered in the system, when libcamera-hello is run.
I've tried googling to find what code is parsing camera_auto_detect, so that I can track the progress from there. Maybe its even possible to follow the stack trace or something, but I've not been able to find the code.
All of these is way beyond my "comfort zone", so I'm pretty much at a loss here.
-
Hi segfault
... I noticed that the imx219.ko don't have a dep to i2c_mux_pinctrl. ...
That may be, but it's possible something in libcamera or libcamera-apps does.
-
I would try out the piCore15 beta. See if that makes any difference.
-
That may be, but it's possible something in libcamera or libcamera-apps does.
Right I hear you! Inspired by someone who also tried to get a camera working (https://forum.tinycorelinux.net/index.php/topic,26713.0.html) I took a peak in: http://tinycorelinux.net/14.x/armv7/releases/RPi/src/kernel/modules-6.1.68-piCore-v7.tar.xz and it turns out that the ic2/muxes folder exists there:
kernel/drivers/i2c/muxes/i2c-mux-pca954x.ko [i2c-mux-pinctrl.ko, etc]
I tried copying it to TC14 and tried loading is using sudo insmod but got invalid module format.
I would try out the piCore15 beta. See if that makes any difference.
Yes, good idea! I'll so that ASAP. Cheers.
-
The camera works fine on TC15beta add:
camera_auto_detect=1 to config.txt
and changing permissions of /dev/media (as detailed in top of this thread).
I took a look in the i2c driver folder and sure enough, the muxes folder is present on TC15beta and lsmod shows both i2c_mux and i2c_mux_pinctrl.
....I took a peak in: http://tinycorelinux.net/14.x/armv7/releases/RPi/src/kernel/modules-6.1.68-piCore-v7.tar.xz a...
I checked the dates and both uname -r and the date matches, but I got invalid format which after some research I now understand means that these files were not built with along with the distro I installed (though the dates matches). So both kernal format and the muxes differs... since i2c_mux* is used on both TC13, TC15 along with fixing the issues in the other camera related thread, I guess its safe to say that i2c is a strong suspect here.
But anyway... my camera works on TC15beta so I'm happy. ;D
Thanks for all the input and also I came away with both a fix and some more knowledge of how Linux works. 8)
-
Hi segfault
As you found out, kernel version must match module version. This is the correct
version and includes i2c-mux*:
http://tinycorelinux.net/14.x/armv7l/releases/RPi/src/kernel/modules-6.1.68-piCore-v7l.tar.xz
Why the versions included in the zip file are different, I don't know.
-
libcamera and rpicam-apps (ex libcamera-apps) updated in armhf 15.x repo
-
Great. Thank you Juanito!
Why the versions included in the zip file are different, I don't know.
Thanks for the input. Now I at least know my thinking wasnt bad.
libcamera and rpicam-apps (ex libcamera-apps) updated in armhf 15.x repo
Great news. Thank you Juanito!