Old Topic and New Issue/BeagleY-AI

The one I have plugs in, make sure the contacts are facing the ethernet jack. Also make sure it is fully seated and perpendicular to the board before pressing down on the lock. I have some other cameras around here and they had a different ribbon cable.

CAM_SUBDEV_NAME=/dev/v4l-imx219-subdev$count

It is plugged in properly and the command beagle-camera-setup does nothing so far. Can I figure out why? Nope. Not yet.

All I know, the command runs as a .server file and does nothing even when running properly (at least on my system).

And right about the lock: it does not flip open. The cap lifts and gets seated.

Seth

P.S. Troubleshooting next…

I hope you find the solution, worst case, I can do stills on the pi5 and send those home over wire for processing. It would have been nice to have live video to get the camera set up on the target object. Going to look at other boards, see if I can find one that will function out of the box. Actually need one like the BBBi but with more horsepower, video, dual PHY. BB are the only ones that have a load cape with 8 channels with SSR. That is perfect for running steppers.

All I found for pi is relays and those don’t work very well on the pulse train. Did find some discrete board level convertors with opto isolators and have those ordered. The load cape is a more professional looking install instead a rats nest of this and that.

1 Like

Yea,

I will keep testing. I am sure it is the simpler of things that is passing by me.

I noticed that the csi0 interface is located in a particular /dev/ file and not located on the bare /dev/video(N) interfaces.

I will try to build and see how far I get.

Seth

P.S. So, the command beagle-camera-setup does nothing on my system says output after the command. I see csi0 is located at i2c-5 in /dev/. So, I have tried the commands I listed previously and some other commands to test the file locations in /dev/, respectively.

I cannot figure out what I am missing. So, I will search for my hardware to attach to the debug port on the BeagleY-AI.

1 Like

That is not the purpose of buying this board! :laughing:

1 Like

Well, it does have a video accelerator. I mean, I get we call it an AI board, but is a good general-purpose media board as well.

I’d start with the information on the SDK, namely 3.7. Multimedia Video Codec.

Although the Debian image isn’t “the SDK”, the Linux kernel included should have all of the features of the SDK. The v4l2 support is in the kernel itself.

Here’s what I get on BeagleY-AI running Debian using one of the commands documented on the SDK page…

beagle@beagle:~$ v4l2-compliance -d0
v4l2-compliance 1.22.1, 64 bits, 64-bit time_t

Compliance test for uvcvideo device /dev/video0:

Driver Info:
        Driver name      : uvcvideo
        Card type        : C922 Pro Stream Webcam
        Bus info         : usb-xhci-hcd.5.auto-1.2
        Driver version   : 6.1.83
        Capabilities     : 0x84a00001
                Video Capture
                Metadata Capture
                Streaming
                Extended Pix Format
                Device Capabilities
        Device Caps      : 0x04200001
                Video Capture
                Streaming
                Extended Pix Format
Media Driver Info:
        Driver name      : uvcvideo
        Model            : C922 Pro Stream Webcam
        Serial           : 54E53C2F
        Bus info         : usb-xhci-hcd.5.auto-1.2
        Media version    : 6.1.83
        Hardware revision: 0x00000016 (22)
        Driver version   : 6.1.83
Interface Info:
        ID               : 0x03000002
        Type             : V4L Video
Entity Info:
        ID               : 0x00000001 (1)
        Name             : C922 Pro Stream Webcam
        Function         : V4L2 I/O
        Flags            : default
        Pad 0x01000007   : 0: Sink
          Link 0x0200001f: from remote pad 0x100000a of entity 'Processing 3' (Video Pixel Formatter): Data, Enabled, Immutable

Required ioctls:
        test MC information (see 'Media Driver Info' above): OK
        test VIDIOC_QUERYCAP: OK
        test invalid ioctls: OK

Allow for multiple opens:
        test second /dev/video0 open: OK
        test VIDIOC_QUERYCAP: OK
        test VIDIOC_G/S_PRIORITY: OK
        test for unlimited opens: OK

Debug ioctls:
        test VIDIOC_DBG_G/S_REGISTER: OK (Not Supported)
        test VIDIOC_LOG_STATUS: OK (Not Supported)

Input ioctls:
        test VIDIOC_G/S_TUNER/ENUM_FREQ_BANDS: OK (Not Supported)
        test VIDIOC_G/S_FREQUENCY: OK (Not Supported)
        test VIDIOC_S_HW_FREQ_SEEK: OK (Not Supported)
        test VIDIOC_ENUMAUDIO: OK (Not Supported)
        test VIDIOC_G/S/ENUMINPUT: OK
        test VIDIOC_G/S_AUDIO: OK (Not Supported)
        Inputs: 1 Audio Inputs: 0 Tuners: 0

