Transient vertical sync problem at CSI input

cancel
Showing results for 
Search instead for 
Did you mean: 

Transient vertical sync problem at CSI input

1,254 Views
pawelcern
Contributor II

Hi,

I have pretty simple circuit, where ADV7180 (analog video decoder) is attached to i.MX6 CSI input. I am using embedded AV codes. EN is tied to permanently to active level, thanks to this AV codes are processed by CSI. The solution works fine in almost all cases. Transient problem occurs when analog signal source changes (it happens outside, i.MX has no knowledge about this). New picture starts slowly moving down and, after proper position is reached, it stops and is OK (new frames are just captured correctly). The phenomena takes up to several seconds. During that time, IPU reports framing errors (IPU_STAT_INT_5 = 0x00000001). Could you please describe briefly steps (register accesses) to "resync" the circuit when IPU error occurs? Lack of sync during 2 - 3 frames would be acceptable, as this is small fraction of second.

Pawel

Labels (3)
5 Replies

204 Views
qiang_li-mpu_se
NXP Employee
NXP Employee

Hi Pawel, when CSI input source was changed, the application should stop and re-start the task to make CSI re-sync. You can reference to freescale unit test application, such as "imx-test-3.0.35-4.1.0\test\mxc_v4l2_test\mxc_v4l2_tvin.c", there is the example to check the adv7180 switching between PAL and NTSC mode.

You can add more checking, such as camera sensor disconnected, signal lost by polling adv7180 registers.

204 Views
caiopereira
Contributor III

HelloQiang_FSL

I'm having a similar problem.

In my application I use 2 cameras connected to 2 inputs in the ADV7180.

When I try switch the input, the new scene start to move slowly until lock the scene (we need to wait 2~3 seg) a problem looks like to the Pawel Cern​.

To solve this problem could I use this sequence?

ioctl VIDIOC_STREAMOFF

switch the adv7180_input

ioctl VIDIOC_QBUF

ioctlVIDIOC_STREAMON

Thank you.

Regards,

Caio Pereira

0 Kudos

204 Views
qiang_li-mpu_se
NXP Employee
NXP Employee

Yes, you should streamoff and streamon again for the input signal switch.

204 Views
munoz0raul
Contributor II

Hello Qiang Li,

I'm working at the same problem.

I did couple of changes to add the switch channel at "mxc_v4l2_capture.c".

Basically I just add couple of index in to VIDIOC_S_INPUT to call the adv7180 drive to send i2c commands to the chip adv7180.

Add files · munoz0raul/linux-toradex_ACM_iMX6@774fd22 · GitHub

Just to bettler understand the problem I added a video showing our problem.

Câmera issue - YouTube

Now I'm trying do to what did you say, I'm trying to add the VIDIOC_STREAMOFF before change the input.

case VIDIOC_S_INPUT: {

      int *index = arg;

      pr_debug(" case VIDIOC_S_INPUT\n");

      pr_debug("%s: ipu%d/csi%d capture_on=%d %s\n", __func__, cam->ipu_id,

      cam->csi, cam->capture_on,

      mxc_capture_inputs[cam->current_input].name);

    pr_debug("RAUL: Current_ipnput = %d\n", cam->current_input);

     pr_debug("RAUL: *index = %d\n", *index);

     if (*index == 101) {

           pr_debug(" case VIDIOC_STREAMOFF\n");

           pr_debug("%s: ipu%d/csi%d capture_on=%d %s\n", __func__, cam->ipu_id,

           cam->csi, cam->capture_on,

           mxc_capture_inputs[cam->current_input].name);

           mxc_streamoff(cam);

          struct v4l2_control xControl;

           xControl.id = V4L2_CID_INPUT_1;

           pr_debug("RAUL: Chamando mxc_v4l2_s_ctrl\n");

           retval = mxc_v4l2_s_ctrl(cam, &xControl);

          break;

}

Doing this changes, I have a kernel panic:

   38.842417] RAUL: Current_ipnput = 1

[   38.846030] RAUL: *index = 101

[   38.849088]    case VIDIOC_STREAMOFF

[   38.852668] mxc_v4l_do_ioctl: ipu0/csi1 capture_on=1 CSI MEM

[   38.858352] mxc_streamoff: ipu0/csi1 capture_on=1 CSI MEM

