AM62A7: OXO3F10 CSI streaming errors DMA buffer issue

Part Number: AM62A7

Hi  team,
I am trying to add a new driver for 0x03f10 to the AM62A Edgi AI build. |
I have integrated a  driver and DTBO, this builds and runs. 

I have been working through this to generate a raw file ,so  I can tune the ISP, If I run the command to generate a Raw file It doesn't allocate a buffer. 


///////////////////mediactl comamnd////////////////////

root@am62axx-evm:~# media-ctl -p
Media controller API version 6.12.35[ 664.905484]
[ 664.905484] vvdn init routing


Media device information
------------------------
driver [ 664.912545]
[ 664.912545] vvdn set1 routing
j721e-csi2rx
model TI-CSI2RX
serial [ 664.922583]
[ 664.922583] vvdn init format

bus info platform:30102000.ticsi2rx
hw revision 0[ 664.932662]
[ 664.932662] vvdn get frame internval
x1
driver version 6.12.35

Device topology
- entity 1: 3010[ 664.943137] ox06c 2-0036:
[ 664.943137] vvdn get frame
2000.ticsi2rx (7 pads, 7 links, 1 route)
type V4L2 [ 664.954231]
[ 664.954231] vvdn get frame internval
subdev subtype Unknown flags 0
device node name /de[ 664.964726] ox06c 2-0036:
[ 664.964726] vvdn get frame
v/v4l-subdev0
routes:
0/0 -> 1/0 [ACTIVE]
pad0: SINK
[stream:0 fmt:SRGGB12_1X12/1920x1280 field:none]
<- "cdns_csi2rx.30101000.csi-bridge":1 [ENABLED,IMMUTABLE]
pad1: SOURCE
[stream:0 fmt:SRGGB12_1X12/1920x1280 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:SRGGB12_1X12/1920x1280 field:none]
<- "ox06c 2-0036":0 [ENABLED,IMMUTABLE]
pad1: SOURCE
[stream:0 fmt:SRGGB12_1X12/1920x1280 field:none]
-> "30102000.ticsi2rx":0 [ENABLED,IMMUTABLE]
pad2: SOURCE
pad3: SOURCE
pad4: SOURCE

