当我尝试使用 imx8mp isi 平台制作输出 raw12 数据的相机时遇到问题。
yocto 分支是 kirkstone,内核标签是:lf-5.15.y
请找到我为调试功能而制定的附件补丁。
首先,我在imx8-mipi-csi2-sam.c中的find_csis_format中强制使用mipi_csis_formats[0],然后csi/gasket寄存器将根据MIPI_CSIS_ISPCFG_FMT_YCBCR422_8BIT进行配置。当我运行“v4l2-ctl -d /dev/video2 --set-fmt-video=width=3840,height=2160,pixelformat=BG12 --stream-mmap”时,csi 中断和 isi 中断都被很好地触发了没有csi中断报的ecc/crc之类的错误。应用程序运行良好,isi 中断报告状态 0x60020100(bit29 显示帧被正确接收并触发中断,bit 17 报告 vsync 比专家更早(因为相机输出 raw12 数据和 isi 期待 yuv 数据,所以帧长度不一样)。
根据 MIPI_CSIS_ISPCFG_FMT_RAW12 配置 csi/gasket 时,应用程序卡在以下发现中:
1. gasket register report some pixels sent out to ISI (0x32ec007c: 0x0000FB40 and does not increase). 它应该在正常情况下增加。
2. 垫圈寄存器报告没有发送到 ISI 的行(0x32ec0080:00000000 并且不增加)。它应该在正常情况下增加。
3. csi 寄存器报告一帧发送给 ISI(0x32e40100:00000001 并且不增加)。它应该在正常情况下增加。
4. csi register report no dphy error (0x32e40020: 00000000)。
5. csi register report no csi error but data overflow (0x32e40014: 00000010). 看起来 ISI 没有处理来自 csi 的数据,csi 数据被卡住发送给 ISI。
6. isi register report no interrupt is triggered(添加代码在isi中断触发时打印一些东西,但没有打印任何信息)。
下面是在运行 'v4l2-ctl -d /dev/video2 --set-fmt-video=width=3840,height=2160,pixelformat=BG12 --stream-mmap &' 期间使用 memtool 转储的寄存器
$ /unit_tests/memtool 0x32e00000 0x28
chnl_ctrl[0x00] e2000000 bit[25]: 2 line buffers chained (supports 4096 horizontal resolu
tion).
chnl_img_ctrl[0x04] 0f000001 [29:24] 001111b - raw16 - 16-bit raw data packed into 32-bit dword,认为进来的数据是raw16
chnl_out_buf_ctrl[0x08] 0007c707 [15:14] load buffer 2/1 address from chnlout_buf1_addr_* registers (正常时此值来回跳动)
chnl_img_cfg[0x0c] 08700f00 (2160x3840)
chnl_ier[0x10] 3cfc0000
chnl_sts[0x14] 40000100 bit[9:8]: current frame being stored in buffer 2/1 address (正常时此值来回跳动) bit[30] new line received
chnl_scale_factor[0x18] 10001000
chnl_scale_offset[0x1c] 00000000
chnl_crop_ulc[0x20] 00000000
chnl_crop_lrc[0x24] 00000000
chnl_csc_coeff0[0x28] 00000000
chnl_csc_coeff1[0x2c] 00000000
chnl_csc_coeff2[0x30] 00000000
chnl_csc_coeff3[0x34] 00000000
chnl_csc_coeff4[0x38] 00000000
chnl_csc_coeff5[0x3c] 00000000
chnl_roi_0_alpha[0x40] 00000000
chnl_roi_0_ulc[0x44] 00000000
chnl_roi_0_lrc[0x48] 00000000
chnl_roi_1_alpha[0x4c] 00000000
chnl_roi_1_ulc[0x50] 00000000
chnl_roi_1_lrc[0x54] 00000000
chnl_roi_2_alpha[0x58] 00000000
chnl_roi_2_ulc[0x5c] 00000000
chnl_roi_2_lrc[0x60] 00000000
chnl_roi_3_alpha[0x64] 00000000
chnl_roi_3_ulc[0x68] 00000000
chnl_roi_3_lrc[0x6c] 00000000
chnl_out_buf1_addr_y[0x70] d7f00000 每次可能会变化
chnl_out_buf1_addr_u[0x74] 00000000
chnl_out_buf1_addr_v[0x78] 00000000
chnl_out_buf_pitch[0x7c] 00001e00 (7680) = width(3840) * depth(16) / 8. depth设定很重要,16位对齐
chnl_in_buf_addr[0x80] 00000000
chnl_in_buf_pitch[0x84] 00000000
chnl_mem_rd_ctrl[0x88] 00000000
chnl_out_buf2_addr_y[0x8c] d6f00000 每次可能会变化
chnl_out_buf2_addr_u[0x90] 00000000
chnl_out_buf2_addr_v[0x94] 00000000
chnl_scl_img_cfg[0x98] 04380780
chnl_flow_ctrl[0x9c] 00000000
$ /unit_tests/memtool 0x32e40000 0x20
register yuyv raw12
csis_version[0] 03060301 03060301
csis_cmn_ctrl[4] 00004b05 00004b05
csis_clk_ctrl[8] 000f0000 000f0000 bit[4] 0-pixel clock is always alive, 1-pixel clock is alive during the interval of frame
csis_intmsk[10] 0fffff1f 0fffff1f
csis_intsrc[14] 00000000 00000010 正常情况为0,偶尔也能读到错误
csis_dphystatus[20] 000000f0 000000f0 bit[7-4]: data lane [3:0] is in stop state
csis_dphyctrl[24] 1300001f 1300001f bit[23:22] - clksettle. 2'b0x - 110ns to 280ns (v0.87 to v1.00) bit[31:24]: hssettle
csis_dphybctrl_l[30] 000001f4 000001f4
csis_dphybctrl_h[34] 00000000 00000000
csis_dphysctrl_l[38] 00000000 00000000
csis_dphysctrl_h[3c] 00000000 00000000
csis_ispconfig_ch0[40] 00001078 000020B0 不同
csis_ispresol_ch0[44] 08700f00 08700f00 (2160x3840)
csis_ispsync_ch0[48] 00000000 00000000 bit[23-18]: Interval between last falling of DVALID and falling of HSync (cycle of Pixel clock)
csis_ispconfig_ch1[50] 000008fd 000008fd
csis_ispresol_ch1[54] 80008000 80008000
csis_ispsync_ch1[58] 00000000 00000000
csis_ispconfig_ch2[60] 000008fe 000008fe
csis_ispsync_ch2[68] 00000000 00000000
csis_ispresol_ch2[64] 80008000 80008000
csis_ispconfig_ch3[70] 000008ff 000008ff
csis_ispresol_ch3[74] 80008000 80008000
csis_ispsync_ch3[78] 00000000 00000000
$ /unit_tests/memtool 0x32ec0060 3
register yuyv raw12
GPR_GASKET_0_CTRL[60] 00001E03 00002C01 bit[15:8] 1E: yuyv, 2C: raw12
GPR_GASKET_0_HSIZE[64] 00000F00 00000F00 3840
GPR_GASKET_0_VSIZE[68] 00000870 00000870 2160
我检查了 nxp 社区中的许多线程,但没有找到解决方案。
请告知如何配置 csi/gasket/isp 寄存器,以便我可以在 imx8mp isi 系统上输出 raw12 数据。