V4L2 Camera of Jetson Nano

Hi,
i ported a csi camera referring imx219, and i read raw image by v4l2, but i got a problem: when i set 3 mmap buffers, there is only the first one buffer which has valid image data, other two buffer with no data; and if i set 5 mmap buffers, then also the first one buffer is with valid image data, other 4 buffer does not.

Does any error kernel message?

no, there is no kernel message. every thing goes OK except the invalid image data.

but I get another issue, if the driver probe my device failed and return -1 in probe function, the kernel gets oops. I don’t know if these two problem are relative or not. this is kernel panic:
append: tegraid=21.1.2.0.0 ddr_die=4096M@2048M section=512M memtype=0 vpr_resize usb_port_owner_inft

Flattened Device Tree blob at 83100000

Booting using the fdt blob at 0x83100000
reserving fdt memory region: addr=80000000 size=20000
Using Device Tree in place at 0000000083100000, end 000000008317350b

Starting kernel …

[ 1.027148] tegradc tegradc.1: dpd enable lookup fail:-19 [ 1.538464] Host read timeout at address 545c00c4 [ 1.703675] opnm8008 6-003c: board setup failed [ 1.708276] Unable to handle kernel read from unreadable memory at virtual address 000001e0 [ 1.716640] Mem abort info: [ 1.719462] ESR = 0x96000005 [ 1.722534] Exception class = DABT (current EL), IL = 32 bits [ 1.728490] SET = 0, FnV = 0 [ 1.731554] EA = 0, S1PTW = 0 [ 1.734705] Data abort info: [ 1.737583] ISV = 0, ISS = 0x00000005 [ 1.741428] CM = 0, WnR = 0 [ 1.744409] [00000000000001e0] user address but active_mm is swapper [ 1.750774] Internal error: Oops: 96000005 [#1] PREEMPT SMP [ 1.756344] Modules linked in: [ 1.759418] CPU: 3 PID: 1 Comm: swapper/0 Not tainted 4.9.140-tegra #297 [ 1.766115] Hardware name: NVIDIA Jetson Nano Developer Kit (DT) [ 1.772115] task: ffffffc0fa6f0000 task.stack: ffffffc0fa66c000 [ 1.778051] PC is at dev_pm_domain_detach+0x1c/0x48 [ 1.782935] LR is at i2c_device_probe+0x1a0/0x258 [ 1.787637] pc : [] lr : [] pstate: 40400045 [ 1.795025] sp : ffffffc0fa66fc10 [ 1.798337] x29: ffffffc0fa66fc10 x28: ffffff8009813e48 [ 1.803668] x27: ffffff8009658e60 x26: ffffff80095d7f30 [ 1.808994] x25: ffffff800a12d000 x24: ffffff80095f0490 [ 1.814321] x23: 000000000ed66ed8 x22: ffffffc0f9056804 [ 1.819646] x21: ffffffc0f9056800 x20: 0000000000000001 [ 1.824970] x19: 0000000000000000 x18: 0000000000000010 [ 1.830296] x17: 0000000000000001 x16: 0000000000000000 [ 1.835621] x15: ffffffffffffffff x14: ffffff808a134a82 [ 1.840946] x13: ffffff800a134a90 x12: 0000000000000004 [ 1.846270] x11: 0000000005f5e0ff x10: 00000000000001e8 [ 1.851595] x9 : 00000000ffffffd0 x8 : ffffff80083d4798 [ 1.856920] x7 : ffffff8009ea4358 x6 : ffffff80083d3b88 [ 1.862243] x5 : 0000000000000000 x4 : 0000000000000000 [ 1.867568] x3 : ffffffffffffffff x2 : ffffff8009e742c8 [ 1.872892] x1 : 0000000000000001 x0 : ffffff8008acf830 [ 1.878216] [ 1.879709] Process swapper/0 (pid: 1, stack limit = 0xffffffc0fa66c000) [ 1.886405] Call trace: [ 1.888856] [] dev_pm_domain_detach+0x1c/0x48 [ 1.894774] [] i2c_device_probe+0x1a0/0x258 [ 1.900522] [] driver_probe_device+0xd8/0x408 [ 1.906438] [] __driver_attach+0xdc/0x128 [ 1.912009] [] bus_for_each_dev+0x5c/0xa8 [ 1.917577] [] driver_attach+0x30/0x40 [ 1.922887] [] bus_add_driver+0x20c/0x2a8 [ 1.928457] [] driver_register+0x6c/0x110 [ 1.934025] [] i2c_register_driver+0x4c/0xb0 [ 1.939865] [] opnm8008_i2c_driver_init+0x18/0x20 [ 1.946134] [] do_one_initcall+0x44/0x130 [ 1.951707] [] kernel_init_freeable+0x1a0/0x244 [ 1.957803] [] kernel_init+0x18/0x108 [ 1.963024] [] ret_from_fork+0x10/0x40 [ 1.968347] ---[ end trace e4324321c0e2c938 ]--- [ 1.979102] Kernel panic - not syncing: Attempted to kill init! exitcode=0x0000000b [ 1.979102] [ 1.988240] SMP: stopping secondary CPUs [ 1.992180] Kernel Offset: disabled [ 1.995672] Memory Limit: none [ 2.004613] Rebooting in 5 seconds..

How do you set 3 mmap buffers? How do you get the raw data? v4l2-ctl?

I set mmap buffer by ioctl with VIDIOC_REQBUFS. and read raw data by ioctl with VIDIOC_DQBUF

Have a verify below command.

v4l2-ctl -d /dev/video0 --set-fmt-video=width=1920,height=1080,pixelformat=RG10 --set-ctrl bypass_mode=0 --stream-mmap --stream-count=3 --stream-to=t.raw

My camera data format is BGGR12, and resolution is 352*744, so I capture the raw data by:
v4l2-ctl -d /dev/video0 --set-fmt-video=width=352,height=744,pixelformat=RG12 --set-ctrl bypass_mode=0 --stream-mmap --stream-count=3 --stream-to=t.raw
but the three frame data are all invalid.

sorry, I made a mistake. Capture raw data by v4l2-ctl is also the first frame data is valid, others are invalid

Add “–set-ctrl low_latency_mode=1” to try.

v4l2-ctl -d /dev/video0 --set-fmt-video=width=1920,height=1080,pixelformat=RG10 --set-ctrl bypass_mode=0 --set-ctrl low_latency_mode=1 --stream-mmap --stream-count=3 --stream-to=t.raw

That could be the sensor output data problem.