BeagleY-AI and Testing CSI0 and CSI1 via Formatting and/or Commands via uvcvideo driver for Linux

Hello,

This is a roundabout way to handle a previous thread with umpteen data about randomness. This post is mostly going to be geared towards video and media on the BeagleY-AI along with Linux drivers and hopefully some CSI2 ports!

Here is the old thread with some data:

Seth

P.S. This will be an update to that thread hopefully and with wishful thinking, just maybe, maybe we can get the BeagleY-AI floating some nifty video views…

1 Like

@jkridner

fred@bby2:~$ sudo i2cget -y 1 0x10
[sudo] password for fred: 
Error: Read failed
fred@bby2:~$ 

The overlay looks fine.

Are you sure the wiring on the board is correct. I have no way to probe this. At bare minimum it should be talking to the cam on i2c. Both cs0 and cs1 overlays are loaded and I have tried both ports.

&main_i2c0 {
	status = "okay";
	pinctrl-names = "default";
	pinctrl-0 = <&main_i2c0_pins_default>;
	clock-frequency = <400000>;

	#address-cells = <1>;
	#size-cells = <0>;

	imx219_1: sensor@10 {
		compatible = "sony,imx219";
		reg = <0x10>;

		clocks = <&clk_csi1_imx219_fixed>;
		clock-names = "xclk";

		pinctrl-names = "default";
		pinctrl-0 = <&csi1_gpio_pins_default>;

		reset-gpios = <&main_gpio1 24 GPIO_ACTIVE_HIGH>;

		port {
			csi2_cam1: endpoint {
				remote-endpoint = <&csi2rx1_in_sensor>;
				link-frequencies = /bits/ 64 <456000000>;
				clock-lanes = <0>;
				data-lanes = <1 2>;
			};
		};
	};
};
fred@bby2:~$ uname -a
Linux bby2 6.1.83-ti-arm64-r63 #1bookworm SMP PREEMPT_DYNAMIC Wed Jul 10 23:00:56 UTC 2024 aarch64 GNU/Linux
fred@bby2:~$ 

Out of the box.

This looks a little funky, is the Ti power config correct.

fred@bby2:~$ dmesg | grep imx219
[    7.949288] imx219 3-0010: supply VANA not found, using dummy regulator
[    7.950701] imx219 3-0010: supply VDIG not found, using dummy regulator
[    7.950817] imx219 3-0010: supply VDDL not found, using dummy regulator
[    8.021812] imx219 5-0010: supply VANA not found, using dummy regulator
[    8.092236] imx219 5-0010: supply VDIG not found, using dummy regulator
[    8.092419] imx219 5-0010: supply VDDL not found, using dummy regulator
[    8.123769] imx219 5-0010: failed to read chip id 219
[    8.130050] imx219: probe of 5-0010 failed with error -5
[   11.789847] imx219 3-0010: Consider updating driver imx219 to match on endpoints
[   14.149141] Modules linked in: cc33xx mac80211 rpmsg_ctrl rpmsg_char virtio_rpmsg_bus rpmsg_ns libarc4 cdns_csi2rx joydev crct10dif_ce cc33xx_sdio snd_soc_simple_card snd_soc_simple_card_utils cpufreq_dt pvrsrvkm(O) pwm_fan at24 e5010_jpeg_enc rti_wdt algif_aead ti_k3_r5_remoteproc snd_soc_davinci_mcasp snd_soc_ti_udma snd_soc_ti_edma snd_soc_hdmi_codec btti_uart snd_soc_ti_sdma wave5 snd_soc_core bluetooth ti_k3_dsp_remoteproc j721e_csi2rx ti_k3_common videobuf2_dma_contig v4l2_mem2mem videobuf2_memops videobuf2_v4l2 snd_pcm_dmaengine snd_pcm videobuf2_common imx219 v4l2_fwnode v4l2_async cdns_dphy_rx videodev mc snd_timer snd cfg80211 uio_pdrv_genirq uio dm_mod loop efi_pstore
[   14.150635] Modules linked in: cc33xx mac80211 rpmsg_ctrl rpmsg_char virtio_rpmsg_bus rpmsg_ns libarc4 cdns_csi2rx joydev crct10dif_ce cc33xx_sdio snd_soc_simple_card snd_soc_simple_card_utils cpufreq_dt pvrsrvkm(O) pwm_fan at24 e5010_jpeg_enc rti_wdt algif_aead ti_k3_r5_remoteproc snd_soc_davinci_mcasp snd_soc_ti_udma snd_soc_ti_edma snd_soc_hdmi_codec btti_uart snd_soc_ti_sdma wave5 snd_soc_core bluetooth ti_k3_dsp_remoteproc j721e_csi2rx ti_k3_common videobuf2_dma_contig v4l2_mem2mem videobuf2_memops videobuf2_v4l2 snd_pcm_dmaengine snd_pcm videobuf2_common imx219 v4l2_fwnode v4l2_async cdns_dphy_rx videodev mc snd_timer snd cfg80211 uio_pdrv_genirq uio dm_mod loop efi_pstore
fred@bby2:~$ 

