AM62A7: enable csi-2 sensor

Part Number: AM62A7

Tool/software:

Dear TI community
i'm referring to latest am62a linux SDK documentation here
dev.ti.com/.../dev-use-camera.html

can someone please help with with step 6

should it be dtb-$(CONFIG_ARCH_K3) += <device_tree_overlay_name>.dtso as mentioned in documentation, 
or dtb-$(CONFIG_ARCH_K3) += <device_tree_overlay_name>.dtbo
  • Another question
    followed same guide, built the kernel, loaded on sd card using 

    sudo DESTDIR=/media/$USER/rootfs2 make linux_install

    ov5647.ko isn't auto loaded, 
    tried 
    root@am62axx-evm:/usr/lib/modules/6.12.35-g72f48d59b8f0-dirty/kernel/drivers/media/i2c# insmod ov5647.ko
    and got these errors

    [ 166.121794] ov5647: Unknown symbol v4l2_async_unregister_subdev (err -2)
    [ 166.128746] ov5647: Unknown symbol __v4l2_async_register_subdev (err -2)
    [ 166.135553] ov5647: Unknown symbol v4l2_fwnode_endpoint_parse (err -2)
    insmod: ERROR: could not insert module ov5647.ko: Unknown symbol in module

  • after adding overlay in uEnv.txt
    sensor kernel module is being loaded on boot up, but getting these error messages
    [ 7.416799] virtio_rpmsg_bus virtio1: creating channel rpmsg_chrdev addr 0xd
    [ 7.431059] ov5647 4-0036: write sensor_oe_enable_regs error
    [ 7.432289] rproc-virtio rproc-virtio.8.auto: registered virtio1 (type 7)
    [ 7.437580] ov5647 4-0036: probe with driver ov5647 failed with error -121
    [ 7.443694] remoteproc remoteproc2: remote processor 78000000.r5f is now attached

  • documentation is quite scattered,. need to view forums for many issues, anyhow, this issue is resolved, had to make few changes in dtso and after that, driver loaded just fine,
    I'm facing few other issues, will create new thread. 

  • Hi Farrukh,

    1. Do step 4 as CONFIG_VIDEO_<SENSOR_NAME>=y     Then try sudo DESTDIR=/media/$USER/rootfs2 make linux_install. 

    ov5647.ko will get auto load.

    2. Modify step 6 as 

    dtb-$(CONFIG_ARCH_K3) += <device_tree_overlay_name>.dtbo


    Also please reach out if any other queries.

    Regards,

    Dilna K
  • Thanks  
    everything looks good now, I've captured raw BGGR10 frames using 

    yavta -c -Fcapture -s 640x480 -f SBGGR10 /dev/video3 -c20

    Using basic python script, I've unpacked and converted frames to png, pictures look more greenish, but it verifies that driver/sensor is functional, 


    https://dev.ti.com/tirex/explore/content/am62ax_academy_10_01_00_00/_build_am62ax_academy_10_01_00_00/source/linux/ch-develop/dev-use-camera.html#configure-camera-parameters
    Referring to last step here, I'm unable to locate ov5647 directory under opt/imaging, can you please help with this step, i want to capture video like this

    gst-launch-1.0 -v v4l2src device=/dev/video3
  • Hi Farrukh,

    By default ov5647 directory is not under opt/imaging you have to generate it. for this could you please refer the below thread

    Link:- https://e2e.ti.com/support/processors-group/processors/f/processors-forum/1226793/sk-am62a-lp-configuring-a-new-csi-2-image-sensor-to-use-isp-vpac-functionality

    Regards,

    Dilna k

  • Just to get started, I copied this directory from another thread on the forum, and updated both tiovx_sensor_module and gsttiovxisp, but when i execute
    gst-inspect-1.0 tiovxisp
    getting these errors

    ERROR:../gst-libs/gst/tiovx/gsttiovxcontext.c:146:gst_tiovx_cont[ 28.528110] audit: type=1701 audit(1757394109.429:26): auid=4294967295 uid=0 gid=0 ses=4294967295 subj=kernel pid=1607 comm="gst-inspect-1.0" exe="/usr/bin/gst-inspect-1.0" sig=6 res=1
    ext_init: assertion failed: (0 == ret)
    [ 28.555907] audit: type=1334 audit(1757394109.457:27): prog-id=23 op=LOAD

    1861.950002 s: APP_LOG: ERROR: Unable to map memory @ 0xa1000[ 28.568195] audit: type=1334 audit(1757394109.469:28): prog-id=24 op=LOAD
    000 of size 262144 bytes !!!
    APP: ERROR: Log writer init fai[ 28.580512] audit: type=1334 audit(1757394109.481:29): prog-id=25 op=LOAD
    led !!!
    APP_LOG: ERROR: Unable to map memory @ 0xa2000000 of size 3288576 bytes !!!
    APP: ERROR: File IO writer init failed !!!
    APP: Init ... Done !!!
    Bail out! ERROR:../gst-libs/gst/tiovx/gsttiovxcontext.c:146:gst_tiovx_context_init: assertion failed: (0 == ret)
    Aborted (core dumped)
    root@am62axx-evm:/opt/edgeai-gst-apps# [ 29.555037] audit: type=1334 audit(1757394110.457:30): prog-id=25 op=UNLOAD
    [ 29.562043] audit: type=1334 audit(1757394110.457:31): prog-id=24 op=UNLOAD
    [ 29.569012] audit: type=1334 audit(1757394110.457:32): prog-id=23 op=UNLOAD


     

  • Unable to find tool to generate bin files for imaging, may i get some help on this please? thank you

  • Thanks   it solved the memory problem, 

    gst-launch-1.0 -v v4l2src device=/dev/video3 io-mode=dmabuf-import ! \
    > video/x-bayer, width=640, height=480, framerate=30/1, format=bggr10 ! \
    > tiovxisp sink_0::device=/dev/v4l-subdev2 sensor-name="SENSOR_ONSEMI_OV5647" \
    > dcc-isp-file=/opt/imaging/SENSOR_ONSEMI_OV5647/linear/dcc_viss.bin sink_0::dcc-2a-file=/opt/imaging/SENSOR_ONSEMI_OV5647/linear/dcc_2a.bin format-msb=9 ! \
    > video/x-raw, format=NV12, width=640, height=480, framerate=30/1 ! kmssink driver-name=tidss
    
    APP: Init ... !!!
    4007.669070 s: MEM: Init ... !!!
    4007.669134 s: MEM: Initialized DMA HEAP (fd=8) !!!
    4007.669289 s: MEM: Init ... Done !!!
    4007.669304 s: IPC: Init ... !!!
    4007.687724 s: IPC: Init ... Done !!!
    REMOTE_SERVICE: Init ... !!!
    REMOTE_SERVICE: Init ... Done !!!
    4007.692215 s: GTC Frequency = 200 MHz
    APP: Init ... Done !!!
    4007.692372 s: VX_ZONE_INFO: Globally Enabled VX_ZONE_ERROR
    4007.692397 s: VX_ZONE_INFO: Globally Enabled VX_ZONE_WARNING
    4007.692444 s: VX_ZONE_INFO: Globally Enabled VX_ZONE_INFO
    4007.693212 s: VX_ZONE_INFO: [tivxPlatformCreateTargetId:169] Added target MPU-0
    4007.693542 s: VX_ZONE_INFO: [tivxPlatformCreateTargetId:169] Added target MPU-1
    4007.693817 s: VX_ZONE_INFO: [tivxPlatformCreateTargetId:169] Added target MPU-2
    4007.694078 s: VX_ZONE_INFO: [tivxPlatformCreateTargetId:169] Added target MPU-3
    4007.694106 s: VX_ZONE_INFO: [tivxInitLocal:202] Initialization Done !!!
    4007.694116 s: VX_ZONE_INFO: Globally Disabled VX_ZONE_INFO
    Setting pipeline to PAUSED ...
    Pipeline is live and does not need PREROLL ...
    /GstPipeline:pipeline0/GstKMSSink:kmssink0: display-width = 1920
    /GstPipeline:pipeline0/GstKMSSink:kmssink0: display-height = 1080
    Pipeline is PREROLLED ...
    Setting pipeline to PLAYING ...
    /GstPipeline:pipeline0/GstV4l2Src:v4l2src0.GstPad:src: caps = video/x-bayer, width=(int)640, height=(int)480, framerate=(fraction)30/1, format=(string)bggr10, interlace-mode=(string)progressive
    New clock: GstSystemClock
    /GstPipeline:pipeline0/GstCapsFilter:capsfilter0.GstPad:src: caps = video/x-bayer, width=(int)640, height=(int)480, framerate=(fraction)30/1, format=(string)bggr10, interlace-mode=(string)progressive
    /GstPipeline:pipeline0/GstTIOVXISP:tiovxisp0.GstTIOVXIspPad:sink_0: caps = video/x-bayer, width=(int)640, height=(int)480, framerate=(fraction)30/1, format=(string)bggr10, interlace-mode=(string)progressive
    /GstPipeline:pipeline0/GstCapsFilter:capsfilter0.GstPad:sink: caps = video/x-bayer, width=(int)640, height=(int)480, framerate=(fraction)30/1, format=(string)bggr10, interlace-mode=(string)progressive
    /GstPipeline:pipeline0/GstTIOVXISP:tiovxisp0.GstTIOVXMisoPad:src: caps = video/x-raw, format=(string)NV12, width=(int)640, height=(int)480, framerate=(fraction)30/1
    /GstPipeline:pipeline0/GstCapsFilter:capsfilter1.GstPad:src: caps = video/x-raw, format=(string)NV12, width=(int)640, height=(int)480, framerate=(fraction)30/1
    /GstPipeline:pipeline0/GstKMSSink:kmssink0.GstPad:sink: caps = video/x-raw, format=(string)NV12, width=(int)640, height=(int)480, framerate=(fraction)30/1
    /GstPipeline:pipeline0/GstCapsFilter:capsfilter1.GstPad:sink: caps = video/x-raw, format=(string)NV12, width=(int)640, height=(int)480, framerate=(fraction)30/1



  • sensor frames aren't yet visible, will go through similar threads.

  • Hi  , i'm getting "GstPipeline:pipeline0/GstV4l2Src:v4l2src0: Failed to allocate required memory"
    any help highly appreciated, 
    Steps taken so far
    ov5647_properties.txt for generating dcc bin , generated bins copied to opt/imaging directory

    SENSOR_WIDTH 1920
    SENSOR_HEIGHT 1080
    # BIT_DEPTH may be 12, 10, or 8 for linear mode
    BIT_DEPTH 10
    # 0=RGGB; 1=GRBG; 2=GBRG; 3=BGGR
    COLOR_PATTERN 3
    WDR_MODE 0
    WDR_BIT_DEPTH 20
    WDR_KNEE_X 0,512
    WDR_KNEE_Y 0,2048 
    BLACK_PRE  0
    GAMMA_PRE 70
    H3A_INPUT_LSB 0
    BLACK_POST  0
    SENSOR_ID 5647
    PRJ_DIR ../../../../imaging/sensor_drv/src/ov5647
    SENSOR_NAME ov5647
    SENSOR_DCC_NAME SENSOR_ONSEMI_OV5647
    YUV_GAMMA 0

    media-ctl commands I applied 

    media-ctl -V '"ov5647 4-0036":0 [fmt:SBGGR10_1X10/1920x1080 field:none]'
    media-ctl -V '"cdns_csi2rx.30101000.csi-bridge":0 [fmt:SBGGR10_1X10/1920x1080 field:none]'
    media-ctl -V '"30102000.ticsi2rx":0 [fmt:SBGGR10_1X10/1920x1080 field:none]'
    media-ctl --set-v4l2 "'ov5647 4-0036':0[fmt:SBGGR10_1X10/1920x1080 field:none]"
    


    output from media-ctl-p

    media-ctl -p
    Media controller API version 6.12.35
    
    Media device information
    ------------------------
    driver          j721e-csi2rx
    model           TI-CSI2RX
    serial          
    bus info        platform:30102000.ticsi2rx
    hw revision     0x1
    driver version  6.12.35
    
    Device topology
    - entity 1: 30102000.ticsi2rx (7 pads, 7 links, 1 route)
                type V4L2 subdev subtype Unknown flags 0
                device node name /dev/v4l-subdev0
    	routes:
    		0/0 -> 1/0 [ACTIVE]
    	pad0: SINK
    		[stream:0 fmt:SBGGR10_1X10/1920x1080 field:none]
    		<- "cdns_csi2rx.30101000.csi-bridge":1 [ENABLED,IMMUTABLE]
    	pad1: SOURCE
    		[stream:0 fmt:SBGGR10_1X10/1920x1080 field:none]
    		-> "30102000.ticsi2rx context 0":0 [ENABLED,IMMUTABLE]
    	pad2: SOURCE
    		-> "30102000.ticsi2rx context 1":0 [ENABLED,IMMUTABLE]
    	pad3: SOURCE
    		-> "30102000.ticsi2rx context 2":0 [ENABLED,IMMUTABLE]
    	pad4: SOURCE
    		-> "30102000.ticsi2rx context 3":0 [ENABLED,IMMUTABLE]
    	pad5: SOURCE
    		-> "30102000.ticsi2rx context 4":0 [ENABLED,IMMUTABLE]
    	pad6: SOURCE
    		-> "30102000.ticsi2rx context 5":0 [ENABLED,IMMUTABLE]
    
    - entity 9: cdns_csi2rx.30101000.csi-bridge (5 pads, 2 links, 1 route)
                type V4L2 subdev subtype Unknown flags 0
                device node name /dev/v4l-subdev1
    	routes:
    		0/0 -> 1/0 [ACTIVE]
    	pad0: SINK
    		[stream:0 fmt:SBGGR10_1X10/1920x1080 field:none colorspace:srgb]
    		<- "ov5647 4-0036":0 [ENABLED,IMMUTABLE]
    	pad1: SOURCE
    		[stream:0 fmt:SBGGR10_1X10/1920x1080 field:none colorspace:srgb]
    		-> "30102000.ticsi2rx":0 [ENABLED,IMMUTABLE]
    	pad2: SOURCE
    	pad3: SOURCE
    	pad4: SOURCE
    
    - entity 15: ov5647 4-0036 (1 pad, 1 link, 0 routes)
                 type V4L2 subdev subtype Sensor flags 0
                 device node name /dev/v4l-subdev2
    	pad0: SOURCE
    		[stream:0 fmt:SBGGR10_1X10/1920x1080 field:none colorspace:srgb
    		 crop.bounds:(16,16)/2592x1944
    		 crop:(364,450)/1928x1080]
    		-> "cdns_csi2rx.30101000.csi-bridge":0 [ENABLED,IMMUTABLE]
    
    - entity 21: 30102000.ticsi2rx context 0 (1 pad, 1 link)
                 type Node subtype V4L flags 0
                 device node name /dev/video2
    	pad0: SINK
    		<- "30102000.ticsi2rx":1 [ENABLED,IMMUTABLE]
    
    - entity 27: 30102000.ticsi2rx context 1 (1 pad, 1 link)
                 type Node subtype V4L flags 0
                 device node name /dev/video3
    	pad0: SINK
    		<- "30102000.ticsi2rx":2 [ENABLED,IMMUTABLE]
    
    - entity 33: 30102000.ticsi2rx context 2 (1 pad, 1 link)
                 type Node subtype V4L flags 0
                 device node name /dev/video4
    	pad0: SINK
    		<- "30102000.ticsi2rx":3 [ENABLED,IMMUTABLE]
    
    - entity 39: 30102000.ticsi2rx context 3 (1 pad, 1 link)
                 type Node subtype V4L flags 0
                 device node name /dev/video5
    	pad0: SINK
    		<- "30102000.ticsi2rx":4 [ENABLED,IMMUTABLE]
    
    - entity 45: 30102000.ticsi2rx context 4 (1 pad, 1 link)
                 type Node subtype V4L flags 0
                 device node name /dev/video6
    	pad0: SINK
    		<- "30102000.ticsi2rx":5 [ENABLED,IMMUTABLE]
    
    - entity 51: 30102000.ticsi2rx context 5 (1 pad, 1 link)
                 type Node subtype V4L flags 0
                 device node name /dev/video7
    	pad0: SINK
    		<- "30102000.ticsi2rx":6 [ENABLED,IMMUTABLE]
    

    tried UDP streaming

    gst-launch-1.0 v4l2src io-mode=dmabuf device=/dev/video3 ! video/x-bayer, width=1920, height=1080, format=bggr10, framerate=30/1 ! tiovxisp sink_0::device=/dev/v4l-subdev2 sensor-name=SENSOR_ONSEMI_OV5647 dcc-isp-file=/opt/imaging/SENSOR_ONSEMI_OV5647/linear/dcc_viss.bin sink_0::dcc-2a-file=/opt/imaging/SENSOR_ONSEMI_OV5647/linear/dcc_2a.bin format-msb=9 ! v4l2h264enc ! rtph264pay config-interval=1 pt=96 ! udpsink host=192.168.3.33 port=5000 -e

    response

    APP: Init ... !!!
      2443.985649 s: MEM: Init ... !!!
      2443.985712 s: MEM: Initialized DMA HEAP (fd=8) !!!
      2443.985854 s: MEM: Init ... Done !!!
      2443.985870 s: IPC: Init ... !!!
      2444.003622 s: IPC: Init ... Done !!!
    REMOTE_SERVICE: Init ... !!!
    REMOTE_SERVICE: Init ... Done !!!
      2444.007767 s: GTC Frequency = 200 MHz
    APP: Init ... Done !!!
      2444.007996 s:  VX_ZONE_INFO: Globally Enabled VX_ZONE_ERROR
      2444.008020 s:  VX_ZONE_INFO: Globally Enabled VX_ZONE_WARNING
      2444.008029 s:  VX_ZONE_INFO: Globally Enabled VX_ZONE_INFO
      2444.008741 s:  VX_ZONE_INFO: [tivxPlatformCreateTargetId:169] Added target MPU-0 
      2444.009025 s:  VX_ZONE_INFO: [tivxPlatformCreateTargetId:169] Added target MPU-1 
      2444.009305 s:  VX_ZONE_INFO: [tivxPlatformCreateTargetId:169] Added target MPU-2 
      2444.009608 s:  VX_ZONE_INFO: [tivxPlatformCreateTargetId:169] Added target MPU-3 
      2444.009662 s:  VX_ZONE_INFO: [tivxInitLocal:202] Initialization Done !!!
      2444.009673 s:  VX_ZONE_INFO: Globally Disabled VX_ZONE_INFO
    Setting pipeline to PAUSED ...
    Pipeline is live and does not need PREROLL ...
    Pipeline is PREROLLED ...
    Setting pipeline to PLAYING ...
    New clock: GstSystemClock
    ERROR: from element /GstPipeline:pipeline0/GstV4l2Src:v4l2src0: Failed to allocate required memory.
    Additional debug info:
    /usr/src/debug/gstreamer1.0-plugins-good/1.22.12/sys/v4l2/gstv4l2src.c(950): gst_v4l2src_decide_allocation (): /GstPipeline:pipeline0/GstV4l2Src:v4l2src0:
    Buffer pool activation failed
    Execution ended after 0:00:00.011013854
    Setting pipeline to NULL ...
    ERROR: from element /GstPipeline:pipeline0/GstV4l2Src:v4l2src0: Internal data stream error.
    Additional debug info:
    /usr/src/debug/gstreamer1.0/1.22.12/libs/gst/base/gstbasesrc.c(3134): gst_base_src_loop (): /GstPipeline:pipeline0/GstV4l2Src:v4l2src0:
    streaming stopped, reason not-negotiated (-4)
    Freeing pipeline ...
    APP: Deinit ... !!!
    REMOTE_SERVICE: Deinit ... !!!
    REMOTE_SERVICE: Deinit ... Done !!!
      2444.055991 s: IPC: Deinit ... !!!
      2444.056632 s: IPC: DeInit ... Done !!!
      2444.056680 s: MEM: Deinit ... !!!
      2444.056690 s: DDR_SHARED_MEM: Alloc's: 0 alloc's of 0 bytes 
      2444.056707 s: DDR_SHARED_MEM: Free's : 0 free's  of 0 bytes 
      2444.056722 s: DDR_SHARED_MEM: Open's : 0 allocs  of 0 bytes 
      2444.056741 s: MEM: Deinit ... Done !!!
    APP: Deinit ... Done !!!
    

  • Hi Farrukh,

    Let me recreate this issue from my side and get back to you asap

    Regards,

    Dilna K

  • thanks
    started server on ubuntu machine, ip 3.33
    gst-launch-1.0 udpsrc port=5000 caps = "application/x-rtp, media=(string)video, clock-rate=(int)90000, encoding-name=(string)H264, payload=(int)96" ! rtph264depay ! decodebin ! videoconvert ! autovideosink sync=false
    also connected HDMI display to dev kit, previously tried that with similar error, 

  • it is definitely some compatibility issue with dcc bins, 
    i copied dcc bins for 2592x1944 resolution
    tried exactly same ctrl-v steps with updated resolution, and tried to stream at this resolution with frame rate reduced to 10fps, 
    video is now successfully streaming, but it appears blackish, i can only see light pointed to camera, rest all black.
    but streaming is working, data being transmitted on UDP as expected. 
    here is other thread from where i downloaded dcc bins, RE: SK-AM62A-LP: Use the H.264 encoder for source video larger than 1920x1080
    but when i generate myself for same resolution, i get same error.

  • Hi Farrukh,

    1. Could you please try streaming using "yavta" command ie, without using ISP dcc files? so that we can confirm whether it is a dcc file issue.

    2. And could you please try to generate the dcc files corresponding to your sensor by following the steps of TI ISP tuning guide and try again?

    ISP Tuning guide:-  https://www.ti.com/lit/an/sprad86a/sprad86a.pdf

    Regards,

    Dilna K

     

  • Hi Farrukh,

    Also please check the dcc file path of your gstreamer pipeline is correct

    Regards,

    Dilna K

  • Created new dcc binaries, and it worked fine. Need ISP tuning, but overall, seems ok. Thanks for the help.