Output ioctls:
        test VIDIOC_G/S_MODULATOR: OK (Not Supported)
        test VIDIOC_G/S_FREQUENCY: OK (Not Supported)
        test VIDIOC_ENUMAUDOUT: OK (Not Supported)
        test VIDIOC_G/S/ENUMOUTPUT: OK (Not Supported)
        test VIDIOC_G/S_AUDOUT: OK (Not Supported)
        Outputs: 0 Audio Outputs: 0 Modulators: 0

Input/Output configuration ioctls:
        test VIDIOC_ENUM/G/S/QUERY_STD: OK (Not Supported)
        test VIDIOC_ENUM/G/S/QUERY_DV_TIMINGS: OK (Not Supported)
        test VIDIOC_DV_TIMINGS_CAP: OK (Not Supported)
        test VIDIOC_G/S_EDID: OK (Not Supported)

Control ioctls (Input 0):
        test VIDIOC_QUERY_EXT_CTRL/QUERYMENU: OK
        test VIDIOC_QUERYCTRL: OK
                fail: v4l2-test-controls.cpp(489): s_ctrl returned an error (13)
        test VIDIOC_G/S_CTRL: FAIL
                fail: v4l2-test-controls.cpp(736): s_ext_ctrls returned an error (13)
        test VIDIOC_G/S/TRY_EXT_CTRLS: FAIL
        test VIDIOC_(UN)SUBSCRIBE_EVENT/DQEVENT: OK
        test VIDIOC_G/S_JPEGCOMP: OK (Not Supported)
        Standard Controls: 19 Private Controls: 0

Format ioctls (Input 0):
        test VIDIOC_ENUM_FMT/FRAMESIZES/FRAMEINTERVALS: OK
        test VIDIOC_G/S_PARM: OK
        test VIDIOC_G_FBUF: OK (Not Supported)
        test VIDIOC_G_FMT: OK
        test VIDIOC_TRY_FMT: OK
                warn: v4l2-test-formats.cpp(1036): Could not set fmt2
        test VIDIOC_S_FMT: OK
        test VIDIOC_G_SLICED_VBI_CAP: OK (Not Supported)
        test Cropping: OK (Not Supported)
        test Composing: OK (Not Supported)
        test Scaling: OK (Not Supported)

Codec ioctls (Input 0):
        test VIDIOC_(TRY_)ENCODER_CMD: OK (Not Supported)
        test VIDIOC_G_ENC_INDEX: OK (Not Supported)
        test VIDIOC_(TRY_)DECODER_CMD: OK (Not Supported)

Buffer ioctls (Input 0):
        test VIDIOC_REQBUFS/CREATE_BUFS/QUERYBUF: OK
        test VIDIOC_EXPBUF: OK
        test Requests: OK (Not Supported)

Total for uvcvideo device /dev/video0: 46, Succeeded: 44, Failed: 2, Warnings: 1
beagle@beagle:~$ cat /etc/dogtag 
BeagleBoard.org Debian Bookworm Xfce Image 2024-09-04
beagle@beagle:~$ 

Silly instructions! Not very generic. Won’t work if you have a USB camera plugged in. :wink:

I went through the other video devices and none of them were vpu-dec.

However, I did find a wave5 decode device…

beagle@beagle:/proc/device-tree$ v4l2-ctl --list-devices
e5010 (platform:e5010):
        /dev/video4

wave5-dec (platform:wave5-dec):
        /dev/video2

wave5-enc (platform:wave5-enc):
        /dev/video3

C922 Pro Stream Webcam (usb-xhci-hcd.5.auto-1.2):
        /dev/video0
        /dev/video1
        /dev/media0

beagle@beagle:/proc/device-tree$ v4l2-compliance -d2
v4l2-compliance 1.22.1, 64 bits, 64-bit time_t

Compliance test for wave5-dec device /dev/video2:

Driver Info:
        Driver name      : wave5-dec
        Card type        : wave5-dec
        Bus info         : platform:wave5-dec
        Driver version   : 6.1.83
        Capabilities     : 0x84204000
                Video Memory-to-Memory Multiplanar
                Streaming
                Extended Pix Format
                Device Capabilities
        Device Caps      : 0x04204000
                Video Memory-to-Memory Multiplanar
                Streaming
                Extended Pix Format
        Detected Stateful Decoder

Required ioctls:
        test VIDIOC_QUERYCAP: OK
        test invalid ioctls: OK

Allow for multiple opens:
        test second /dev/video2 open: OK
        test VIDIOC_QUERYCAP: OK
        test VIDIOC_G/S_PRIORITY: OK
        test for unlimited opens: OK

Debug ioctls:
        test VIDIOC_DBG_G/S_REGISTER: OK (Not Supported)
        test VIDIOC_LOG_STATUS: OK (Not Supported)