1 Like

Maybe Wifi is in the way and PRUs or whatever DSP types are used on the processor die.

Seth

P.S. cc33xx is the wifi signal from beagleboard.org I think.

How do I shut that off, we don’t need it any way.

1 Like

Do not use it. You have to…oh. Good question. I think I am out now. I am sure there are /lib/ files and /etc/ files alike.

Seth

fred@bby2:~$ modinfo cc33xx
filename:       /lib/modules/6.1.83-ti-arm64-r63/kernel/drivers/net/wireless/ti/cc33xx/cc33xx.ko.xz
firmware:       ti-connectivity/cc33xx_fw.bin
firmware:       ti-connectivity/cc33xx_2nd_loader.bin
author:         Juuso Oikarinen <juuso.oikarinen@nokia.com>
author:         Luciano Coelho <coelho@ti.com>
license:        GPL v2
alias:          platform:cc33xx
depends:        mac80211,cfg80211
intree:         Y
name:           cc33xx
vermagic:       6.1.83-ti-arm64-r63 SMP preempt mod_unload modversions aarch64
parm:           debug_level:cc33xx debugging level (uint)
parm:           secure_boot_enable:Enables secure boot and FW downlaod
parm:           fwlog:FW logger options: continuous, dbgpins or disable (charp)
parm:           no_recovery:Prevent HW recovery. FW will remain stuck. (int)
parm:           ht_mode:Force HT mode: wide or siso20 (charp)
fred@bby2:~$ 

sudo rmmod cc33xx_sdio

Hmm.

It is in the tree says that intree: Y arg. I bet you cannot boot now.

Seth

P.S. I have not tried what you just did. parm is parameter probably and that means no recovery or the firmware will remain. Have you made your own kernel yet?

It should boot the rmmod is session only. I did not blacklist.

So far i2c did not come up with that unloaded, that would be the starting point. The power issue is a little troubling too. I will look at the new BSP and if its cleaned up and if I can figure out what is going on I will look at this some more.

I think kernel 5.1.x was when the BeagleY-AI was booting into CSI2 portages. Primarily a guess there…

And A-Okay, I can wait as usual while I build supplies of source to run. I was unaware that cc33xx was loaded as firmware instead of the kernel driver. I was reviewing the kernel drivers…

There were some interesting things and some not-so-interesting files. I did a fresh make clean on a built kernel. So, I am back to square one.

Seth

Hey…


https://lwn.net/Articles/977712/


Where can I find that version, the 6.x and 6.11+ rt is problematic on the imx8 so I am still using the 5.1x on that stuff.

1 Like

kernel.org or ti.com either/or…

Sorry for the vague reply. I think the link changed somehow and I got lost in rotation or I made an error on my end with that guess.

I meant the entire image running on that kernel version. Swapping out kernels is massive headache and plenty of surprises. This was installed from imager. Some place RCN has a devicetree and kernel info and I keep losing its location.

