This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

AM571x MIPI CSI-2 camera



We have been working on AM571x with a OV4689 camera sensor, now we could use some  help.

The camera sensor is connected to CSI2_0 port of AM571x. We use 4 data lanes and one clk lane.

We use 'TI CAL camera interface driver' inside the Processor SDK (file drivers/media/platform/ti-vpe/cal.c).

we wrote a v4l2 sub_dev driver for ov4689 and use it as a subdev of CAL. the module init :

root@am57xx-evm:~# insmod ti-cal.ko
[   39.430343] cal 4845b000.cal: Probing cal
root@am57xx-evm:~# insmod ov4689.ko
[   44.984856] ov4689_get_pdata invoked
[   44.988458] ov4689_get_pdata: DT Node found
[   44.992728] ov4689_get_pdata: endpoint found
[   45.036566] ov4689 2-0036: Found OV4688 sensor
[   45.041200] cal-000: Using sensor ov4689 for capture
[   45.047579] cal-000: V4L2 device registered as video1
[   45.056735] ov4689 2-0036: ov4689 sensor driver registered !!

then run cappture demo from v4l2:

root@am57xx-evm:~# ./capture -d  /dev/video1 -m

[  322.006821] ov4689_s_stream: on: 1

We can set sensor driver stream on and observed data out put from ov4689 with oscilloscope.

but we can get any data from CAL driver.

run capture demo with strace we can get info:

ioctl(3, VIDIOC_DQBUF, 0xbed0dac8)      = -1 EAGAIN (Resource temporarily unavailable)

It  seems CAL module did not receive any data.  Then we check /proc/interrupts,the CAL module generate 0 interrupt.