Input ioctls:
        test VIDIOC_G/S_TUNER/ENUM_FREQ_BANDS: OK (Not Supported)
        test VIDIOC_G/S_FREQUENCY: OK (Not Supported)
        test VIDIOC_S_HW_FREQ_SEEK: OK (Not Supported)
        test VIDIOC_ENUMAUDIO: OK (Not Supported)
        test VIDIOC_G/S/ENUMINPUT: OK (Not Supported)
        test VIDIOC_G/S_AUDIO: OK (Not Supported)
        Inputs: 0 Audio Inputs: 0 Tuners: 0

Output ioctls:
        test VIDIOC_G/S_MODULATOR: OK (Not Supported)
        test VIDIOC_G/S_FREQUENCY: OK (Not Supported)
        test VIDIOC_ENUMAUDOUT: OK (Not Supported)
        test VIDIOC_G/S/ENUMOUTPUT: OK (Not Supported)
        test VIDIOC_G/S_AUDOUT: OK (Not Supported)
        Outputs: 0 Audio Outputs: 0 Modulators: 0

Input/Output configuration ioctls:
        test VIDIOC_ENUM/G/S/QUERY_STD: OK (Not Supported)
        test VIDIOC_ENUM/G/S/QUERY_DV_TIMINGS: OK (Not Supported)
        test VIDIOC_DV_TIMINGS_CAP: OK (Not Supported)
        test VIDIOC_G/S_EDID: OK (Not Supported)

Control ioctls:
        test VIDIOC_QUERY_EXT_CTRL/QUERYMENU: OK
        test VIDIOC_QUERYCTRL: OK
        test VIDIOC_G/S_CTRL: OK
        test VIDIOC_G/S/TRY_EXT_CTRLS: OK
        test VIDIOC_(UN)SUBSCRIBE_EVENT/DQEVENT: OK
        test VIDIOC_G/S_JPEGCOMP: OK (Not Supported)
        Standard Controls: 2 Private Controls: 1

Format ioctls:
                fail: v4l2-test-formats.cpp(263): fmtdesc.description mismatch: was 'Y/UV 4:2:0', expected 'Y/CbCr 4:2:0'
        test VIDIOC_ENUM_FMT/FRAMESIZES/FRAMEINTERVALS: FAIL
        test VIDIOC_G/S_PARM: OK (Not Supported)
        test VIDIOC_G_FBUF: OK (Not Supported)
                fail: v4l2-test-formats.cpp(478): pixelformat 43564548 (HEVC) for buftype 10 not reported by ENUM_FMT
        test VIDIOC_G_FMT: FAIL
                fail: v4l2-test-formats.cpp(478): pixelformat 43564548 (HEVC) for buftype 10 not reported by ENUM_FMT
        test VIDIOC_TRY_FMT: FAIL
                fail: v4l2-test-formats.cpp(478): pixelformat 43564548 (HEVC) for buftype 10 not reported by ENUM_FMT
        test VIDIOC_S_FMT: FAIL
        test VIDIOC_G_SLICED_VBI_CAP: OK (Not Supported)
        test Cropping: OK (Not Supported)
        test Composing: OK
        test Scaling: OK (Not Supported)

Codec ioctls:
        test VIDIOC_(TRY_)ENCODER_CMD: OK (Not Supported)
        test VIDIOC_G_ENC_INDEX: OK (Not Supported)
                fail: v4l2-test-codecs.cpp(104): node->function != MEDIA_ENT_F_PROC_VIDEO_DECODER
        test VIDIOC_(TRY_)DECODER_CMD: FAIL

Buffer ioctls:
        test VIDIOC_REQBUFS/CREATE_BUFS/QUERYBUF: OK
        test VIDIOC_EXPBUF: OK
        test Requests: OK (Not Supported)

Total for wave5-dec device /dev/video2: 45, Succeeded: 40, Failed: 5, Warnings: 0
beagle@beagle:/proc/device-tree$ v4l2-ctl -d 2 -l

User Controls

  min_number_of_capture_buffers 0x00980927 (int)    : min=1 max=32 step=1 default=1 value=1 flags=read-only
                 thumbnail_mode 0x00981901 (bool)   : default=0 value=0 flags=write-only

That still doesn’t look like a good sign.

I think next step is to start comparing the device tree and kernel sources to see what has changed. Stay tuned.

Ugh. I hate that this is on a hijacked thread. :frowning:

Only thing I have been able to get running is libcamera on the PI5 board, that is their home grown code. Gstreamer and opencv have buffer issues. Did manage to get stills from opencv and the root cause for that was opencv needs an old version of numpy. Once that was fixed I got stills but not live.

pip install "numpy<1.22"

That might be helpful with the beagley, since that might hold for both platforms

This will give you still from a file.

import cv2 as cv
img = cv.imread("< your local image in jpg format>.JPG")