1 Like

https://software-dl.ti.com/jacinto7/esd/processor-sdk-linux-am67a/09_02_00/exports/docs/linux/Foundational_Components_Multimedia_wave5.html?highlight=video

That is what was posted earlier in another conversation. It is not easy and yes…

  1. Resources
  2. Time
  3. Error(s) * infinity

Seth

P.S. I do not know RCN well enough to bother him about building for me alone…

@foxsquirrel ,

I am out for now…see you another day!

Seth

1 Like

This is 10.0 sdk
https://software-dl.ti.com/jacinto7/esd/processor-sdk-linux-am67a/10_00_00/exports/docs/linux/Foundational_Components_Multimedia_wave5.html

(bby2-venv) fred@bby2:~$ v4l2-ctl -d /dev/video-imx219-cam0 --all
Driver Info:
        Driver name      : j721e-csi2rx
        Card type        : j721e-csi2rx
        Bus info         : platform:30122000.ticsi2rx
        Driver version   : 6.1.83
        Capabilities     : 0xa4200001
                Video Capture
                Streaming
                Extended Pix Format
                Device Capabilities
        Device Caps      : 0x24200001
                Video Capture
                Streaming
                Extended Pix Format
Media Driver Info:
        Driver name      : j721e-csi2rx
        Model            : TI-CSI2RX
        Serial           : 
        Bus info         : platform:30122000.ticsi2rx
        Media version    : 6.1.83
        Hardware revision: 0x00000001 (1)
        Driver version   : 6.1.83
Interface Info:
        ID               : 0x03000015
        Type             : V4L Video
Entity Info:
        ID               : 0x00000013 (19)
        Name             : 30122000.ticsi2rx context 0
        Function         : V4L2 I/O
        Pad 0x01000014   : 0: Sink
          Link 0x02000017: from remote pad 0x1000003 of entity '30122000.ticsi2rx' (Video Interface Bridge): Data, Enabled, Immutable
Priority: 2
Video input : 0 (30122000.ticsi2rx context 0: ok)
Format Video Capture:
        Width/Height      : 640/480
        Pixel Format      : 'YUYV' (YUYV 4:2:2)
        Field             : None
        Bytes per Line    : 1280
        Size Image        : 614400
        Colorspace        : sRGB
        Transfer Function : Default (maps to sRGB)
        YCbCr/HSV Encoding: Default (maps to ITU-R 601)
        Quantization      : Default (maps to Limited Range)
        Flags             : 

/linux/arch/arm64/boot/dts/ti shows some ideas about the j722s processor.

TI has not listed a bunch available but that is only DTS. So, maybe configuring the build env. will provide some more ideas.

My ideas are these:

a. Right now, I am not sure the k3-j722s is the type.
b. If we were to build a kernel listed under openbeagle.org from their Linux clone, we would need to alter many files.
c. What files should we alter?

Letter c. is an issue in itself. We may need to go into the kernel before building to alter the DTS and add/subtract specifics in specified DTS files.

If the am67a is the j721e, then I will need to build around that particular DTS that is available.

I will be willing to build a Linux kernel for this specified processor but not for the video capture instances. There is a lot to video processing that eludes me so far.

Seth

P.S. For instance, does the CSI2 ports need HDMI output or do the CSI2 ports need OLDI for outputting the video feed? I do not know as of now. I mean…I was just testing with a server and porting the feed to the local server.

The device tree is missing nodes for

[    7.588608] imx219 3-0010: supply VANA not found, using dummy regulator
[    7.588929] imx219 3-0010: supply VDIG not found, using dummy regulator
[    7.589031] imx219 3-0010: supply VDDL not found, using dummy regulator
[    7.629897] imx219 5-0010: supply VANA not found, using dummy regulator
[    7.637269] imx219 5-0010: supply VDIG not found, using dummy regulator
[    7.639071] imx219 5-0010: supply VDDL not found, using dummy regulator
[    7.699911] imx219 5-0010: failed to read chip id 219
[    7.712483] imx219: probe of 5-0010 failed with error -5
[   10.939848] imx219 3-0010: Consider updating driver imx219 to match on endpoints

