Skip to content

TechNexion-Vision/ti_evk_camera

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

TI TDA4VM Camera Driver

TEVS_Banner

Producer: TechNexion License: GPL v2

Overview

Driver has been developed by TechNexion as an initiative in order to bootup TechNexion MIPI-CSI2 camera modules on Ti starter kit.

Prerequisites

  1. Supported Ti Developer Kit

  2. Adapter board + Cable

    With different board you need prepare match adapter board and cable for the connect pins.
    Here is the table for you can easily to confirm what you need for your solution.

    Developer Kit Adapter board Camera Kit
    SK-AM62 TEV-RPI15 Adaptor TechNexion Camera EVK RPI15
    SK-AM62A-LP TEV-RPI22 Adaptor TechNexion Camera EVK RPI22
    SK-TDA4VM TEV-RPI15 Adaptor TechNexion Camera EVK RPI15

    Be careful with the RPI22 adaptor board connector, which is compatible with the reverse orientation pin define.
    Watch this video to make sure your camera is connected correctly :
    Watch the video
    Fig. 1.1 The TEV-RPI22 adaptor connection with SK-AM62A-LP Starter Kit.

    The SK-TDA4VM board provides 2 RPi headers for camera connection.

    Fig. 1.2 The TEV-RPI15 adaptor connection with SK-TDA4VM Starter Kit for Edge AI.

  3. Yocto Pre-built image

    The release driver have been verified with those ti-processor-sdk-linux version:

Note

If you don't have any specific driver need, you can using TechNexion Pre-built Image
Skip step of driver install and start to using camera quickly !

  1. Micro-SD Card

    The capacity must be higher 16GB and then flash the image.
    sudo dd of=/dev/<sd card> if=<Yocto prebuild image> bs=1M status=progress

Driver Installation Instructions

  1. Download the camera driver and device tree blobs.

    $ git clone git@github.com:TechNexion-Vision/tn-ti_6.1.46_09.01.00.006.git
    $ cd ti_evk_camera/
    ~/ti_evk_camera$ git checkout tn-ti_6.1.46_09.01.00.006
  2. Copy to your kernel source code.

    ~/ti_evk_camera$ mv -r driver/media/i2c/tevs/ <fetch_kernel_folder>/driver/media/i2c/
    ~/ti_evk_camera$ mv arch/arm64/boot/dts/ti/k3-j721e-sk-tevs.dtso <fetch_kernel_folder>/arch/arm64/boot/dts/ti/
  3. Modify makefile to add driver

    $ cd <fetch_kernel_folder>/driver/media/i2c/
    ~/<fetch_kernel_folder>/driver/media/i2c/$ vi Makefile

    Add this line in Makefile.

    obj-$(CONFIG_VIDEO_TEVS) += tevs/

    Modify Kconfig to add camera config

    ~/<fetch_kernel_folder>/driver/media/i2c/$ vi Kconfig

    Add this part under "Camera sensor devices" menu in Kconfig.

    config VIDEO_TEVS
      tristate "TechNexion TEVS sensor support"
      depends on OF
      depends on GPIOLIB && VIDEO_V4L2 && I2C && VIDEO_V4L2_SUBDEV_API
      depends on MEDIA_CAMERA_SUPPORT
      default y
      select V4L2_FWNODE
      help
        This is a Video4Linux2 sensor driver for the TechNexion
        TEVS camera sensor with a MIPI CSI-2 interface.
    
  4. Modify makefile to add device tree.

    $ cd <fetch_kernel_folder>/arch/arm64/boot/dts/ti/
    ~/<fetch_kernel_folder>/arch/arm64/boot/dts/ti/$ vi Makefile

    Add this line in Makefile.

    #For SK-AM62X
    dtb-$(CONFIG_ARCH_K3) += k3-am625-sk-csi2-tevs.dtbo
    #For SK-AM62A
    dtb-$(CONFIG_ARCH_K3) += k3-am62a7-sk-csi2-tevs.dtbo
    #For SK-TDA4VM
    dtb-$(CONFIG_ARCH_K3) += k3-j721e-sk-tevs.dtbo
    
  5. Compile the kernel & module driver

    Finally you can start compile your new Image files, then copy and replace the Image files and add camera dtb overlay file in the SD card.

