Proper way of capturing RAW 10 or 12-bit images from IMX477 on Jetson Nano with JetPack 4.6

Hi!
I need to capture RAW image (10 or 12-bi) from my CSI camera with a format supported by Linux software (RAWTherapee, Darktable or similar).
Is it possible?
What is the proper way?

I’m using Raspberry High Quality Cam IMX477, B01 Nano and Jetpack 4.6.
No hardware modifications (except R8 resistor removal on camera module).

hello lucomsky,

please refer to developer guide, you may see Applications Using V4L2 IOCTL Directly session to enable the V4L2 IOCTL to dump the Raw files.
you must assign the correct sensor resolution and correct pixel formats into the pipeline, please review the senor support formats as following,
i.e. $ v4l2-ctl -d /dev/video0 --list-formats-ext.
thanks

Hi @JerryChang !

I have no success with your recommendations.

My supported formats:

$ v4l2-ctl -d /dev/video0 --list-formats-ext
ioctl: VIDIOC_ENUM_FMT
        Index       : 0
        Type        : Video Capture
        Pixel Format: 'RG10'
        Name        : 10-bit Bayer RGRG/GBGB
                Size: Discrete 3840x2160
                        Interval: Discrete 0.033s (30.000 fps)
                Size: Discrete 1920x1080
                        Interval: Discrete 0.017s (60.000 fps)

Capturing with next command never ending:

$ v4l2-ctl --set-fmt-video=width=1920,height=1080,pixelformat=RG10 --stream-mmap --stream-count=1 -d /dev/video0 --stream-to=IMX477.raw

After CTRL-C I got this in dmesg output:

[260357.052400] ------------[ cut here ]------------
[260357.057122] WARNING: CPU: 1 PID: 15865 at /dvs/git/dirty/git-master_linux/kernel/kernel-4.9/drivers/media/v4l2-core/videobuf2-core.c:1664 __vb2_queue_cancel+0x11c/0x188
[260357.072231] Modules linked in: binfmt_misc fuse xt_conntrack ipt_MASQUERADE nf_nat_masquerade_ipv4 nf_conntrack_netlink nfnetlink xt_addrtype iptable_filter iptable_nat nf_conntrack_ipv4 nf_defrag_ipv4 nf_nat_ipv4 nf_nat nf_conntrack br_netfilter zram iwlmvm mac80211 bnep overlay btusb btrtl btbcm btintel userspace_alert iwlwifi cfg80211 nvgpu ip_tables x_tables

[260357.072604] CPU: 1 PID: 15865 Comm: v4l2-ctl Tainted: G        W       4.9.253-tegra #1
[260357.072619] Hardware name: NVIDIA Jetson Nano Developer Kit (DT)
[260357.072637] task: ffffffc074b04600 task.stack: ffffffc0c4c04000
[260357.072662] PC is at __vb2_queue_cancel+0x11c/0x188
[260357.072682] LR is at __vb2_queue_cancel+0x34/0x188
[260357.072701] pc : [<ffffff8008b2b45c>] lr : [<ffffff8008b2b374>] pstate: 60400045
[260357.072714] sp : ffffffc0c4c07ae0
[260357.072728] x29: ffffffc0c4c07ae0 x28: ffffffc074b04600 
[260357.072766] x27: ffffff8008f82000 x26: ffffffc0908feb40 
[260357.072800] x25: ffffffc0d4f68ae8 x24: ffffffc0f75a5598 
[260357.072834] x23: 0000000000000001 x22: ffffffc0f7b6b018 
[260357.072866] x21: ffffffc0f7027000 x20: ffffffc0f7b6b5d0 
[260357.072899] x19: ffffffc0f7b6b5d0 x18: 0000000000000001 
[260357.072931] x17: 0000000000000001 x16: 0000000000000000 
[260357.072963] x15: ffffffffffffffff x14: ffffffc0c4c07a00 
[260357.072995] x13: ffffffc0c4c07905 x12: 0000000000000000 
[260357.073027] x11: ffffffc0c4c078c0 x10: ffffffc0c4c078c0 
[260357.073060] x9 : ffffffc0c4c079c0 x8 : 0000000000000000 
[260357.073093] x7 : ffffffc07608e940 x6 : ffffffc0dd7cea41 
[260357.073125] x5 : ffffff800852d904 x4 : ffffffbf0375f390 
[260357.073158] x3 : 000000018040003d x2 : ffffffc0dd7cea40 
[260357.073189] x1 : ffffffc0f92780c0 x0 : 0000000000000004 

