IMX219 Raw8 mode on the XavierNX: Disabling CRC

Geetings !

We currently trying to capture frames form the raspberry camera v2 in a RAW8 (RGGB) format. We managed to correctly capture frames using V4L2 on the Jetson Nano but we are facing issues with the XavierNX.

  • First, we edited to DT and Kernel to support RGGB based on this thread. In particular, we also edited the num-csi-lanes part as the following:
	tegra-camera-platform {
		compatible = "nvidia, tegra-camera-platform";
		num_csi_lanes = <0x02>;
		min_bits_per_pixel = <0x08>;
...
  • Our approach was validated on the Nano devkit, but we faced issues on the XavierNX production module because of CRC/ECC. Thus, we applied the patch discussed in this thread without success.

  • Next, we updated the camera rtcpu firmware directly, as discussed here. We also modified the csi5_fops.cbut the RAW8 capture still fails. Here is the camera bringup logs:

#
#                              _-----=> irqs-off
#                             / _----=> need-resched
#                            | / _---=> hardirq/softirq
#                            || / _--=> preempt-depth
#                            ||| /     delay
#           TASK-PID   CPU#  ||||    TIMESTAMP  FUNCTION
#              | |       |   ||||       |         |
     kworker/0:4-6649  [000] ....   103.183349: rtos_queue_peek_from_isr_failed: tstamp:3659668912 queue:0x0bcbcff8
     kworker/0:4-6649  [000] ....   103.351335: rtos_queue_peek_from_isr_failed: tstamp:3664668907 queue:0x0bcbcff8
     kworker/0:4-6649  [000] ....   103.463255: rtos_queue_peek_from_isr_failed: tstamp:3669668908 queue:0x0bcbcff8
     kworker/0:4-6649  [000] ....   103.631234: rtos_queue_peek_from_isr_failed: tstamp:3674668904 queue:0x0bcbcff8
     kworker/0:4-6649  [000] ....   103.799259: rtos_queue_peek_from_isr_failed: tstamp:3679668929 queue:0x0bcbcff8
     kworker/0:4-6649  [000] ....   103.967215: rtos_queue_peek_from_isr_failed: tstamp:3684668904 queue:0x0bcbcff8
     kworker/0:4-6649  [000] ....   104.135158: rtos_queue_peek_from_isr_failed: tstamp:3689668904 queue:0x0bcbcff8
     kworker/0:4-6649  [000] ....   104.303221: rtos_queue_peek_from_isr_failed: tstamp:3694668921 queue:0x0bcbcff8
     kworker/0:4-6649  [000] ....   104.471108: rtos_queue_peek_from_isr_failed: tstamp:3699668909 queue:0x0bcbcff8
     kworker/0:4-6649  [000] ....   104.583110: rtos_queue_peek_from_isr_failed: tstamp:3704668904 queue:0x0bcbcff8
     kworker/0:4-6649  [000] ....   104.751181: rtos_queue_peek_from_isr_failed: tstamp:3709668913 queue:0x0bcbcff8
     kworker/0:4-6649  [000] ....   104.919069: rtos_queue_peek_from_isr_failed: tstamp:3714668907 queue:0x0bcbcff8
     kworker/0:4-6649  [000] ....   105.087033: rtos_queue_peek_from_isr_failed: tstamp:3719668917 queue:0x0bcbcff8
     kworker/0:4-6649  [000] ....   105.255029: rtos_queue_peek_from_isr_failed: tstamp:3724668905 queue:0x0bcbcff8
     kworker/0:4-6649  [000] ....   105.422990: rtos_queue_peek_from_isr_failed: tstamp:3729668907 queue:0x0bcbcff8
     kworker/0:4-6649  [000] ....   105.590994: rtos_queue_peek_from_isr_failed: tstamp:3734668913 queue:0x0bcbcff8
     kworker/0:4-6649  [000] ....   105.702950: rtos_queue_peek_from_isr_failed: tstamp:3739668908 queue:0x0bcbcff8
     kworker/0:4-6649  [000] ....   105.870969: rtos_queue_peek_from_isr_failed: tstamp:3744668905 queue:0x0bcbcff8
     kworker/0:4-6649  [000] ....   106.038923: rtos_queue_peek_from_isr_failed: tstamp:3749668905 queue:0x0bcbcff8
     kworker/0:4-6649  [000] ....   106.206944: rtos_queue_peek_from_isr_failed: tstamp:3754668910 queue:0x0bcbcff8
     kworker/0:4-6649  [000] ....   106.375168: rtos_queue_peek_from_isr_failed: tstamp:3759668926 queue:0x0bcbcff8
     kworker/0:4-6649  [000] ....   106.542944: rtos_queue_peek_from_isr_failed: tstamp:3764668903 queue:0x0bcbcff8
     kworker/0:4-6649  [000] ....   106.710844: rtos_queue_peek_from_isr_failed: tstamp:3769668918 queue:0x0bcbcff8
     kworker/0:4-6649  [000] ....   106.822862: rtos_queue_peek_from_isr_failed: tstamp:3774668907 queue:0x0bcbcff8
     kworker/0:4-6649  [000] ....   106.990841: rtos_queue_peek_from_isr_failed: tstamp:3779668908 queue:0x0bcbcff8
     kworker/0:4-6649  [000] ....   107.158794: rtos_queue_peek_from_isr_failed: tstamp:3784668908 queue:0x0bcbcff8
     kworker/0:4-6649  [000] ....   107.326787: rtos_queue_peek_from_isr_failed: tstamp:3789668912 queue:0x0bcbcff8
     kworker/0:4-6649  [000] ....   107.494755: rtos_queue_peek_from_isr_failed: tstamp:3794668908 queue:0x0bcbcff8
     kworker/0:4-6649  [000] ....   107.662742: rtos_queue_peek_from_isr_failed: tstamp:3799668909 queue:0x0bcbcff8
     kworker/0:4-6649  [000] ....   107.830728: rtos_queue_peek_from_isr_failed: tstamp:3804668909 queue:0x0bcbcff8
     kworker/0:4-6649  [000] ....   107.942711: rtos_queue_peek_from_isr_failed: tstamp:3809668912 queue:0x0bcbcff8
     kworker/0:4-6649  [000] ....   108.110711: rtos_queue_peek_from_isr_failed: tstamp:3814668904 queue:0x0bcbcff8
     kworker/0:4-6649  [000] ....   108.278708: rtos_queue_peek_from_isr_failed: tstamp:3819668920 queue:0x0bcbcff8
     kworker/0:4-6649  [000] ....   108.446653: rtos_queue_peek_from_isr_failed: tstamp:3824668910 queue:0x0bcbcff8
     kworker/0:4-6649  [000] ....   108.614629: rtos_queue_peek_from_isr_failed: tstamp:3829668909 queue:0x0bcbcff8
     kworker/0:4-6649  [000] ....   108.726625: rtos_queue_peek_from_isr_failed: tstamp:3833621617 queue:0x0bcbcff8
        v4l2-ctl-7752  [003] ....   135.915781: tegra_channel_open: vi-output, imx219 9-0010
        v4l2-ctl-7752  [000] ....   135.918212: tegra_channel_set_power: imx219 9-0010 : 0x1
        v4l2-ctl-7752  [000] ....   135.918229: camera_common_s_power: status : 0x1
        v4l2-ctl-7752  [000] ....   135.941414: tegra_channel_set_power: 15a00000.nvcsi--2 : 0x1
        v4l2-ctl-7752  [000] ....   135.941433: csi_s_power: enable : 0x1
        v4l2-ctl-7752  [000] ....   135.960975: tegra_channel_capture_setup: vnc_id 0 W 3264 H 2464 fmt 5
        v4l2-ctl-7752  [001] ....   135.969367: tegra_channel_close: vi-output, imx219 9-0010
        v4l2-ctl-7752  [001] ....   135.972841: tegra_channel_set_power: imx219 9-0010 : 0x0
        v4l2-ctl-7752  [001] ....   135.972856: camera_common_s_power: status : 0x0
        v4l2-ctl-7752  [001] ....   135.973001: tegra_channel_set_power: 15a00000.nvcsi--2 : 0x0
        v4l2-ctl-7752  [001] ....   135.973004: csi_s_power: enable : 0x0
     kworker/0:4-6649  [000] ....   135.997045: rtos_queue_peek_from_isr_failed: tstamp:4685555334 queue:0x0bcbcff8
     kworker/0:4-6649  [000] ....   135.997064: rtcpu_start: tstamp:4685557046
     kworker/0:4-6649  [000] ....   135.997073: rtos_queue_send_from_isr_failed: tstamp:4685583943 queue:0x0bcb4278
     kworker/0:4-6649  [000] ....   135.997074: rtos_queue_send_from_isr_failed: tstamp:4685584093 queue:0x0bcb8ae0
     kworker/0:4-6649  [000] ....   135.997120: rtos_queue_send_from_isr_failed: tstamp:4685584244 queue:0x0bcba660
     kworker/0:4-6649  [000] ....   135.997122: rtos_queue_send_from_isr_failed: tstamp:4685584407 queue:0x0bcbb420
     kworker/0:4-6649  [000] ....   135.997124: rtos_queue_send_from_isr_failed: tstamp:4685584552 queue:0x0bcbc1e0
     kworker/0:4-6649  [000] ....   136.165005: rtos_queue_peek_from_isr_failed: tstamp:4690555875 queue:0x0bcbcff8
     kworker/0:4-6649  [000] ....   136.332986: rtos_queue_peek_from_isr_failed: tstamp:4695555880 queue:0x0bcbcff8
     kworker/0:4-6649  [000] ....   136.444980: rtos_queue_peek_from_isr_failed: tstamp:4700555870 queue:0x0bcbcff8
     kworker/0:4-6649  [000] ....   136.613013: rtos_queue_peek_from_isr_failed: tstamp:4705555874 queue:0x0bcbcff8
     kworker/0:4-6649  [000] ....   136.781076: rtos_queue_peek_from_isr_failed: tstamp:4710555876 queue:0x0bcbcff8
     kworker/0:4-6649  [000] ....   136.948991: rtos_queue_peek_from_isr_failed: tstamp:4715555871 queue:0x0bcbcff8
     kworker/0:4-6649  [000] ....   137.117011: rtos_queue_peek_from_isr_failed: tstamp:4720555874 queue:0x0bcbcff8
     kworker/0:4-6649  [000] ....   137.285046: rtos_queue_peek_from_isr_failed: tstamp:4725555880 queue:0x0bcbcff8
     kworker/0:4-6649  [000] ....   137.452960: rtos_queue_peek_from_isr_failed: tstamp:4730555875 queue:0x0bcbcff8
     kworker/0:4-6649  [000] ....   137.564975: rtos_queue_peek_from_isr_failed: tstamp:4735555893 queue:0x0bcbcff8
     kworker/0:4-6649  [000] ....   137.732997: rtos_queue_peek_from_isr_failed: tstamp:4740555876 queue:0x0bcbcff8
     kworker/0:4-6649  [000] ....   137.900968: rtos_queue_peek_from_isr_failed: tstamp:4745555876 queue:0x0bcbcff8
     kworker/0:4-6649  [000] ....   138.068920: rtos_queue_peek_from_isr_failed: tstamp:4750555876 queue:0x0bcbcff8
     kworker/0:4-6649  [000] ....   138.236912: rtos_queue_peek_from_isr_failed: tstamp:4755555880 queue:0x0bcbcff8
     kworker/0:4-6649  [000] ....   138.404941: rtos_queue_peek_from_isr_failed: tstamp:4760555876 queue:0x0bcbcff8
     kworker/0:4-6649  [000] ....   138.572911: rtos_queue_peek_from_isr_failed: tstamp:4765555879 queue:0x0bcbcff8
     kworker/0:4-6649  [000] ....   138.684891: rtos_queue_peek_from_isr_failed: tstamp:4770555872 queue:0x0bcbcff8
     kworker/0:4-6649  [000] ....   138.853001: rtos_queue_peek_from_isr_failed: tstamp:4775555885 queue:0x0bcbcff8
     kworker/0:4-6649  [000] ....   139.020935: rtos_queue_peek_from_isr_failed: tstamp:4780555879 queue:0x0bcbcff8
     kworker/0:4-6649  [000] ....   139.188885: rtos_queue_peek_from_isr_failed: tstamp:4785555880 queue:0x0bcbcff8
     kworker/0:4-6649  [000] ....   139.356898: rtos_queue_peek_from_isr_failed: tstamp:4790555879 queue:0x0bcbcff8
     kworker/0:4-6649  [000] ....   139.524871: rtos_queue_peek_from_isr_failed: tstamp:4795555880 queue:0x0bcbcff8
     kworker/0:4-6649  [000] ....   139.692864: rtos_queue_peek_from_isr_failed: tstamp:4800555872 queue:0x0bcbcff8
     kworker/0:4-6649  [000] ....   139.804890: rtos_queue_peek_from_isr_failed: tstamp:4805555876 queue:0x0bcbcff8
     kworker/0:4-6649  [000] ....   139.972853: rtos_queue_peek_from_isr_failed: tstamp:4810555877 queue:0x0bcbcff8
     kworker/0:4-6649  [000] ....   140.140861: rtos_queue_peek_from_isr_failed: tstamp:4815555894 queue:0x0bcbcff8
     kworker/0:4-6649  [000] ....   140.308837: rtos_queue_peek_from_isr_failed: tstamp:4820555876 queue:0x0bcbcff8
     kworker/0:4-6649  [000] ....   140.476830: rtos_queue_peek_from_isr_failed: tstamp:4825555876 queue:0x0bcbcff8
     kworker/0:4-6649  [000] ....   140.644873: rtos_queue_peek_from_isr_failed: tstamp:4830555879 queue:0x0bcbcff8
     kworker/0:4-6649  [000] ....   140.812852: rtos_queue_peek_from_isr_failed: tstamp:4835555872 queue:0x0bcbcff8
     kworker/0:4-6649  [000] ....   140.924831: rtos_queue_peek_from_isr_failed: tstamp:4840555868 queue:0x0bcbcff8
     kworker/0:4-6649  [000] ....   141.092864: rtos_queue_peek_from_isr_failed: tstamp:4845555879 queue:0x0bcbcff8
     kworker/0:4-6649  [000] ....   141.260827: rtos_queue_peek_from_isr_failed: tstamp:4850555878 queue:0x0bcbcff8
     kworker/0:4-6649  [000] ....   141.428805: rtos_queue_peek_from_isr_failed: tstamp:4855555875 queue:0x0bcbcff8
     kworker/0:4-6649  [000] ....   141.596796: rtos_queue_peek_from_isr_failed: tstamp:4860555874 queue:0x0bcbcff8
     kworker/0:4-6649  [000] ....   141.764803: rtos_queue_peek_from_isr_failed: tstamp:4865555879 queue:0x0bcbcff8
     kworker/0:4-6649  [000] ....   141.764811: rtos_queue_peek_from_isr_failed: tstamp:4865582205 queue:0x0bcbcff8

The kernel log refers to a vi_capture_setup error:

[  135.965661] tegra194-vi5 15c10000.vi: vi_capture_setup: control failed, errno 2
[  135.965917] tegra194-vi5 15c10000.vi: vi capture setup failed

Any hint on what is going wrong there ? @ShaneCCC ???

Thanks,
K

PS: We’re using Jetpack 4.6.1 …

The trace log shows didn’t receive any validate data from the bus. Could you confirm by the RAW10 to confirm the CSI/VI configure.

It might come from the updated version of the camera rtcpu firmware:
I have the same errors using the original kernel image (RAW10) + the original dtb (RAW10) + updated camera-rtcpu-rce

It’s could be possible. What’s your version? The firmware should be for 32.4.x only.

Thanks for your reply. Based on your feedback, we reproduced all our works on JP 4.4.1, with the updated firmware. Here are the results:

  • RTCPU (CRC removal) + original DTB + kernel (CRC removal):
    V4L2 capture success on RAW10 format
[  594.312061] [RCE] vi5_hwinit: firmware CL2018101701 protocol version 2.2                               
[  594.312074] [RCE] error config mask = 3                                                                
[  594.312083] [RCE] nvcsi_stream_apply_error_config stream_intr_mask ECC/CRC = 3                         
[  594.537319] [RCE] error config mask = e59ff018                                                         
[  594.537415] [RCE] nvcsi_stream_apply_error_config stream_intr_mask ECC/CRC = 0                         
[  596.552039] [RCE] error config mask = 3                                                                
[  596.552057] [RCE] nvcsi_stream_apply_error_config stream_intr_mask ECC/CRC = 3                         
[  596.776251] [RCE] error config mask = e59ff018                                                         
[  596.776305] [RCE] nvcsi_stream_apply_error_config stream_intr_mask ECC/CRC = 0                         
[  598.292130] [RCE] error config mask = 3                                                                
[  598.292162] [RCE] nvcsi_stream_apply_error_config stream_intr_mask ECC/CRC = 3                         
[  598.516387] [RCE] error config mask = e59ff018                                                         
[  598.516460] [RCE] nvcsi_stream_apply_error_config stream_intr_mask ECC/CRC = 0  
  • RTCPU (CRC removal) + updated DTB (RAW8 support) + updated kernel (CRC removal + RAW8 support):
    V4L2 capture failure on RAW8 format + Kernel panic
[  140.190829] [RCE] vi5_hwinit: firmware CL2018101701 protocol version 2.2
[  140.190843] [RCE] error config mask = 3
[  140.190855] [RCE] nvcsi_stream_apply_error_config stream_intr_mask ECC/CRC = 3
[  140.302539] tegra194-vi5 15c10000.vi: corr_err: discarding frame 1, flags: 32, err_data 162
[  140.340772] tegra194-vi5 15c10000.vi: corr_err: discarding frame 2, flags: 0, err_data 131072
[  140.387936] tegra194-vi5 15c10000.vi: corr_err: discarding frame 3, flags: 0, err_data 512
[  140.395609] tegra194-vi5 15c10000.vi: corr_err: discarding frame 0, flags: 32, err_data 162
[  140.444138] tegra194-vi5 15c10000.vi: corr_err: discarding frame 0, flags: 32, err_data 162
[  140.449012] tegra194-vi5 15c10000.vi: corr_err: discarding frame 0, flags: 0, err_data 262144
[  140.482383] tegra194-vi5 15c10000.vi: corr_err: discarding frame 0, flags: 0, err_data 262144
[  140.529551] tegra194-vi5 15c10000.vi: corr_err: discarding frame 6, flags: 0, err_data 512
[  140.538500] tegra194-vi5 15c10000.vi: corr_err: discarding frame 0, flags: 32, err_data 162
[  140.587618] tegra194-vi5 15c10000.vi: corr_err: discarding frame 0, flags: 32, err_data 162
[  140.592592] tegra194-vi5 15c10000.vi: corr_err: discarding frame 8, flags: 0, err_data 262144
[  140.714290] CPU:0, Error:RCE-NOC@0xbe00000,irq=483
[  140.714417] **************************************
[  140.714503] * For more Internal Decode Help
[  140.714576] * 	http://nv/cbberr
[  140.714634] * NVIDIA userID is required to access
[  140.714715] **************************************
[  140.714798] CPU:0, Error:RCE-NOC
[  140.714858]     Error Logger   	 : 1
[  140.714923]     ErrLog0   		 : 0x80030600
[  140.714991]       Transaction Type    : RD  - Read, Incrementing
[  140.715093]       Error Code   	 : TMO
[  140.715161]       Error Source   	 : Target NIU
[  140.715236]       Error Description    : Target time-out error
[  140.715327]       Packet header Lock    : 0
[  140.715388]       Packet header Len1    : 3
[  140.715451]       NOC protocol version    : version >= 2.7
[  140.715536]     ErrLog1   		 : 0x157600
[  140.715725]     ErrLog2   		 : 0x0
[  140.715965]       RouteId   	 : 0x157600
[  140.716209]       InitFlow   	 : cpu_p_i/I/0
[  140.716507]       Targflow   	 : cbb_t/T/0
[  140.716786]       TargSubRange   	 : 27
[  140.717031]       SeqId   		 : 0
[  140.717265]     ErrLog3   		 : 0x5e44004
[  140.717509]     ErrLog4   		 : 0x0
[  140.719932]       Address   	 : 0x15e44004 (unknown device)
[  140.725058]     ErrLog5   		 : 0x387e31
[  140.728039]       Master ID   	 : RCE
[  140.731446]       Security Group(GRPSEC): 0x3f
[  140.735214]       Cache   		 : 0x1 -- Device
[  140.739234]       Protection   	 : 0x3 -- Privileged, Non-Secure, Data Access
[  140.745884]       FALCONSEC   	 : 0x0
[  140.749031]       Virtual Queuing Channel(VQC): 0x0
[  140.753501]     **************************************

The trace logs show CORRECTABLE_ERR:

kworker/0:0-4     [000] ....   124.038180: rtcpu_nvcsi_intr: tstamp:4185331872 class:CORRECTABLE_ERR type:PHY_INTR phy:1 cil:0 st:0 vc:0 status:0x00000110
kworker/0:0-4     [000] ....   124.038180: rtcpu_nvcsi_intr: tstamp:4185332719 class:GLOBAL type:STREAM_VC phy:0 cil:0 st:2 vc:0 status:0x00000004
kworker/0:0-4     [000] ....   124.038180: rtcpu_nvcsi_intr: tstamp:4185332719 class:GLOBAL type:PHY_INTR0 phy:1 cil:0 st:0 vc:0 status:0x00000110
kworker/0:0-4     [000] ....   124.038180: rtcpu_nvcsi_intr: tstamp:4185332719 class:CORRECTABLE_ERR type:PHY_INTR phy:1 cil:0 st:0 vc:0 status:0x00000110
kworker/0:0-4     [000] ....   124.038181: rtcpu_nvcsi_intr: tstamp:4185333580 class:GLOBAL type:PHY_INTR0 phy:1 cil:0 st:0 vc:0 status:0x00000110
kworker/0:0-4     [000] ....   124.038181: rtcpu_nvcsi_intr: tstamp:4185333580 class:CORRECTABLE_ERR type:STREAM_VC phy:0 cil:0 st:2 vc:0 status:0x00000004

Looks like an issue with the camera rtcpu firmware, is there any way to check ?

Thanks,
K

Update: running the camera bringup just after the boot seems to solve the problem:

echo 1 > /sys/kernel/debug/bpmp/debug/clk/vi/mrq_rate_locked
echo 1 > /sys/kernel/debug/bpmp/debug/clk/isp/mrq_rate_locked
echo 1 > /sys/kernel/debug/bpmp/debug/clk/nvcsi/mrq_rate_locked
cat /sys/kernel/debug/bpmp/debug/clk/vi/max_rate    | tee /sys/kernel/debug/bpmp/debug/clk/vi/rate
cat /sys/kernel/debug/bpmp/debug/clk/isp/max_rate   | tee  /sys/kernel/debug/bpmp/debug/clk/isp/rate
cat /sys/kernel/debug/bpmp/debug/clk/nvcsi/max_rate | tee /sys/kernel/debug/bpmp/debug/clk/nvcsi/rate

I thought these commands were only for debug purposes, but they have an effect on the capture:

v4l2-ctl --set-fmt-video=width=3264,height=2464,pixelformat=RGGB --set-ctrl=bypass_mode=0,sensor_mode=0 --stream-mmap --stream-count=100
<<<<<<<<<<<<<<<<<<<<<<< 21.35 fps
<<<<<<<<<<<<<<<<<<<<< 21.28 fps
<<<<<<<<<<<<<<<<<<<<< 21.19 fps
<<<<<<<<<<<<<<<<<<<<< 21.19 fps
[   93.624036] [RCE] vi5_hwinit: firmware CL2018101701 protocol version 2.2
[   93.624044] [RCE] error config mask = 3
[   93.624048] [RCE] nvcsi_stream_apply_error_config stream_intr_mask ECC/CRC = 3
[   93.960031] [RCE] error config mask = e59ff018
[   93.960045] [RCE] nvcsi_stream_apply_error_config stream_intr_mask ECC/CRC = 0

Am I getting this right ?

K

Increase the pix_clk_hz or add serdes_pix_clk_hz to acquire more clocks if boost the clocks help on your case.

Thanks for help @ShaneCCC. Adding the serdes_pic_clk stabilizes the capture.
btw, is their any chance to have a camera-rtcpu-firmware for recent versions of JP (>4.5) ? This would be a great upgread for us.

Have a try this attached on J4.6 can’t tell if working with J4.5 or not.

camera-rtcpu-rce.img (261.6 KB)

1 Like