RPi Cam V2 (Sony IMX219) w/ Edge AI Demos

Hello,

I was hoping to try out some of the Edge AI demos and I have a V2 RPi camera (IMX219) + BB AI-64, which is the one supported in the Edge AI docs: [Getting Started — BeagleBoard Documentation](https://AI-64- EdgeAI -Getting Started)

I know these are mostly sources from TI’s Edge AI docs buts I’m stuck at the first step of enabling the camera. This is the note at the link above:
To be updated By default IMX219 is disabled. After connecting the camera you can enable it by specifying the dtb overlay file in/run/media/mmcblk0p1/uenv.txt as below,

I do not have a /media/ folder in /run/, is there another way I should be enabling the imx219 camera overlay?

(I also have the V1 camera)

1 Like

Sorry, haven’t gotten this finished in our image… i also have the camera, need to personally plug it in and see what’s what…

Regards,

Is this something we can help accelerate or is there a roadmap for when we could expect the inclusion of the driver in a AI-64 image?

Best, Mat

timelines! hah!

debian@BeagleBone:/opt/source/dtb-5.10-ti$ dmesg | grep imx
[   10.284494] imx219 6-0010: supply VANA not found, using dummy regulator
[   10.291266] imx219 6-0010: supply VDIG not found, using dummy regulator
[   10.297941] imx219 6-0010: supply VDDL not found, using dummy regulator
[   10.395822] imx219 6-0010: failed to read chip id 219
[   10.468943] imx219: probe of 6-0010 failed with error -5

yeah, working on it…

Hehe sorry about the timeline ask, I’m projecting my terrible work habits and forgetting the generosity.
I feel helpless and I want to unleash the true power of this beautiful board! :nerd_face:

For my personal curiosity, is it a question of adapting/compiling TI’s IMX219 example driver in the kernel and testing?

Right now, i’m torn between… the cable being wrong, or bad…

debian@BeagleBone:/opt/source/dtb-5.10-ti$ ls -lha /dev/bone/i2c/csi0 
lrwxrwxrwx 1 root root 11 Aug  7 13:25 /dev/bone/i2c/csi0 -> ../../i2c-6
debian@BeagleBone:/opt/source/dtb-5.10-ti$ sudo i2cdetect -y -r 6
     0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f
00:                         -- -- -- -- -- -- -- -- 
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
70: -- -- -- -- -- -- -- --

Update: further… progress, it’s loaded… :wink: and it shows up…

git clone -b v5.10.x-ti-unified https://git.beagleboard.org/beagleboard/BeagleBoard-DeviceTrees.git
cd ./BeagleBoard-DeviceTrees/
make
sudo make install_arm64

Then in /boot/firmware/extlinux/extlinux.conf

fdtoverlays /overlays/BBAI64-CSI0-imx219.dtbo

BUT… yeah it needs magic to use it… /dev/video2 is not giving me the data…

sudo ./init_script.sh 
CSI Camera 0 detected
    device = /dev/video2
    name = imx219 6-0010
    format = [fmt:SRGGB8_1X8/1920x1080]
    subdev_id = 2
    isp_required = yes

Regards,

Hi Robert,

Thanks for giving it a try last weekend.
Could you lead me in the right direction as to what the “magic” necessary would be?

I’m going to work on this more tomorrow… (and enable the 2nd channel…)

Regards,

1 Like

Nice, if you get anywhere and have progress to share I have two IMX219 modules here to test.

Best, Mat

Pushed… Commits · v5.10.x-ti-unified · BeagleBoard.org / BeagleBoard-DeviceTrees · GitLab

debian@BeagleBone:/opt/source/dtb-5.10-ti$ dmesg | grep imx
[    9.734750] imx219 4-0010: supply VANA not found, using dummy regulator
[    9.741556] imx219 4-0010: supply VDIG not found, using dummy regulator
[    9.748236] imx219 4-0010: supply VDDL not found, using dummy regulator
[    9.969642] imx219 6-0010: supply VANA not found, using dummy regulator
[    9.976433] imx219 6-0010: supply VDIG not found, using dummy regulator
[    9.983083] imx219 6-0010: supply VDDL not found, using dummy regulator
debian@BeagleBone:/opt/source/dtb-5.10-ti$ sudo /opt/edge_ai_apps/init_script.sh 
CSI Camera 0 detected
    device = /dev/video2
    name = imx219 6-0010
    format = [fmt:SRGGB8_1X8/1920x1080]
    subdev_id = 2
    isp_required = yes
CSI Camera 1 detected
    device = /dev/video18
    name = imx219 4-0010
    format = [fmt:SRGGB8_1X8/1920x1080]
    subdev_id = 5
    isp_required = yes
git clone -b v5.10.x-ti-unified https://git.beagleboard.org/beagleboard/BeagleBoard-DeviceTrees.git
cd ./BeagleBoard-DeviceTrees/
make
sudo make install_arm64
fdtoverlays /overlays/BBAI64-CSI0-imx219.dtbo /overlays/BBAI64-CSI1-imx219.dtbo

Regards,

3 Likes

Thanks, I connected my official RPi V2 NoIR camera to port CSI0 and it was detected via the edge ai init scripts after following your instructions.

I appreciate the quick turn around and effort, will be having fun with this over the weekend.

Mat

Quick follow-up as I’ve been trying to test some of the Edge AI apps and was wondering if you’ve been able to run one of the Python examples?

After running the init_script.sh the camera is seen although I see the following two messages before detecting my camera on CSI0:

  • line 120: ntpd: command not found
  • line 124: /usr/lib/python3.8/site-packages/dlr/counter/ccm_config.json: No Such file or directory

I then try to run one of the python examples from /opt/edge_ai_apps/apps_python:
sudo ./app_edgeai.py …/configs/rpiV2_cam_example.yaml

The error I’m getting is:
“Error - libdlr.so: cannot open shared object file: No such file or directory”

Are you able to get this example running? I just flashed my AI-64 w/ latest Nov 1st flasher w/ Edge AI apps. I also followed the AI-64 update procedure.

Best, Mat

Run:

sudo apt update
sudo apt upgrade

It should upgrade the ti-edgeai-apps-src-8.2 package.

Then,

sudo /opt/edge_ai_apps/init_script.sh

Will work…

Now beyond that… There still be dragon’s, and i haven’t got an image of the imx yet…

Regards,

That did the trick, I can run the Edge AI demos now although only the video/image sources seem to function.

I cannot get an image either through the IMX219 example although it kids now.

1 Like

I’ve been following this thread, but just wanted to pop in to say – I’m also interested in CSI camera support, and have one of these cameras.

Hi @RobertCNelson, i’m just checking in to find out if TI’s been able to shed light on the missing data stream from the IMX219?

Best, Mat

Hi.
Is IMX219 activation going on?

I have RPI camera V1.3 / V2.0 / V2.1 and connected the above camera to the CSI port.

The above procedure was carried out.

H/W Connected.
CSI0 - RPI Camera V2.0
CSI1 - RPI Camera V2.1

debian@BeagleBone:~$ sudo /opt/edge_ai_apps/init_script.sh 
[sudo] password for debian: 
CSI Camera 0 detected
    device = /dev/video2
    name = imx219 6-0010
    format = [fmt:SRGGB8_1X8/1920x1080]
    subdev_id = 2
    isp_required = yes
CSI Camera 1 detected
    device = /dev/video18
    name = imx219 4-0010
    format = [fmt:SRGGB8_1X8/1920x1080]
    subdev_id = 5
    isp_required = yes
debian@BeagleBone:~$ 

CSI0 - /dev/video2
CSI1 - /dev/video18

ebian@BeagleBone:~$ v4l2-ctl --list-devices
j721e-csi2rx (platform:4500000.ticsi2rx):
	/dev/video2
	/dev/video3
	/dev/video4
	/dev/video5
	/dev/video6
	/dev/video7
	/dev/video8
	/dev/video9
	/dev/video10
	/dev/video11
	/dev/video12
	/dev/video13
	/dev/video14
	/dev/video15
	/dev/video16
	/dev/video17
	/dev/media0

j721e-csi2rx (platform:4510000.ticsi2rx):
	/dev/video18
	/dev/video19
	/dev/video20
	/dev/video21
	/dev/video22
	/dev/video23
	/dev/video24
	/dev/video25
	/dev/video26
	/dev/video27
	/dev/video28
	/dev/video29
	/dev/video30
	/dev/video31
	/dev/video32
	/dev/video33
	/dev/media1

vxd-dec (platform:vxd-dec):
	/dev/video0

vxe-enc (platform:vxe-enc):
	/dev/video1

debian@BeagleBone:~$ 

I don’t know j721e-csi2rx.

We have proceeded so far, and EDGEAI has not been implemented with CSI0+IMX219(RPI camera) combinations.

1 Like

@RobertCNelson Been following this thread - any updates? Definitely a long awaited feature

@RobertCNelson Does the recent Bullseye release include support for these CSI cameras? And/or in general is there any progress? I see the 5.10.153-ti-arm64-r86 kernel tree (Commits · 5.10.153-ti-arm64-r86 · BeagleBoard.org / Linux · GitLab) has recent work on other CMOS chips.

Hey, I followed your steps, added the overlays and got similar response from dmesg | grep imx

[    9.606925] imx219 4-0010: supply VANA not found, using dummy regulator
[    9.735400] imx219 4-0010: supply VDIG not found, using dummy regulator
[    9.834726] imx219 4-0010: supply VDDL not found, using dummy regulator
[   10.034995] imx219 4-0010: failed to read chip id 219
[   10.239032] imx219: probe of 4-0010 failed with error -5
[   10.364886] imx219 6-0010: supply VANA not found, using dummy regulator
[   10.502978] imx219 6-0010: supply VDIG not found, using dummy regulator
[   11.041430] imx219 6-0010: supply VDDL not found, using dummy regulator
debian@BeagleBone:~$ sudo i2cdetect -y -r 6
     0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f
00:                         -- -- -- -- -- -- -- -- 
10: UU -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
70: -- -- -- -- -- -- -- -- 

And my init_script has couple of issues:

  1. It tries to edit files of python3.8/dlr but I have python3.9 from boot (commented it)
  2. The ntpd time setting didn’t work (I commented it)

Init scripts output:

debian@BeagleBone:/opt/edge_ai_apps$ sudo ./init_script.sh 
Unable to setup formats: Invalid argument (22)

I googled further and found that this might be an issue with yavta package, though no luck yet
My kernel is 5.10.90-ti-arm64-r28