Note

You need specifying the SD card image of dtb overlay file in /run/media/BOOT-mmcblk1p1/uEnv.txt as below,

#For SK-AM62X
  name_overlays= k3-am625-sk-csi2-tevs.dtbo
#For SK-AM62A
  name_overlays= k3-am62a7-sk-csi2-tevs.dtbo
#For SK-TDA4VM
  name_overlays=ti/k3-j721e-edgeai-apps.dtbo ti/k3-j721e-sk-tevs.dtbo

Instructions for Testing Camera

  1. Connect debug console cable to SK-TDA4VM.

  2. Power on the board :

    The display will shown a Ti demo application(Edge AI demo) wallpaper as below.

    Fig. 1.3 SK-TDA4VM Starter Kit wallpaper upon boot

Note

The Ti demo application doesn't include TechNexion's cameras. You can stop and disable this by using systemctl stop edgeai-init.service and systemctl disable edgeai-init.service.
You won't see it the next time reboot.

  1. Checking whether camera have been link via v4l2 control command :

    $ v4l2-ctl --list-device

    Get the device number of camera capture device

    #CSI 0 (cam1)
    j721e-csi2rx (platform:4504000.ticsi2rx):
    /dev/video{X}

    #CSI 1 (cam2)
    j721e-csi2rx (platform:4510000.ticsi2rx):
    /dev/video{X}

    The following is an example.


  2. Get video stream on the display :

    Specify the capture device you just get (/dev/video2) and start gstreamer to get video stream with 640x480 on the display :

    $ gst-launch-1.0 v4l2src device=/dev/video2 io-mode=2 ! video/x-raw,width=640,height=480 ! waylandsink sync=false

Troubleshooting

Note

Usecase
Take TEVS-AR0234 on SK-TDA4VM CAM2 connector for example:

Find out the Camera


Boot up SK-TDA4VM and check initialization of camera driver.
It shows below messages, the driver is initialized correctly. If the drivers haven't been probed, please check the connector plugin correct.

$ dmesg -t | grep "tevs"

The message similar to the following :

root@tda4vm-sk:/opt/edgeai-gst-apps# dmesg|grep tevs
tevs 7-0048: tevs_probe() device node: tevs@48
tevs 7-0048: Version:24.8.0.1
tevs 7-0048: Product:TEVS-AR0234, HeaderVer:3, MIPI_Rate:800
tevs 7-0048: probe success

Try to using media-ctl framework to print the device topology from camera to CSI and the end to video device node.

$ media-ctl -d /dev/media1 -p

Get the v4l2-subdev which is camera in this print message and then we can use v4l2-ctl by it.


Change Resolution

  1. Check camera supported resolutions via v4l2-ctl

    For kernel 6.1 architecture you cannot easily change resolution in gsteamer pipeline. You must need to using v4l2-ctl to do this.

    $ v4l2-ctl -d /dev/v4l-subdev2 --list-subdev-framesize pad=0

    root@tda4vm-sk:/opt/edgeai-gst-apps# v4l2-ctl -d /dev/v4l-subdev2 --list-subdev-framesize pad=0
    ioctl: VIDIOC_SUBDEV_ENUM_FRAME_SIZE (pad=0,stream=0)
    Size Range: 640x480 - 640x480
    Size Range: 1280x720 - 1280x720
    Size Range: 1920x1080 - 1920x1080
    Size Range: 1920x1200 - 1920x1200

  2. Set Format

     media-ctl --set-v4l2 "'tevs 7-0048':0 [fmt:UYVY8_2X8/1280X720@1/30 field:none]"



About

TechNexion camera drivers for TI Start Kit EVK

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published