cv.imshow("Display window", img)
k = cv.waitKey(0) # Wait for a keystroke in the window

Here is how I feed libcamera into opencv, so maybe something similar to this. What was used to test the beagley’s live video?

import subprocess
import numpy as np
import cv2

# Camera settings
width = 640
height = 480
fps = 30
video_device = '/dev/shm/video.yuv'

# Start the libcamera-vid command
command = [
    'libcamera-vid', '-t', '0', '--width', str(width), '--height', str(height),
    '--framerate', str(fps), '--output', video_device
]
process = subprocess.Popen(command, stdout=subprocess.PIPE, stderr=subprocess.PIPE)

# Read the raw YUV frames and display
frame_size = width * height * 2  # YUYV422 format has 2 bytes per pixel
while True:
    # Read a frame from the libcamera-vid process
    raw_frame = process.stdout.read(frame_size)

    if len(raw_frame) != frame_size:
        print(f"Warning: Unexpected frame size. Expected {frame_size} bytes but got {len(raw_frame)} bytes.")
        continue

    # Convert the raw frame to a numpy array (YUYV422 -> BGR)
    frame = np.frombuffer(raw_frame, dtype=np.uint8).reshape((height, width, 2))
    frame_bgr = cv2.cvtColor(frame, cv2.COLOR_YUV2BGR_YUYV)

    # Display the frame
    cv2.imshow("Libcamera Video Feed", frame_bgr)

    # Wait for the user to press 'q' to exit
    if cv2.waitKey(1) & 0xFF == ord('q'):
        break

# Release the video capture and close windows
process.terminate()
cv2.destroyAllWindows()

Also, you will need to set this env var if you are running remote and make sure the local is set
and group membership in video

$export DISPLAY=:0

I did not make it that far yet! Thank you kind sir. I will start a new thread.

Seth

Re fan:
I connected a standard RPi5 fan (“Joy-it RB-heatsink5”) and it worked directly. No need for add’l overlay etc. Fan starts above approx. 40degC chip temp.

Re camera:
Have a IMX219 connected to CSI0 via FFC. Used overlay “k3-am67a-beagley-ai-csi0-imx219.dtbo” and can see raw bayer by pipelining gstreamer.

beagle-camera-setup
media-ctl -v -d 0 --set-v4l2 '"imx219 5-0010":0[fmt:SRGGB8_1X8/640x480]'

Run gstreamer from a console window on your xfce desktop (not via ssh):
gst-launch-1.0 v4l2src device=/dev/video-imx219-cam0 ! video/x-bayer, width=640, height=480, framerate=5/1, format=rggb ! bayer2rgb ! videoconvert ! video/x-raw, format=RGB, framerate=5/1 ! autovideosink

Of course, this returns a raw data video much too dark which needs to be ISP’d.
Hence, next challenge will be to get libcamera running on BBY-AI.

$uname -a

I know the camera here is working, it was just streaming on the PI5. Yet, it is dead on Beagley. Mine is not even responding to i2c.?

debian@BeagleBone:~$ uname -a
Linux BeagleBone 6.1.83-ti-arm64-r64 #1bookworm SMP PREEMPT_DYNAMIC Fri Sep  6 21:31:20 UTC 2024 aarch64 GNU/Linux

Check your I2C:

debian@BeagleBone:~$ i2cdetect -y -r 5
     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: -- -- -- -- -- -- -- --

If your cam is not showing up with adress 0x10 then doublecheck your physical CSI connection. Correct adapter cable 22pin → 15pin ?

Its the same as the pi5.

(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             :

Hello Friend,
How do you tune the board so that the fan starts at chip temperature 50C?

re cam: please check your I2C with i2cdetect -y -r 5

re fan: did not tune anything. I am happy it cools as it does.

(bby2-venv) fred@bby2:~$ i2cdetect -y -r 5
     0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f
00:                         -- -- -- -- -- -- -- -- 
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
70: -- -- -- -- -- -- -- --                         
(bby2-venv) fred@bby2:~$ 

As you can see there is no I2C communication. There should be a UU at 0x10 ! Either sth is wrong with your device tree overlay or your CSI connector is bad.
Check demo&tutorials for BY-AI.

This board was flaky from day one, tried to return it to Digi-key and they refused. It only boots on one type of SD card, the screen was some odd color and something else was flaky. I have another board that has been working fine let me try that one and see what happens. I will just swap SD cards so everything except the board will be the same,.

(bby2-venv) 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

Where did you find r64, this came from imager a couple days ago and its r63.

r64 through sudo apt update, but I guess that‘s less your issue.

Make sure you are booting the correct (!) overlay for csi0 and i2c-5:
k3-am67a-beagley-ai-csi0-imx219.dtbo

I did not see the i2c overlay, both of the imx overlays are loaded. When I get back to my other office I will check that out, thank you.

1 Like