[260357.073234] ---[ end trace c9c0de22b73c3369 ]---
[260357.077957] Call trace:
[260357.077986] [<ffffff8008b2b45c>] __vb2_queue_cancel+0x11c/0x188
[260357.078011] [<ffffff8008b2c89c>] vb2_core_queue_release+0x2c/0x58
[260357.078034] [<ffffff8008b2ef1c>] _vb2_fop_release+0x84/0xa0
[260357.078062] [<ffffff8008b349f4>] tegra_channel_close+0x64/0x140
[260357.078089] [<ffffff8008b082e8>] v4l2_release+0x48/0xa0
[260357.078116] [<ffffff800825dcb8>] __fput+0x90/0x1d0
[260357.078140] [<ffffff800825de70>] ____fput+0x20/0x30
[260357.078167] [<ffffff80080d8dac>] task_work_run+0xbc/0xd8
[260357.078193] [<ffffff80080b8408>] do_exit+0x2e0/0xa88
[260357.078217] [<ffffff80080b8c40>] do_group_exit+0x40/0xa8
[260357.078243] [<ffffff80080c64ec>] get_signal+0xbc/0x750
[260357.078269] [<ffffff800808add8>] do_signal+0x130/0x500
[260357.078293] [<ffffff800808b320>] do_notify_resume+0x90/0xb0
[260357.078313] [<ffffff800808379c>] work_pending+0x8/0x10

What’s wrong?

P. S. I have no problem with GStreamer pipelines.

it’s known issue, please see-also Topic 165006.

It was mentioned in that issue that it should work on JP 4.6. But it is not!

Nothing is captured. I’m only getting these lines in dmesg output:

video4linux video0: frame start syncpt timeout!0

when executing

$ v4l2-ctl -d /dev/video0 --set-fmt-video=width=3840,height=2160,pixelformat=RG10 --set-ctrl bypass_mode=0 --stream-mmap --stream-count=100
$ dpkg-query --show nvidia-l4t-core
nvidia-l4t-core 32.6.1-20210726122000

How to fix that issue?

hello lucomsky,

we’ll arrange devices and check this again,
could you please check you’ve configure the CSI connector with Jetson-IO, you may select the compatible hardware as IMX477 for verification.
for example, $ sudo /opt/nvidia/jetson-io/jetson-io.py
please “Configure Jetson Nano CSI Connector” → “Configure for compatible hardware” → “Camera IMX477 Dual”
after that, please save the pin changes and reboot the system to apply the changes.
thanks

Hello JerryChang!

Sure, I have all configured as you mentioned with jetson-io.py.

we’ll gather the devices to confirm the issue locally, will update the results.

hello lucomsky,

could you please have a try to include below changes for IMX477,
for example,

diff --git a/drivers/media/i2c/imx477_mode_tbls.h b/drivers/media/i2c/imx477_mode_tbls.h
index 9e66a0e16..3978e42e4 100644
--- a/drivers/media/i2c/imx477_mode_tbls.h
+++ b/drivers/media/i2c/imx477_mode_tbls.h
@@ -29,6 +29,7 @@

 static const imx477_reg imx477_start[] = {
        {IMX477_STANDBY_REG, 0x1},
+       {IMX477_TABLE_WAIT_MS, IMX477_WAIT_MS*3},
        {IMX477_TABLE_END, 0x00}
 };

@@ -38,7 +39,9 @@ static const imx477_reg imx477_stop[] = {
 };

 static const imx477_reg imx477_mode_common[] = {
-       {IMX477_TABLE_WAIT_MS, IMX477_WAIT_MS},
+       /* software reset */
+       {0x0103, 0x01},
+       {IMX477_TABLE_WAIT_MS, IMX477_WAIT_MS*10},
        {0x0136, 0x18},
        {0x0137, 0x00},
        {0x0808, 0x02},

you may also refer to developer guide for the step for Building the NVIDIA Kernel.
thanks

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.