That's the problem we met. Is there anyone have idea about this?

  • Hi,

    I will ask the AM57X team to check this.
  • Hi,

    I've forwarded this to the CSI SW designers. The thread will be updated with the feedback.

    Best Regards,
    Yordan
  • Jason, Did you review the pin mux settings?

    Regards,

    Manisha

  • hi Manisha,

    We did consider pinmux could be the problem. First we check DM and found:

    these pins have only one mux mode, and we cannot find PAD_CONF regs for them in Control module reg list in TRM. Could we missed something? pls help

  • Okay, I see now that on DRA72x the CSI2 pins are dedicated so there are no pinmux needed for them.

    Which TI kernel release is your code based on?

    Can you check the data lane and clock lane config (highlighted below) in the DTS and make sure the DTS info matches how your sensor driver is configured. These are also described in Documentation/devicetree/bindings/media/ti-cal.txt

     For example:

     

           <csi2_sensor@?? {

                   compatible = "sensor_company,sensor_name";

                   reg = <sensor i2c bus address>;

     

                   port {

                           #address-cells = <1>;

                           #size-cells = <0>;

     

                           csi2_sensor_1: endpoint {

                                   reg = <0>;

                                   clock-lanes = <1>;

                                   data-lanes = <0 2 3 4>;

                                   remote-endpoint = <&csi2_0>;

                           };

                   };

           };

  • hi manisha,

    we use kernel 3.14.49 follow this processors.wiki.ti.com/index.php/Processor_SDK_Building_The_SDK guide.

    We found there is a new version psdk now.

    and dt file mach our hardware design:

            ov4689: ov4689@36 {
            compatible = "ovt,ov4689";
            pinctrl-names = "default";
            pinctrl-0 = <&pwdn_pin>;
            reg = <0x36>;
                    port {  
                            #address-cells = <1>;
                            #size-cells = <0>;
                            ov4689_1: endpoint {
                                    reg = <0>;
                                    clock-lanes = <0>;
                                    data-lanes = <1 2 3 4>;
                                    lane-polarities = <1 1 1 1 1>;
                                    remote-endpoint = <&csi2_0>;
                                    mclk-frequency = <24000000>;
                                    pwdn-gpio = <&gpio7 8 GPIO_ACTIVE_HIGH>;
                            };
                    };
            };

    &cal {  
            status = "okay";
            csi2_0: port@0 {
                    #address-cells = <1>;
                    #size-cells = <0>;
                    reg = <0>;
                    endpoint {
                            slave-mode;
                            remote-endpoint = <&ov4689_1>;
                    };
            };
    };

  • manisha,

    We update psdk to 2.0 with linux kernel 4.1.6 but the problem persist.

    Do you have any idea?

    Does Ti have any working camera sensor drive can provide as example?

  • Can you share the debug log? Below command to be used before running your application -
    echo 5 > /sys/module/ti_cal/parameters/debug
  • run with echo 5 > /sys/module/ti_cal/parameters/debug

    got some reg dump and kernel oops


    root@am57xx-evm:~# insmod ov4689.ko
    [  416.382032] ov4689_get_pdata invoked
    [  416.385635] ov4689_get_pdata: DT Node found
    [  416.390250] ov4689_get_pdata: endpoint found
    [  416.394547] mclk:24000000
    [  416.397522] gpio:200
    [  416.451945] 46,88
    [  416.453892] ov4689 2-0036: Found OV4688 sensor
    [  416.458629] cal-000: Using sensor ov4689 for capture
    [  416.465097] cal-000: V4L2 device registered as video1
    [  416.474939] ov4689 2-0036: ov4689 sensor driver registered !!
    root@am57xx-evm:~# echo 5 > /sys/module/ti_cal/parameters/debug
    root@am57xx-evm:~# ./capuure.out -d /dev/video1 -, m
    [  452.139908] cal-000: no pixel rate control in subdev: ov4689
    [  452.145873] ov4689_s_stream: on: 1
    [  452.205126] cal: CAL Registers @ 0x4845b000:
    [  452.209587] 00000000: 40000200 a3c90469 00000000 00000000
    [  452.215046] 00000010: 00000004 00000000 00000000 00000000
    [  452.220824] 00000020: 00000000 00000000 00000000 00000000
    [  452.226294] 00000030: 00000000 00000000 00000001 00000001
    [  452.232136] 00000040: 00000000 00000000 00000001 00000001
    [  452.237807] 00000050: 00000000 00000000 00000000 00000000
    [  452.243231] 00000060: 00000000 00000000 00000000 00000000
    [  452.248819] 00000070: 00000000 00000000 00000000 00000000
    [  452.254242] 00000080: 00000000 00000000 00000000 00000000
    [  452.259779] 00000090: 00000000 00000000 00000000 00000000
    [  452.265202] 000000a0: 00000000 00000000 00000000 00000000
    [  452.270733] 000000b0: 00000000 00000000 00000000 00000000
    [  452.276156] 000000c0: 00080005 00050014 00050014 00050014
    [  452.281691] 000000d0: 00000000 00000000 00000000 00000000
    [  452.287128] 000000e0: 00000000 00000000 00000000 00000000
    [  452.292549] 000000f0: 00000000 00000000 00000000 00000000
    [  452.298106] 00000100: ff1fe07e 00000000 00000000 00000000
    [  452.303528] 00000110: 00000000 00000000 00000000 00000000
    [  452.309058] 00000120: 00000000 00010000 00000000 00000000
    [  452.314481] 00000130: 08080000 00000000 00000000 00000000
    [  452.320014] 00000140: 00000000 00000000 00000000 00000000
    [  452.325437] 00000150: 00000000 00000000 00000000 00000000
    [  452.330992] 00000160: 00000000 00000000 00000000 00000000
    [  452.336426] 00000170: 00000000 00000000 00000000 00000000
    [  452.341848] 00000180: 00000000 00000000 00000000 00000000
    [  452.347405] 00000190: 00000000 00000000 00000000 00000000
    [  452.352828] 000001a0: 00000000 00000000 00000000 00000000
    [  452.358359] 000001b0: 00000000 00000000 00000000 00000000
    [  452.363781] 000001c0: 00000000 00000000 00000000 00000000
    [  452.369313] 000001d0: 00000000 00000000 00000000 00000000
    [  452.374736] 000001e0: 00000000 00000000 00000000 00000000
    [  452.380266] 000001f0: 00000000 00000000 00000000 00000000
    [  452.385689] 00000200: 00004304 be600000 00000a80 0a800000
    [  452.391222] 00000210: 00004000 00000000 00000000 00000000
    [  452.396716] 00000220: 00004000 00000000 00000000 00000000
    [  452.402139] 00000230: 00004000 00000000 00000000 00000000
    [  452.407762] 00000240: 00004000 00000000 00000000 00000000
    [  452.413186] 00000250: 00004000 00000000 00000000 00000000
    [  452.418721] 00000260: 00004000 00000000 00000000 00000000
    [  452.424144] 00000270: 00004000 00000000 00000000 00000000
    [  452.429677] 00000280: 00000000 00000000 00000000 00000000
    [  452.435099] 00000290: 00000000 00000000 00000000 00000000
    [  452.440631] 000002a0: 00000000 00000000 00000000 00000000
    [  452.446054] 000002b0: 00000000 00000000 00000000 00000000
    [  452.451588] 000002c0: 00000000 00000000 00000000 00000000
    [  452.457025] 000002d0: 00000000 00000000 00000000 00000000
    [  452.462447] 000002e0: 00000000 00000000 00000000 00000000
    [  452.468004] 000002f0: 00000000 00000000 00000000 00000000
    [  452.473426] 00000300: 00000001 6a0dcba9 00000000 00000000
    [  452.478958] 00000310: 00000000 00004197 3f000000 00000000
    [  452.484381] 00000320: 00000000 00000000 00000000 00000000
    [  452.489912] 00000330: 00000101 00000000 00000000 00000000
    [  452.495334] 00000340: 00000000 00000000 00000000 00000000
    [  452.500865] 00000350: 00000000 00000000 00000000 00000000
    [  452.506289] 00000360: 00000000 00000000 00000000 00000000
    [  452.511819] 00000370: 00000000 00000000 00000000 00000000
    [  452.517256] 00000380: 00000000 00000000 00000000 00000000
    [  452.522677] 00000390: 00000000 00007fff 00000000 00000000
    [  452.528232] 000003a0: 00000000 00000000 00000000 00000000
    [  452.533656] 000003b0: 00000000 00000000 00000000 00000000
    [  452.539268] 000003c0: 00000000 00000000 00000000 00000000
    [  452.544738] 000003d0: 00000000 00000000 00000000 00000000
    [  452.550359] 000003e0: 00000000 00000000 00000000 00000000
    [  452.555808] 000003f0: 00000000 00000000 00000000 00000000
    [  452.561440] Unable to handle kernel NULL pointer dereference at virtual address 000003d4
    [  452.569632] pgd = ed4a4000
    [  452.572482] [000003d4] *pgd=ae3e6831, *pte=00000000, *ppte=00000000
    [  452.578899] Internal error: Oops: 17 [#1] PREEMPT SMP ARM
    [  452.584317] Modules linked in: ov4689 ipv6 gdbserverproxy(O) cryptodev(O) cmemk(O) xhci_plat_hcd xhci_hcd usbcore rpmsg_rpc evdev virtio_rpmsg_bus dwc3 udc_core cpufreq_voltdm omapdrm_pvr(O) omap_wdt ahci_platform libahci_platform libahci phy_omap_usb2 libata ti_cal ti_vpe videobuf2_dma_contig ti_vpdma ti_soc_thermal v4l2_mem2mem videobuf2_memops videobuf2_core v4l2_common thermal_sys hwmon dwc3_omap videodev media extcon_palmas extcon rtc_palmas palmas_pwrbutton omap_rng rng_core debugss_kmodule(O) omap_remoteproc remoteproc virtio virtio_ring
    [  452.633376] CPU: 0 PID: 890 Comm: a.out Tainted: G           O    4.1.6-g52c4aa7 #2
    [  452.641060] Hardware name: Generic DRA72X (Flattened Device Tree)
    [  452.647174] task: eb4f7200 ti: ed718000 task.ti: ed718000
    [  452.652606] PC is at cal_start_streaming+0xa1c/0xe84 [ti_cal]
    [  452.658380] LR is at finish_task_switch+0x5c/0x10c
    [  452.663187] pc : [<bf143bf8>]    lr : [<c00576cc>]    psr: 600b0013
    [  452.663187] sp : ed719cd8  ip : ed719ad0  fp : ed719d44
    [  452.674709] r10: 00000013  r9 : ebad4000  r8 : 00000000
    [  452.679951] r7 : ee219b74  r6 : ee219b50  r5 : bf146974  r4 : ebad4000
    [  452.686500] r3 : 00000400  r2 : 00200000  r1 : eb4f7200  r0 : 0000002d
    [  452.693051] Flags: nZCv  IRQs on  FIQs on  Mode SVC_32  ISA ARM  Segment user
    [  452.700212] Control: 10c5387d  Table: ad4a406a  DAC: 00000015
    [  452.705978] Process a.out (pid: 890, stack limit = 0xed718218)
    [  452.711831] Stack: (0xed719cd8 to 0xed71a000)
    [  452.716202] 9cc0:                                                       00000004 fa45b000
    [  452.724411] 9ce0: 00000400 00000000 000001c1 009f0902 00000000 00000000 00000000 00000000
    [  452.732619] 9d00: 00000000 00000001 00000001 00000000 00000000 ed719cec ed719d44 ebad4454
    [  452.740827] 9d20: ebad4684 ebad4434 bf04fb78 00000000 ee143180 ed629c00 ed719d64 ed719d48
    [  452.749036] 9d40: bf0debdc bf1431e8 ebad4434 00000001 ebad40a0 bf04fb78 ed719d7c ed719d68
    [  452.757244] 9d60: bf0e1830 bf0deb84 ee143180 00000001 ed719d8c ed719d80 bf0e18b4 bf0e1728
    [  452.765452] 9d80: ed719da4 ed719d90 bf0e1918 bf0e1888 bf0e18d4 40045612 ed719dbc ed719da8
    [  452.773660] 9da0: bf04fb9c bf0e18e0 00000001 40045612 ed719e24 ed719dc0 bf052524 bf04fb84
    [  452.781869] 9dc0: ee0e6318 ee0e61b8 00000120 00000048 00000001 bf06464c ed629c00 ed719e38
    [  452.790078] 9de0: ed719e64 fffffffa ef507818 ed629780 ee0e61b8 c001c7b4 00000000 40045612
    [  452.798286] 9e00: bf052274 00000004 ed719e38 00000000 beca2ba0 ee143180 ed719ee4 ed719e28
    [  452.806494] 9e20: bf051f24 bf052280 ed719e4c 00000000 00000004 00000001 00000001 00000001
    [  452.814703] 9e40: 001f2c00 00002003 00000000 00000000 00000000 00000000 00000000 00000000
    [  452.822911] 9e60: 00000000 00000000 00000001 005d9000 001f2c00 00000000 00000000 b6696000
    [  452.831120] 9e80: ee0e6328 040444fb ed719ef4 ed719e98 c00fc094 c00faeb0 ee0e6328 00000000
    [  452.839328] 9ea0: ee143180 000005d9 00000000 001f3000 c08bfdd8 00000000 ee0e61b8 ebad40a0
    [  452.847536] 9ec0: ee143180 40045612 beca2ba0 ebad43d8 00000003 00000000 ed719ef4 ed719ee8
    [  452.855744] 9ee0: bf052270 bf051db4 ed719f1c ed719ef8 bf04e68c bf052264 ee2d2628 beca2ba0
    [  452.863953] 9f00: ee143180 00000003 beca2ba0 00000003 ed719f7c ed719f20 c012cae8 bf04e5cc
    [  452.872162] 9f20: ee143180 00000000 ed719f74 ed719f38 c00e9cac c007128c 00000001 000005d9
    [  452.880370] 9f40: ed719f4c c0080b88 00000001 00000000 00000001 00000000 00000000 ee143180
    [  452.888578] 9f60: ee143180 40045612 beca2ba0 00000003 ed719fa4 ed719f80 c012cd4c c012c6e0
    [  452.896786] 9f80: beca2be8 00000000 00000000 00000036 c000fb04 ed718000 00000000 ed719fa8
    [  452.904994] 9fa0: c000f960 c012cce4 beca2be8 00000000 00000003 40045612 beca2ba0 40045612
    [  452.913203] 9fc0: beca2be8 00000000 00000000 00000036 00000000 00000000 b6f7b000 beca2b54
    [  452.921411] 9fe0: 00022750 beca2b34 00010940 b6ef2a66 600d0030 00000003 c400e304 0515020b
    [  452.929617] Backtrace:
    [  452.932093] [<bf1431dc>] (cal_start_streaming [ti_cal]) from [<bf0debdc>] (vb2_start_streaming+0x64/0x15c [videobuf2_core])
    [  452.943265]  r10:ed629c00 r9:ee143180 r8:00000000 r7:bf04fb78 r6:ebad4434 r5:ebad4684
    [  452.951155]  r4:ebad4454
    [  452.953714] [<bf0deb78>] (vb2_start_streaming [videobuf2_core]) from [<bf0e1830>] (vb2_internal_streamon+0x114/0x160 [videobuf2_core])
    [  452.965844]  r7:bf04fb78 r6:ebad40a0 r5:00000001 r4:ebad4434
    [  452.971558] [<bf0e171c>] (vb2_internal_streamon [videobuf2_core]) from [<bf0e18b4>] (vb2_streamon+0x38/0x58 [videobuf2_core])
    [  452.982904]  r5:00000001 r4:ee143180
    [  452.986515] [<bf0e187c>] (vb2_streamon [videobuf2_core]) from [<bf0e1918>] (vb2_ioctl_streamon+0x44/0x48 [videobuf2_core])
    [  452.997638] [<bf0e18d4>] (vb2_ioctl_streamon [videobuf2_core]) from [<bf04fb9c>] (v4l_streamon+0x24/0x28 [videodev])
    [  453.008199]  r5:40045612 r4:bf0e18d4
    [  453.011818] [<bf04fb78>] (v4l_streamon [videodev]) from [<bf052524>] (__video_do_ioctl+0x2b0/0x324 [videodev])
    [  453.021855]  r5:40045612 r4:00000001
    [  453.025474] [<bf052274>] (__video_do_ioctl [videodev]) from [<bf051f24>] (video_usercopy+0x17c/0x4b0 [videodev])
    [  453.035685]  r10:ee143180 r9:beca2ba0 r8:00000000 r7:ed719e38 r6:00000004 r5:bf052274
    [  453.043574]  r4:40045612
    [  453.046139] [<bf051da8>] (video_usercopy [videodev]) from [<bf052270>] (video_ioctl2+0x18/0x1c [videodev])
    [  453.055829]  r10:00000000 r9:00000003 r8:ebad43d8 r7:beca2ba0 r6:40045612 r5:ee143180
    [  453.063718]  r4:ebad40a0
    [  453.066280] [<bf052258>] (video_ioctl2 [videodev]) from [<bf04e68c>] (v4l2_ioctl+0xcc/0xe0 [videodev])
    [  453.075634] [<bf04e5c0>] (v4l2_ioctl [videodev]) from [<c012cae8>] (do_vfs_ioctl+0x414/0x604)
    [  453.084190]  r9:00000003 r8:beca2ba0 r7:00000003 r6:ee143180 r5:beca2ba0 r4:ee2d2628
    [  453.091995] [<c012c6d4>] (do_vfs_ioctl) from [<c012cd4c>] (SyS_ioctl+0x74/0x84)
    [  453.099329]  r9:00000003 r8:beca2ba0 r7:40045612 r6:ee143180 r5:ee143180 r4:00000000
    [  453.107142] [<c012ccd8>] (SyS_ioctl) from [<c000f960>] (ret_fast_syscall+0x0/0x3c)
    [  453.114738]  r9:ed718000 r8:c000fb04 r7:00000036 r6:00000000 r5:00000000 r4:beca2be8
    [  453.122542] Code: e1a02003 e34b0f14 eb5303ac eafffe57 (e59833d4)
    [  453.131185] ---[ end trace e6687efaf685a419 ]---

  • This kernel log tells that the sensor driver doesn't support v4l2 control V4L2_CID_PIXEL _RATE

    root@am57xx-evm:~# ./capuure.out -d /dev/video1 -, m
    [  452.139908] cal-000: no pixel rate control in subdev: ov4689

     

    Looks like the cal driver is modified as the cal_start_streaming should have exited right after the above log but somehow it kept going.

     

    The sensor driver must support v4l2 control V4L2_CID_PIXEL_RATE. The cal driver will interrogate the sensor driver and get the sensor pixel rate info in order to set the CSI2 PHY pixel clock related parameters.

     

    The kernel oops seen is due to the fact that the code kept going after the "no pixel rate control in subdev: ov4689" message and attempt to use 0 as the pixel rate is causing a divide by zero later in the code while trying to configure the needed phy registers.

     

    There are several sensor driver already implementing the V4L2_CID_PIXEL_RATE control that can be used as reference.

  • thanks for ur suggest.

    we add V4L2_CID_PIXEL_RATE support in camera driver. but still won't work.

    we add printk in cal driver so we can see "ctx->external_rate = 600000000" output.

    when run app without debug enable, we still got time out.

    and with echo 5 > /sys/module/ti_cal/parameters/debug we got kernel Oops.

    but i think that's cause by cal_quickdump_regs() inside cal_start_streaming().


    root@am57xx-evm:~# insmod ov4689.ko
    [   31.462771] ov4689_get_pdata invoked
    [   31.466470] ov4689_get_pdata: DT Node found
    [   31.470675] ov4689_get_pdata: endpoint found
    [   31.475382] mclk:24000000
    [   31.478681] gpio:200
    [   31.531798] 46,88
    [   31.533740] ov4689 2-0036: Found OV4688 sensor
    [   31.538362] cal-000: Using sensor ov4689 for capture
    [   31.544834] cal-000: V4L2 device registered as video1
    [   31.554799] ov4689 2-0036: ov4689 sensor driver registered !!
    root@am57xx-evm:~# ./capture -d /dev/video1 -m
    [   45.699516] ctx->external_rate = 600000000
    [   45.703588] ov4689_s_stream: on: 1
    select timeout[   47.764241] ov4689_s_stream: on: 0

    root@am57xx-evm:~# echo 5 > /sys/module/ti_cal/parameters/debug
    root@am57xx-evm:~# echo 5 > /sys/module/ti_cal/parameters/debugroot@am57xx-evm:~# ./capture -d /dev/video1 -m
    [   87.977737] ctrl_ext.value64 = 600000000
    [   87.981852] ov4689_s_stream: on: 1
    [   88.040434] cal: CAL Registers @ 0x4845b000:
    [   88.044733] 00000000: 40000200 a3c90469 00000000 00000000
    [   88.050409] 00000010: 00000004 00000000 00000000 00000000
    [   88.055836] 00000020: 00000000 00000000 00000000 00000000
    [   88.061415] 00000030: 00000000 00000000 00000001 00000001
    [   88.066860] 00000040: 00000000 00000000 00000001 00000001
    [   88.072283] 00000050: 00000000 00000000 00000000 00000000
    [   88.077875] 00000060: 00000000 00000000 00000000 00000000
    [   88.083300] 00000070: 00000000 00000000 00000000 00000000
    [   88.088854] 00000080: 00000000 00000000 00000000 00000000
    [   88.094278] 00000090: 00000000 00000000 00000000 00000000
    [   88.099833] 000000a0: 00000000 00000000 00000000 00000000
    [   88.105259] 000000b0: 00000000 00000000 00000000 00000000
    [   88.110813] 000000c0: 00080005 00050014 00050014 00050014
    [   88.116254] 000000d0: 00000000 00000000 00000000 00000000
    [   88.121678] 000000e0: 00000000 00000000 00000000 00000000
    [   88.127260] 000000f0: 00000000 00000000 00000000 00000000
    [   88.132685] 00000100: ff1fe07e 00000000 00000000 00000000
    [   88.138240] 00000110: 00000000 00000000 00000000 00000000
    [   88.143666] 00000120: 00000000 00010000 00000000 00000000
    [   88.149220] 00000130: 08080000 00000000 00000000 00000000
    [   88.154645] 00000140: 00000000 00000000 00000000 00000000
    [   88.160196] 00000150: 00000000 00000000 00000000 00000000
    [   88.165621] 00000160: 00000000 00000000 00000000 00000000
    [   88.171174] 00000170: 00000000 00000000 00000000 00000000
    [   88.176615] 00000180: 00000000 00000000 00000000 00000000
    [   88.182037] 00000190: 00000000 00000000 00000000 00000000
    [   88.187618] 000001a0: 00000000 00000000 00000000 00000000
    [   88.193044] 000001b0: 00000000 00000000 00000000 00000000
    [   88.198596] 000001c0: 00000000 00000000 00000000 00000000
    [   88.204021] 000001d0: 00000000 00000000 00000000 00000000
    [   88.209585] 000001e0: 00000000 00000000 00000000 00000000
    [   88.215010] 000001f0: 00000000 00000000 00000000 00000000
    [   88.220564] 00000200: 00004304 be600000 00000a80 0a800000
    [   88.225989] 00000210: 00004000 00000000 00000000 00000000
    [   88.231540] 00000220: 00004000 00000000 00000000 00000000
    [   88.236981] 00000230: 00004000 00000000 00000000 00000000
    [   88.242403] 00000240: 00004000 00000000 00000000 00000000
    [   88.247987] 00000250: 00004000 00000000 00000000 00000000
    [   88.253413] 00000260: 00004000 00000000 00000000 00000000
    [   88.258964] 00000270: 00004000 00000000 00000000 00000000
    [   88.264389] 00000280: 00000000 00000000 00000000 00000000
    [   88.270124] 00000290: 00000000 00000000 00000000 00000000
    [   88.275614] 000002a0: 00000000 00000000 00000000 00000000
    [   88.281269] 000002b0: 00000000 00000000 00000000 00000000
    [   88.286741] 000002c0: 00000000 00000000 00000000 00000000
    [   88.292219] 000002d0: 00000000 00000000 00000000 00000000
    [   88.298227] 000002e0: 00000000 00000000 00000000 00000000
    [   88.303647] 000002f0: 00000000 00000000 00000000 00000000
    [   88.309167] 00000300: 00000001 6a0dcba9 00000000 00000000
    [   88.314586] 00000310: 00000000 00004197 3f000000 00000000
    [   88.320096] 00000320: 00000000 00000000 00000000 00000000
    [   88.325516] 00000330: 00000101 00000000 00000000 00000000
    [   88.331023] 00000340: 00000000 00000000 00000000 00000000
    [   88.336455] 00000350: 00000000 00000000 00000000 00000000
    [   88.341874] 00000360: 00000000 00000000 00000000 00000000
    [   88.347403] 00000370: 00000000 00000000 00000000 00000000
    [   88.352823] 00000380: 00000000 00000000 00000000 00000000
    [   88.358330] 00000390: 00000000 00007fff 00000000 00000000
    [   88.363750] 000003a0: 00000000 00000000 00000000 00000000
    [   88.369256] 000003b0: 00000000 00000000 00000000 00000000
    [   88.374676] 000003c0: 00000000 00000000 00000000 00000000
    [   88.380183] 000003d0: 00000000 00000000 00000000 00000000
    [   88.385602] 000003e0: 00000000 00000000 00000000 00000000
    [   88.391108] 000003f0: 00000000 00000000 00000000 00000000
    [   88.396562] Unable to handle kernel NULL pointer dereference at virtual address 000003d4
    [   88.404683] pgd = edd50000
    [   88.407558] [000003d4] *pgd=ae180831, *pte=00000000, *ppte=00000000
    [   88.413874] Internal error: Oops: 17 [#1] PREEMPT SMP ARM
    [   88.419293] Modules linked in: ov4689_ema ipv6 gdbserverproxy(O) cryptodev(O) cmemk(O) xhci_plat_hcd xhci_hcd usbcore rpmsg_rpc evdev dwc3 virtio_rpmsg_bus udc_core cpufreq_voltdm omapdrm_pvr(O) ahci_platform omap_wdt libahci_platform libahci phy_omap_usb2 libata ti_vpe ti_cal ti_vpdma videobuf2_dma_contig v4l2_mem2mem videobuf2_memops videobuf2_core v4l2_common ti_soc_thermal thermal_sys hwmon dwc3_omap videodev extcon_palmas extcon palmas_pwrbutton rtc_palmas media omap_rng rng_core debugss_kmodule(O) omap_remoteproc remoteproc virtio virtio_ring
    [   88.468357] CPU: 0 PID: 875 Comm: capture Tainted: G           O    4.1.6-g52c4aa7 #2
    [   88.476216] Hardware name: Generic DRA72X (Flattened Device Tree)
    [   88.482331] task: ede46d00 ti: edfd6000 task.ti: edfd6000
    [   88.487759] PC is at cal_start_streaming+0xaac/0xe70 [ti_cal]
    [   88.493532] LR is at irq_work_queue+0xc0/0xd4
    [   88.497903] pc : [<bf12dc88>]    lr : [<c00bfc78>]    psr: 600b0013
    [   88.497903] sp : edfd7cd8  ip : edfd7ad8  fp : edfd7d44
    [   88.509424] r10: 00000013  r9 : ebee0000  r8 : 00000000
    [   88.514667] r7 : ee2c6c34  r6 : ee2c6c10  r5 : bf130948  r4 : ebee0000
    [   88.521216] r3 : 00000400  r2 : 00000000  r1 : eee533dc  r0 : 0000002d
    [   88.527767] Flags: nZCv  IRQs on  FIQs on  Mode SVC_32  ISA ARM  Segment user
    [   88.534928] Control: 10c5387d  Table: add5006a  DAC: 00000015
    [   88.540694] Process capture (pid: 875, stack limit = 0xedfd6218)
    [   88.546721] Stack: (0xedfd7cd8 to 0xedfd8000)
    [   88.551091] 7cc0:                                                       00000004 fa45b000
    [   88.559300] 7ce0: 00000400 00000000 000001c1 009f0902 00000000 00000000 00000000 00000000
    [   88.567508] 7d00: 00000000 00000001 00000001 00000000 00000000 edfd7cec edfd7d44 ebee0454
    [   88.575717] 7d20: ebee0684 ebee0434 bf04fb78 00000000 edfd1600 eded3a40 edfd7d64 edfd7d48
    [   88.583925] 7d40: bf0e7bdc bf12d1e8 ebee0434 00000001 ebee00a0 bf04fb78 edfd7d7c edfd7d68
    [   88.592132] 7d60: bf0ea830 bf0e7b84 edfd1600 00000001 edfd7d8c edfd7d80 bf0ea8b4 bf0ea728
    [   88.600341] 7d80: edfd7da4 edfd7d90 bf0ea918 bf0ea888 bf0ea8d4 40045612 edfd7dbc edfd7da8
    [   88.608549] 7da0: bf04fb9c bf0ea8e0 00000001 40045612 edfd7e24 edfd7dc0 bf052524 bf04fb84
    [   88.616758] 7dc0: edd90ec8 edd90058 00000120 00000048 00000001 bf06464c eded3a40 edfd7e38
    [   88.624966] 7de0: edfd7e64 fffffffa ef328850 eded3780 edd90058 c001c7b4 00000000 40045612
    [   88.633174] 7e00: bf052274 00000004 edfd7e38 00000000 bef19ba0 edfd1600 edfd7ee4 edfd7e28
    [   88.641382] 7e20: bf051f24 bf052280 edfd7e4c 00000000 00000004 00000001 00000001 00000001
    [   88.649590] 7e40: 001f2c00 00002003 00000000 00000000 00000000 00000000 00000000 00000000
    [   88.657799] 7e60: 00000000 00000000 00000001 005d9000 001f2c00 00000000 00000000 b66d6000
    [   88.666006] 7e80: edd90ed8 040444fb edfd7ef4 edfd7e98 c00fc094 c00faeb0 edd90ed8 00000000
    [   88.674214] 7ea0: edfd1600 000005d9 00000000 001f3000 c08bfdd8 00000000 edd90058 ebee00a0
    [   88.682423] 7ec0: edfd1600 40045612 bef19ba0 ebee03d8 00000003 00000000 edfd7ef4 edfd7ee8
    [   88.690631] 7ee0: bf052270 bf051db4 edfd7f1c edfd7ef8 bf04e68c bf052264 ee219628 bef19ba0
    [   88.698838] 7f00: edfd1600 00000003 bef19ba0 00000003 edfd7f7c edfd7f20 c012cae8 bf04e5cc
    [   88.707046] 7f20: edfd1600 00000000 edfd7f74 edfd7f38 c00e9cac c007128c 00000001 000005d9
    [   88.715255] 7f40: edfd7f4c c0080b88 00000001 00000000 00000001 00000000 00000000 edfd1600
    [   88.723463] 7f60: edfd1600 40045612 bef19ba0 00000003 edfd7fa4 edfd7f80 c012cd4c c012c6e0
    [   88.731670] 7f80: bef19be8 00000000 00000000 00000036 c000fb04 edfd6000 00000000 edfd7fa8
    [   88.739879] 7fa0: c000f960 c012cce4 bef19be8 00000000 00000003 40045612 bef19ba0 40045612
    [   88.748087] 7fc0: bef19be8 00000000 00000000 00000036 00000000 00000000 b6fbb000 bef19b54
    [   88.756296] 7fe0: 00022750 bef19b34 00010940 b6f32a66 600d0030 00000003 020004fb 033c8bc6
    [   88.764502] Backtrace:
    [   88.766978] [<bf12d1dc>] (cal_start_streaming [ti_cal]) from [<bf0e7bdc>] (vb2_start_streaming+0x64/0x15c [videobuf2_core])
    [   88.778149]  r10:eded3a40 r9:edfd1600 r8:00000000 r7:bf04fb78 r6:ebee0434 r5:ebee0684
    [   88.786040]  r4:ebee0454
    [   88.788595] [<bf0e7b78>] (vb2_start_streaming [videobuf2_core]) from [<bf0ea830>] (vb2_internal_streamon+0x114/0x160 [videobuf2_core])
    [   88.800727]  r7:bf04fb78 r6:ebee00a0 r5:00000001 r4:ebee0434
    [   88.806443] [<bf0ea71c>] (vb2_internal_streamon [videobuf2_core]) from [<bf0ea8b4>] (vb2_streamon+0x38/0x58 [videobuf2_core])
    [   88.817789]  r5:00000001 r4:edfd1600
    [   88.821397] [<bf0ea87c>] (vb2_streamon [videobuf2_core]) from [<bf0ea918>] (vb2_ioctl_streamon+0x44/0x48 [videobuf2_core])
    [   88.832524] [<bf0ea8d4>] (vb2_ioctl_streamon [videobuf2_core]) from [<bf04fb9c>] (v4l_streamon+0x24/0x28 [videodev])
    [   88.843086]  r5:40045612 r4:bf0ea8d4
    [   88.846705] [<bf04fb78>] (v4l_streamon [videodev]) from [<bf052524>] (__video_do_ioctl+0x2b0/0x324 [videodev])
    [   88.856743]  r5:40045612 r4:00000001
    [   88.860359] [<bf052274>] (__video_do_ioctl [videodev]) from [<bf051f24>] (video_usercopy+0x17c/0x4b0 [videodev])
    [   88.870572]  r10:edfd1600 r9:bef19ba0 r8:00000000 r7:edfd7e38 r6:00000004 r5:bf052274
    [   88.878461]  r4:40045612
    [   88.881025] [<bf051da8>] (video_usercopy [videodev]) from [<bf052270>] (video_ioctl2+0x18/0x1c [videodev])
    [   88.890713]  r10:00000000 r9:00000003 r8:ebee03d8 r7:bef19ba0 r6:40045612 r5:edfd1600
    [   88.898605]  r4:ebee00a0
    [   88.901167] [<bf052258>] (video_ioctl2 [videodev]) from [<bf04e68c>] (v4l2_ioctl+0xcc/0xe0 [videodev])
    [   88.910522] [<bf04e5c0>] (v4l2_ioctl [videodev]) from [<c012cae8>] (do_vfs_ioctl+0x414/0x604)
    [   88.919077]  r9:00000003 r8:bef19ba0 r7:00000003 r6:edfd1600 r5:bef19ba0 r4:ee219628
    [   88.926882] [<c012c6d4>] (do_vfs_ioctl) from [<c012cd4c>] (SyS_ioctl+0x74/0x84)
    [   88.934215]  r9:00000003 r8:bef19ba0 r7:40045612 r6:edfd1600 r5:edfd1600 r4:00000000
    [   88.942029] [<c012ccd8>] (SyS_ioctl) from [<c000f960>] (ret_fast_syscall+0x0/0x3c)
    [   88.949626]  r9:edfd6000 r8:c000fb04 r7:00000036 r6:00000000 r5:00000000 r4:bef19be8
    [   88.957428] Code: e2841014 e34b0f12 eb535b88 eafffdbb (e59833d4)
    [   88.965529] ---[ end trace 61f8da8341e28ea8 ]---

  • Can you try with echo 4 > /sys/module/ti_cal/parameters/debug? If it just times out with this without crashing, then you may wanna look into  pixel_rate value. 600000000 value looks too high.

     

    To figure out if it is pixel clock problem, comment below line, multiply pixel clock by 2 and hard code it in cal_start_streaming()

    /*           ret = cal_get_external_info(ctx);

                    if (ret < 0)

                                    return ret;

    */

                    ctx->external_rate = 192000000;  /* assuming pixel clock is 96 MHz */

     

  • with echo 4 > /sys/module/ti_cal/parameters/debug we still got kernel oops as debug level5,

    so we try level 3 we get:

    root@am57xx-evm:~#  echo 3 > /sys/module/ti_cal/parameters/debug
    root@am57xx-evm:~# ./capture -d /dev/video1 -m
    [   72.700213] ov4689_s_stream: on: 1
    select timeout[   74.760997] ov4689_s_stream: on: 0

    We also tried hard code external rate at 192000000 as you suggested.

    it show same info as above. no err no interrupt too.

  • The console log is not providing any useful information.

    Can you set the debug level to 3 before the cal driver is probed? You can do it by either adding ti_cal.debug=3 on the kernel boot line or modify the cal.c file to hard code debug=3 near the top of the file.

    What pixel clock you are programming the sensor to?

  • Another check on DT settings - the lane polarities are all set to be inverted. Is that on purpose?
  • hi manisha

    the lane polarities are set according to hardware design.

    And i got the debug=3 log for you:

    [   51.491924] cal-000: __subdev_get_format
    [   51.491948] cal-000: __subdev_get_format 1344x760 code:3007
    [   51.491974] cal-000: nbuffers=4, size=2042880
    [   51.500203] cal-000: cal_start_streaming
    [   51.500223] cal-000: enable_irqs
    [   51.500232] cal-000: camerarx_phy_enable
    [   51.500240] cal-000: csi2_init
    [   51.500249] cal-000: CAL_CSI2_TIMING(1) = 0x0000c197
    [   51.500360] cal-000: CAL_CSI2_COMPLEXIO_CFG(1) = 0x4a000000
    [   51.500368] cal-000: CAL_CTRL = 0xff1fe07e
    [   51.500374] cal-000: csi2_phy_config
    [   51.500381] cal-000: ddrclkperiod_us: 10416
    [   51.500387] cal-000: ths_term: 1 (0x01)
    [   51.500394] cal-000: ths_settle: 15 (0x0f)
    [   51.500402] cal-000: CSI2_0_REG0 = 0x0100010f
    [   51.500410] cal-000: CSI2_0_REG1 = 0xe002e10e
    [   51.500417] cal-000: csi2_lane_config
    [   51.500424] cal-000: CAL_CSI2_COMPLEXIO_CFG(1) = 0x4a0dcba9
    [   51.500430] cal-000: csi2_ctx_config
    [   51.500439] cal-000: CAL_CSI2_CTX0(1) = 0x00000101
    [   51.500445] cal-000: pix_proc_config
    [   51.500453] cal-000: CAL_PIX_PROC(1) = 0x00080005
    [   51.500460] cal-000: cal_wr_dma_config
    [   51.500467] cal-000: CAL_WR_DMA_CTRL(1) = 0x00004304
    [   51.500475] cal-000: CAL_WR_DMA_OFST(1) = 0x00000a80
    [   51.500483] cal-000: CAL_WR_DMA_XSIZE(1) = 0x0a800000
    [   51.500490] cal-000: csi2_ppi_enable
    [   51.500498] ov4689_s_stream: on: 1
    [   51.558466] cal-000: returning from cal_start_streaming
    [   53.561012] cal-000: cal_stop_streaming
    [   53.561028] ov4689_s_stream: on: 0
    [   53.565364] cal-000: csi2_ppi_disable
    [   53.565380] cal-000: csi2_ppi_disable
    [   53.565388] cal-000: disable_irqs
    [   53.565401] cal-000: [edc8a400/1] done
    [   53.565408] cal-000: [edc8a000/2] done
    [   53.565416] cal-000: [eb82ac00/3] done
    [   53.565424] cal-000: [edc8a800/0] done cur_frm
    [   53.565432] cal-000: returning from cal_stop_streaming

    pls let me know if you found something

  • If DT info truly reflect your hardware, then from the the log it looks to be setup properly. One last thing that can be checked is Domain and functional clocks at run time.

    You can create a script with below code in to dump the interested registers. Run the script while streaming test is on-going i.e between start_streaming and stop_streaming. Share the output with us. It seems that your use case is having timeout of 2 seconds. Please increase the timeout a bit for this test.  

    #!/bin/sh

    echo "CM_CAM_CLKSTCTRL"

    devmem2 0x4a009000 w

    echo "CM_CAM_STATICDEP"

    devmem2 0x4a009004 w

    echo "CM_CAM_VIP1_CLKCTRL"

    devmem2 0x4a009020 w

    echo "CM_CAM_VIP2_CLKCTRL"

    devmem2 0x4a009028 w

    echo "CM_CAM_VIP3_CLKCTRL"

    devmem2 0x4a009030 w

  • hi manisha

    we got  those values with ur script.

    CM_CAM_CLKSTCTRL
    /dev/mem opened.
    Memory mapped at address 0xb6f99000.
    Read at address  0x4A009000 (0xb6f99000): 0x00001202
    CM_CAM_STATICDEP
    /dev/mem opened.
    Memory mapped at address 0xb6fc0000.
    Read at address  0x4A009004 (0xb6fc0004): 0x00000020
    CM_CAM_VIP1_CLKCTRL
    /dev/mem opened.
    Memory mapped at address 0xb6fae000.
    Read at address  0x4A009020 (0xb6fae020): 0x00070000
    CM_CAM_VIP2_CLKCTRL
    /dev/mem opened.
    Memory mapped at address 0xb6f92000.
    Read at address  0x4A009028 (0xb6f92028): 0x00040001
    CM_CAM_VIP3_CLKCTRL
    /dev/mem opened.
    Memory mapped at address 0xb6f6c000.
    Read at address  0x4A009030 (0xb6f6c030): 0x00070000


    but we also found these value is the same as we insert module.

    no matter app running or not.

    pls let me know if u found anything

  • These looks fine too.

    CAL driver is not tested with 10 bit raw sensor, so it can be possible that something may be broken. Although, expectation is to still capture something even if it was corrupted.

     Can you look into following things -

    • In csi2_ctx_config() the context is set with a virtual channel id.
      The virtual channel id comes from DT:

    csi2_sensor_1: endpoint {

                    reg = <0>;    ç in this case 0

                    clock-lanes = <1>;

                    data-lanes = <0 2 3 4>;

                    remote-endpoint = <&csi2_0>;

    };
    Verify that your sensor is sending data tagged with Virtual Channel id 0.

    • in pix_proc_config() , currently pixel extraction is hard coded and packing parameters for an 8 bits source.

    You might want to set Extraction to either 10 bits MIPI or 10 bits linear, and also set Packing to 16 bits.

  • hi manisha,

    yes , we use virtual channel 0

    and we try 10bit MIPI extract and linear and different packing.

    still no interrupt generated :(

    shouldn't cal at least generate some error?

    can you provide a working sensor model and reference design?

  • hi manisha,

    local ti branch gave me a set of patch, I change cal related code and still no luckcsi-ov90-patches.tar.gz

  • Hi Jason.

    I also have the sample problem that you've been said...

    So I would like to know that you solved your problem?

    If you found something please tell me how did you figured it out.

    Best regards.

  • Hi Jason,

    Some bugs were found in CAL driver. Please check the patches shared in below e2e -
    e2e.ti.com/.../2129679