- entity 15: ox06c 2-0036 (1 pad, 1 link, 2 routes)
type V4L2 subdev subtype Sensor flags 0
device node name /dev/v4l-subdev2
routes:
0/0 -> 0/0 [ACTIVE]
0/0 -> 0/1 [ACTIVE]
pad0: SOURCE
[stream:0 fmt:SRGGB12_1X12/1920x1280@1/60 field:none colorspace:raw]
[stream:1 fmt:unknown/0x0@1/60]
-> "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]

  • /////////////commands//////////

    media-ctl -d /dev/media0 -V '"ox06c 2-0036":0 [fmt:SRGGB12_1X12/1920x1280]'
    media-ctl -d /dev/media0 -V '"cdns_csi2rx.30101000.csi-bridge":0 [fmt:SRGGB12_1X12/1920x1280]'
    media-ctl -d /dev/media0 -V '"cdns_csi2rx.30101000.csi-bridge":1 [fmt:SRGGB12_1X12/1920x1280]'
    media-ctl -d /dev/media0 -V '"30102000.ticsi2rx":0 [fmt:SRGGB12_1X12/1920x1280]'
    yavta -c -s 1920x1280 -f SRGGB12 /dev/video2

  • ////////////stream command///////////

    root@am62axx-evm:~# yavta -c -s 1920x1280 -f SRGGB12 /dev/video2
    Device /dev/video2 opened.
    Device `j721e-csi2rx' on `platform:30102000.ticsi2rx' (driver 'j721e-csi2rx') supports video, capture, without mplanes.
    Video format set: SRGGB12 (32314752) 1920x1280 (stride 3840) field no[ 322.679947] j721e-csi2rx 30102000.ticsi2rx: Skipping validation as no format present on "30102000.ticsi2rx":2:0
    ne buffer size 4915200
    Video format: SRGGB12 (32314752) 1920x12[ 322.693764] j721e-csi2rx 30102000.ticsi2rx: Skipping validation as no format present on "30102000.ticsi2rx":3:0
    80 (stride 3840) field none buffer size 4915200
    8 buffers reque[ 322.709374] j721e-csi2rx 30102000.ticsi2rx: Skipping validation as no format present on "30102000.ticsi2rx":4:0
    sted.
    length: 4915200 offset: 0 timestamp type/source: mono/EoF[ 322.725029] j721e-csi2rx 30102000.ticsi2rx: Skipping validation as no format present on "30102000.ticsi2rx":5:0

    Buffer 0/0 mapped at address 0xffffbe7a0000.
    length: 4915200 [ 322.740624] j721e-csi2rx 30102000.ticsi2rx: Skipping validation as no format present on "30102000.ticsi2rx":6:0
    offset: 32768 timestamp type/source: mono/EoF
    Buffer 1/0 mapped[ 322.756263]

    at address 0xffffbe2f0000.
    length: 4915200 offset: 65536 times[ 322.767117]

    tamp type/source: mono/EoF
    Buffer 2/0 mapped at address 0xffffb[ 322.777019] ox06c 2-0036:

    de40000.
    length: 4915200 offset: 98304 timestamp type/source: m[ 322.789011] ox06c 2-0036:
    ono/EoF
    Buffer 3/0 mapped at address 0xffffbd990000.
    length: 4[ 322.800987] ox06c 2-0036:
    [ 322.800987] vvdn TEST resume streams
    915200 offset: 131072 timestamp type/source: mono/EoF
    Buffer 4/[ 322.812895] ox06c 2-0036:
    0 mapped at address 0xffffbd4e0000.
    length: 4915200 offset: 163840 timestamp type/source: mono/EoF
    Buffer 5/0 mapped at address 0xffffbd030000.
    length: 4915200 offset: 196608 timestamp type/source: mono/EoF
    Buffer 6/0 mapped at address 0xffffbcb80000.
    length: 4915200 offset: 229376 timestamp type/source: mono/EoF
    Buffer 7/0 mapped at address 0xffffbc6d0000.

    ^C[ 334.733556] j721e-csi2rx 30102000.ticsi2rx: DMA transfer timed out for drain buffer

  • //////////////////register dumps///////////////////

    root@am62axx-evm:~# devmem2 0x30101028 w
    /dev/mem opened.
    Memory mapped at address 0xffffa73d2000.
    Read at address 0x30101028 (0xffffa73d2028): 0x00020100

    root@am62axx-evm:~# devmem2 0x30101020 w
    /dev/mem opened.
    Memory mapped at address 0xffffbedc3000.
    Read at address 0x30101020 (0xffffbedc3020): 0x00000022

    root@am62axx-evm:~# devmem2 0x30101104 w
    /dev/mem opened.
    Memory mapped at address 0xffffb25f2000.
    Read at address 0x30101104 (0xffffb25f2104): 0x80000133

    root@am62axx-evm:~# devmem2 0x30101048 w
    /dev/mem opened.
    Memory mapped at address 0xffff8e68b000.
    Read at address 0x30101048 (0xffff8e68b048): 0x00333306

  • The command "" yavta -c -s 1920x1280 -f SRGGB12 /dev/video2 "" gets hanged and exit only when ctrl + c is pressed. Could you please help us to debug this issue ?


  • Hi Adityhan,

    0/0 -> 0/0 [ACTIVE]
    0/0 -> 0/1 [ACTIVE]
    pad0: SOURCE
    [stream:0 fmt:SRGGB12_1X12/1920x1280@1/60 field:none colorspace:raw]
    [stream:1 fmt:unknown/0x0@1/60]
    -> "cdns_csi2rx.30101000.csi-bridge":0 [ENABLED,IMMUTABLE]

    Can you please clarify why you are exposing two streams in the sensor driver? Out of these, stream 1 is routed through to the SoC. That doesn't have a format set. 

    media-ctl -d /dev/media0 -V '"ox06c 2-0036":0 [fmt:SRGGB12_1X12/1920x1280]'

    Can you try setting for stream 1 as well?

    Regards,
    Jay


  • Hi Jai,

    we tried setting stream 1  and behavior was the same , meanwhile there was some change in register dump . Stream 1 channel is literally enabled for HDR porpose , we can disable it if that is causing an issue .

    root@am62axx-evm:~# devmem2 0x30101028 w
    /dev/mem opened.
    Memory mapped at address 0xffffbbfcd000.
    Read at address 0x30101028 (0xffffbbfcd028): 0x00020100


    root@am62axx-evm:~# devmem2 0x30101020 w
    /dev/mem opened.
    Memory mapped at address 0xffff9451a000.
    Read at address 0x30101020 (0xffff9451a020): 0x00000002

    root@am62axx-evm:~# devmem2 0x30101104 w
    /dev/mem opened.
    Memory mapped at address 0xffffb2c39000.
    Read at address 0x30101104 (0xffffb2c39104): 0x80000113

    root@am62axx-evm:~# devmem2 0x30101048 w
    /dev/mem opened.
    Memory mapped at address 0xffffa02ea000.
    Read at address 0x30101048 (0xffffa02ea048): 0x00222206

    ///////////////mediactl////////////////////////

    root@am62axx-evm:~# media-ctl -p
    Media controller API version 6.12.35
    [ 7564.661790]
    [ 7564.661790] vvdn init routing

    Media device information
    ------------------------
    driver [ 7564.668946]
    [ 7564.668946] vvdn set1 routing
    j721e-csi2rx
    model TI-CSI2RX
    [ 7564.679111]
    [ 7564.679111] vvdn get frame internval

    bus info platform:30102000.ticsi2rx
    hw revision 0x1[ 7564.689604] ox06c 2-0036:
    [ 7564.689604] vvdn get frame

    driver version 6.12.35

    Device topology
    - entity 1: 301020[ 7564.700668]
    [ 7564.700668] vvdn get frame internval
    00.ticsi2rx (7 pads, 7 links, 1 route)
    type V4L2 su[ 7564.711217] ox06c 2-0036:
    [ 7564.711217] vvdn get frame
    bdev subtype Unknown flags 0
    device node name /dev/v4l-subdev0
    routes:
    0/0 -> 1/0 [ACTIVE]
    pad0: SINK
    [stream:0 fmt:SRGGB12_1X12/1920x1280 field:none]
    <- "cdns_csi2rx.30101000.csi-bridge":1 [ENABLED,IMMUTABLE]
    pad1: SOURCE
    [stream:0 fmt:SRGGB12_1X12/1920x1280 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:SRGGB12_1X12/1920x1280 field:none]
    <- "ox06c 2-0036":0 [ENABLED,IMMUTABLE]
    pad1: SOURCE
    [stream:0 fmt:SRGGB12_1X12/1920x1280 field:none]
    -> "30102000.ticsi2rx":0 [ENABLED,IMMUTABLE]
    pad2: SOURCE
    pad3: SOURCE
    pad4: SOURCE

    - entity 15: ox06c 2-0036 (1 pad, 1 link, 2 routes)
    type V4L2 subdev subtype Sensor flags 0
    device node name /dev/v4l-subdev2
    routes:
    0/0 -> 0/0 [ACTIVE]
    0/0 -> 0/1 [ACTIVE]
    pad0: SOURCE
    [stream:0 fmt:SRGGB12_1X12/1920x1280@1/60 field:none colorspace:srgb]
    [stream:1 fmt:SRGGB12_1X12/1920x1280@1/60 field:none colorspace:srgb]
    -> "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/video3
    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/video4
    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/video5
    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/video6
    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/video7
    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/video8
    pad0: SINK
    <- "30102000.ticsi2rx":6 [ENABLED,IMMUTABLE]

  • Hi Adithyan,

    Thanks for clarifying the purpose of the stream. So, is  the other stream just for metadata? In that case, can you try disabling it for now? In the current driver stack, metadata handling is not handled. I would need a little time to see how to handle that, if that is supported by the driver.

    In the meantime, we can try to get the streaming handled correctly without the HDR portion. 

    root@am62axx-evm:~# devmem2 0x30101028 w
    /dev/mem opened.
    Memory mapped at address 0xffffbbfcd000.
    Read at address 0x30101028 (0xffffbbfcd028): 0x00020100

    Here, I see that stream1 FIFO is overflowing.

    root@am62axx-evm:~# devmem2 0x30101104 w
    /dev/mem opened.
    Memory mapped at address 0xffffb2c39000.
    Read at address 0x30101104 (0xffffb2c39104): 0x80000113

    This shows that stream0 data is being processed.

    Disabling the HDR portion might help diagnosing if it is stream misconfiguration or something else. Also, please share the virtual channel and data type configuration that you are expecting.

    Regards,
    Jay

  • Hi Jay,

    No issue we will disable Stream1 and verify the behavior.

    At this stage, our primary objective is to capture a few raw frames successfully. Once we are able to dump stable raw frames, we can proceed with further development and optimizations.
    Could you please share the common reasons for a Stream FIFO overflow in the CSI2RX pipeline? Also, is this overflow condition the root cause that prevents the pipeline from dropping frames gracefully, or could there be another underlying issue contributing to it?


    below is our data type configuration
    ///////////////////////////////////////
    static int ox36b_get_frame_desc(struct v4l2_subdev *sd, unsigned int pad,
    struct v4l2_mbus_frame_desc *fd)
    {
    struct v4l2_subdev_state *state;
    struct v4l2_mbus_framefmt *fmt;
    u32 bpp;
    int ret = 0;
    unsigned int i;

    printk("\nvvdn get frame desc \n");
    if (pad != 0)
    return -EINVAL;
    state = v4l2_subdev_lock_and_get_active_state(sd);
    fmt = v4l2_subdev_state_get_format(state, 0, 0);
    if (!fmt) {
    ret = -EPIPE;
    goto out;
    }
    memset(fd, 0, sizeof(*fd));

    fd->type = V4L2_MBUS_FRAME_DESC_TYPE_CSI2;

    /* pixel stream - 1 virtual channels*/

    bpp = 12;
    i=0;
    fd->entry[fd->num_entries].stream = i;

    fd->entry[fd->num_entries].flags = V4L2_MBUS_FRAME_DESC_FL_LEN_MAX;
    fd->entry[fd->num_entries].length = fmt->width * fmt->height * bpp / 8;
    fd->entry[fd->num_entries].pixelcode = fmt->code;
    fd->entry[fd->num_entries].bus.csi2.vc = i;
    fd->entry[fd->num_entries].bus.csi2.dt = 0x2c; /* RAW12 */

    fd->num_entries++;

    out:
    v4l2_subdev_unlock_state(state);

    return ret;
    }
    ////////////////////////////////////////////

  • Hi Adithyan,

    A common reason for the FIFO to be overflowing could be that the CSI2RX is not dequeuing the data. In case, the data that is not being dequeued is the metadata, it should be fine. In case it is the frame data, that would explain why you are facing this issue.

    I'll get back to you tomorrow more information on what could be causing this issue. In the meantime, please share the following register value, when both the streams are enabled:

    Regards,
    Jay

  • Hi Jay,
    i have disabled the stream1 and increased the clock ,looks like the pipeline is running and frames are dumping now . Thank you so much for the support .


    root@am62axx-evm:~# media-ctl -d /dev/media0 -V '"ox06c 2-0036":0 [fmt:SRGGB12_1X12/1920x1280]'
    root@am62axx-evm:~# media-ctl -d /dev/media0 -V '"cdns_csi2rx.30101000.csi-bridge":0 [fmt:SRGGB12_1X12/1920x1280]'
    root@am62axx-evm:~# media-ctl -d /dev/media0 -V '"cdns_csi2rx.30101000.csi-bridge":1 [fmt:SRGGB12_1X12/1920x1280]'
    root@am62axx-evm:~# media-ctl -d /dev/media0 -V '"30102000.ticsi2rx":0 [fmt:SRGGB12_1X12/1920x1280]'


    root@am62axx-evm:~# yavta -s 1920x1280 -f SRGGB12 /dev/video2 -c2 -Fframe-#.bin
    Device /dev/video2 opened.
    Device `j721e-csi2rx' on `platform:30102000.ticsi2rx' (driver 'j721e-csi2rx') supports video, capture, without mplanes.
    Video format set: SRGGB12 (32314752) 1920x1280 (stride 3840) field none[ 280.557604]

    buffer size 4915200
    Video format: SRGGB12 (32314752) 1920x1280[ 280.567176]

    (stride 3840) field none buffer size 4915200
    8 buffers request[ 280.577317] ox06c 2-0036:

    ed.
    length: 4915200 offset: 0 timestamp type/source: mono/EoF
    [ 280.589299] ox06c 2-0036:

    Buffer 0/0 mapped at address 0xffffbc250000.
    length: 4915200 of[ 280.601244] ox06c 2-0036:

    fset: 32768 timestamp type/source: mono/EoF
    Buffer 1/0 mapped a[ 280.613219]

    t address 0xffffbbda0000.
    length: 4915200 offset: 65536 timesta[ 280.623272] ox06c 2-0036:

    mp type/source: mono/EoF
    Buffer 2/0 mapped at address 0xffffbb8[ 280.635159]

    length: 4915200 offset: 98304 timestamp type/source: mono/EoF
    Buffer 3/0 mapped at address 0xffffbb440000.
    length: 4915200 offset: 131072 timestamp type/source: mono/EoF
    Buffer 4/0 mapped at address 0xffffbaf90000.
    length: 4915200 offset: 163840 timestamp type/source: mono/EoF
    Buffer 5/0 mapped at address 0xffffbaae0000.
    length: 4915200 offset: 196608 timestamp type/source: mono/EoF
    Buffer 6/0 mapped at address 0xffffba630000.
    length: 4915200 offset: 229376 timestamp type/source: mono/EoF
    Buffer 7/0 mapped at address 0xffffba180000.

    0 (0) [-] any 0 4915200 B 280.906579 280.932276 -38.953 fps ts mono/EoF
    1 (1) [-] any 1 4915200 B 280.922433 281.026317 63.076 fps ts mono/EoF

    Captured 2 frames in 0.094066 seconds (21.261612 fps, 104505075.120199 B/s).
    8 buffers released.

  • Hi Adithyan,

    That is great. I also checked with my team. It would seem like stream1 is not going to be used internally. So, how were you enabling the second stream?

    Please have a look at the OX05B1S driver. It deals with multiple streams(RGB and IR) but exposes them on stream0: https://git.ti.com/cgit/ti-linux-kernel/ti-linux-kernel/tree/drivers/media/i2c/ox05b1s.c?h=ti-linux-6.12.y

    The different streams correspond to the CSI subsystem topology and stream0 is routed to the j721e-csi2rx (SHIM).

    Regards,
    Jay