// SPDX-License-Identifier: GPL-2.0
/*
 * DT Overlay for RPi Camera V2.1 on CSI0 J722S BeagleY-AI board.
 *
 * Copyright (C) 2023 Texas Instruments Incorporated - https://www.ti.com/
 *
 * Schematics: https://datasheets.raspberrypi.com/camera/camera-v2-schematics.pdf
 */

/dts-v1/;
/plugin/;

#include <dt-bindings/gpio/gpio.h>

/*
 * Helper to show loaded overlays under: /proc/device-tree/chosen/overlays/
 */
&{/chosen} {
	overlays {
		k3-am67a-beagley-ai-csi0-imx219.kernel = __TIMESTAMP__;
	};
};

&{/} {
	clk_csi0_imx219_fixed: csi0-imx219-xclk {
		compatible = "fixed-clock";
		#clock-cells = <0>;
		clock-frequency = <24000000>;
	};
};

&mcu_gpio0 {
    status = "okay";
};

&main_i2c2 {
	status = "okay";
	pinctrl-names = "default";
	pinctrl-0 = <&main_i2c2_pins_default>;
	clock-frequency = <400000>;

	#address-cells = <1>;
	#size-cells = <0>;

	imx219_0: sensor@10 {
		compatible = "sony,imx219";
		reg = <0x10>;

		clocks = <&clk_csi0_imx219_fixed>;
		clock-names = "xclk";

		pinctrl-names = "default";
		pinctrl-0 = <&csi0_gpio_pins_default>;

		reset-gpios = <&mcu_gpio0 15 GPIO_ACTIVE_HIGH>;

		port {
			csi2_cam0: endpoint {
				remote-endpoint = <&csi2rx0_in_sensor>;
				link-frequencies = /bits/ 64 <456000000>;
				clock-lanes = <0>;
				data-lanes = <1 2>;
			};
		};
	};
};

&cdns_csi2rx0 {
	ports {
		#address-cells = <1>;
		#size-cells = <0>;

		csi0_port0: port@0 {
			reg = <0>;
			status = "okay";

			csi2rx0_in_sensor: endpoint {
				remote-endpoint = <&csi2_cam0>;
				bus-type = <4>; /* CSI2 DPHY */
				clock-lanes = <0>;
				data-lanes = <1 2>;
			};
		};
	};
};

&ti_csi2rx0 {
	status = "okay";
};

&dphy0 {
	status = "okay";
};

Does it need just dummy placeholders or actual nodes??

You have to run the beagle script as sudo because it creates links.

Both of these are moot, since I only have 1 camera connected

    7.699911] imx219 5-0010: failed to read chip id 219
[    7.712483] imx219: probe of 5-0010 failed with error -5


So it must be detecting it properly on 3 or it would throw an error.

That was one of the issues I ran into a few months back when building the overlay for the 8 channel relay board. What is it???

1 Like

The kernel module is already in place so rebuild of the kernel might not do much.

(bby2-venv) fred@bby2:~$ zcat /proc/config.gz | grep CONFIG_VIDEO_IMX219
CONFIG_VIDEO_IMX219=m

What is loaded is j721e stuff

(bby2-venv) fred@bby2:~$ lsmod | grep imx219
imx219                 20480  1
v4l2_fwnode            24576  2 imx219,cdns_csi2rx
v4l2_async             24576  4 v4l2_fwnode,j721e_csi2rx,imx219,cdns_csi2rx
videodev              237568  9 v4l2_async,j721e_csi2rx,imx219,videobuf2_v4l2,cdns_csi2rx,videobuf2_common,v4l2_mem2mem,e5010_jpeg_enc,wave5
mc                     57344  8 v4l2_async,videodev,j721e_csi2rx,imx219,videobuf2_v4l2,cdns_csi2rx,videobuf2_common,v4l2_mem2mem

Just found this…

1 Like