[   38.870446] mxc_v4l_ioctl, file = -2103499840, cmd = -1069263343, arg = 1985862692, &arg = -1889911092

[   38.879845] mxc_v4l_do_ioctl, file = -2103499840, ioctlnr = -1069263343, arg = -1889911280, &arg = -1889911372

[   38.912531] mxc_free_frames

[   38.915359] RAUL: Chamando mxc_v4l2_s_ctrl

[   38.919494] mxc_v4l2_s_ctrl

[   38.922293] RAUL:  case V4L2_CID_INPUT_1

[   38.926245] adv7180 2-0021: In adv7180:ioctl_s_ctrl

[   38.931127] RAUL: ADV: ioctl_s_ctrl:

[   38.934708] adv7180 2-0021:    V4L2_CID_INPUT_1:

[   38.939372] adv7180 2-0021: adv7180_write_reg:write reg 0x 0, val: 0x 0

[   38.946712] RAUL: ADV: V4L2_CID_INPUT_1:

[   38.950719] Unable to handle kernel paging request at virtual address 50f86fcc

[   38.957956] pgd = 8f780000

[   38.960676] [50f86fcc] *pgd=00000000

[   38.964290] Internal error: Oops: 805 [#1] SMP ARM

[   38.969093] Modules linked in: mxc_v4l2_capture ipu_csi_enc ipu_prp_enc ipu_still ipu_bg_overlay_sdc ipu_fg_overlay_sdc adv7180_tvin v4l2_int_device

[   38.982583] CPU: 0 PID: 579 Comm: mfwgsttvsrc0:sr Not tainted 3.10.17-00063-g774fd22-dirty #17

[   38.991212] task: 82a34c00 ti: 8f5a2000 task.ti: 8f5a2000

[   38.996646] PC is at mxc_v4l_do_ioctl+0xddc/0x219c [mxc_v4l2_capture]

[   39.003111] LR is at mxc_v4l_do_ioctl+0xd5c/0x219c [mxc_v4l2_capture]

[   39.009569] pc : [<7f0240b0>]    lr : [<7f024030>]    psr: 20070193

[   39.009569] sp : 8f5a3d90  ip : 00000000  fp : 8f5a3dfc

[   39.021062] r10: 60070113  r9 : 8e2e4084  r8 : 8f5a3e10

[   39.026301] r7 : 8e2e4008  r6 : 00000000  r5 : 8e2e406c  r4 : 8e2e4000

[   39.032841] r3 : 00000068  r2 : 8f5a3e24  r1 : 50f86f20  r0 : 00000004

[   39.039384] Flags: nzCv  IRQs off  FIQs on  Mode SVC_32  ISA ARM  Segment user

[   39.046619] Control: 10c5387d  Table: 1f78004a  DAC: 00000015

[   39.052379] Process mfwgsttvsrc0:sr (pid: 579, stack limit = 0x8f5a2238)

[   39.059093] Stack: (0x8f5a3d90 to 0x8f5a4000)

[   39.063470] 3d80:                                     8f5a3e10 8f5a3db4 8000eae8 8002e670

[   39.071670] 3da0: 00000010 f400010c 80818924 8f5a3de0 8f5a3ddc 8f5a3e10 80008510 8000eaa8

[   39.079869] 3dc0: 80028a64 60080013 ffffffff 8f5a3e14 8f5a3e8c c0445611 00000000 00000000

[   39.088068] 3de0: 8f5a3e10 765ddc24 00000003 7f0232d4 8f5a3ebc 8f5a3e00 803d4fac 7f0232e0

[   39.096264] 3e00: 00000000 00000000 7f0232d4 00000000 00000000 00000001 00000000 00000000

[   39.104461] 3e20: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000

[   39.112658] 3e40: 00000001 00000000 00000000 00000000 00000000 8f5a2028 00000000 60080013

[   39.120856] 3e60: 0007f000 c0445611 829f23c0 c0445611 765ddc24 8083cda0 765ddc24 00000000

[   39.129054] 3e80: 8f5a3eac 8f5a3e90 805a4d54 80028864 7f026a94 c0445611 829f23c0 c0445611

[   39.137252] 3ea0: 765ddc24 8083cda0 765ddc24 00000000 8f5a3ee4 8f5a3ec0 7f022658 803d4e24

[   39.145451] 3ec0: 765ddc24 8f5a3ecc 8f5a3ee4 765ddc24 8fc3b000 829f23c0 8f5a3f0c 8f5a3ee8

[   39.153649] 3ee0: 803d12b8 7f02260c 803d11d0 c0445611 829f23c0 00000005 765ddc24 8fd941b0

[   39.161847] 3f00: 8f5a3f74 8f5a3f10 800dffd4 803d11dc 0740e196 00000000 d4ca3d51 001ba5ce

[   39.170046] 3f20: ffffffff 00000000 8f5a3f74 8f5a3f38 80061e60 80464774 0743a0b6 00000000

[   39.178243] 3f40: ffffffff 00000000 8f5a3f64 c0445611 00000005 00000001 765ddc24 829f23c0

[   39.186442] 3f60: 8f5a2000 00000000 8f5a3fa4 8f5a3f78 800e01e8 800dfbd0 00000008 00000001

[   39.194640] 3f80: 765dda70 0093e080 0000e608 000000c8 00000036 8000e384 00000000 8f5a3fa8

[   39.202839] 3fa0: 8000e200 800e01b4 0093e080 0000e608 00000005 c0445611 765ddc24 76f8e750

[   39.211037] 3fc0: 0093e080 0000e608 000000c8 00000036 76f8e750 76f8e9d0 76f90794 000003c8

[   39.219235] 3fe0: 76f9069c 765ddbec 76f8cff9 76cc7a8c 20080010 00000005 00000000 00000000

[   39.227418] Backtrace:

[   39.229927] [<7f0232d4>] (mxc_v4l_do_ioctl+0x0/0x219c [mxc_v4l2_capture]) from [<803d4fac>] (video_usercopy+0x194/0x424)

[   39.240829] [<803d4e18>] (video_usercopy+0x0/0x424) from [<7f022658>] (mxc_v4l_ioctl+0x58/0x64 [mxc_v4l2_capture])

[   39.251218] [<7f022600>] (mxc_v4l_ioctl+0x0/0x64 [mxc_v4l2_capture]) from [<803d12b8>] (v4l2_ioctl+0xe8/0x144)

[   39.261230]  r5:829f23c0 r4:8fc3b000

[   39.264875] [<803d11d0>] (v4l2_ioctl+0x0/0x144) from [<800dffd4>] (do_vfs_ioctl+0x410/0x5e4)

[   39.273323]  r8:8fd941b0 r7:765ddc24 r6:00000005 r5:829f23c0 r4:c0445611

r3:803d11d0

[   39.281292] [<800dfbc4>] (do_vfs_ioctl+0x0/0x5e4) from [<800e01e8>] (SyS_ioctl+0x40/0x68)

[   39.289502] [<800e01a8>] (SyS_ioctl+0x0/0x68) from [<8000e200>] (ret_fast_syscall+0x0/0x30)

[   39.297862]  r8:8000e384 r7:00000036 r6:000000c8 r5:0000e608 r4:0093e080

[   39.304679] Code: e0214193 e3500000 03a00001 13a00004 (e58100ac)

[   39.310793] ---[ end trace 1be5a8f7c2e9b079 ]---

[   39.327603] mxc_v4l_ioctl, file = -1887546432, cmd = -1068476902, arg = 2127661392, &arg = -2086846772

[   39.337058] mxc_v4l_do_ioctl, file = -1887546432, ioctlnr = -1068476902, arg = -2086846960, &arg = -2086847052

^F ^[ðßðæððßðæ^CCaught interrupt -- handling interrupt.

Interrupt: Stopping pipeline ...

(gst-launch-0.10:577): GLib-CRITICAL **: Source ID 16 was not found when attempting to remove it

Execution ended after 584344408861 ns.

Setting pipeline to PAUSED ...

Running time 0:09:44.344805537 render fps 0.643

Can you help me on that?

Thanks for all support.

0 Kudos

204 Views
qiang_li-mpu_se
NXP Employee
NXP Employee

You should not use the VIDIOC_S_INPUT, this ioctl can only support two capture path (0 or 1), CSI->MEM and CSI->IC->MEM, they are defined in "static struct v4l2_input mxc_capture_inputs[MXC_V4L2_CAPTURE_NUM_INPUTS]"

Since you had set index to 100, there is no such index in mxc_capture_inputs[], kernel panic happens.

If you wants to access adv7180, you can use VIDIOC_G_CTRL and VIDIOC_S_CTRL.

0 Kudos