(TC358748)并行至CSI2视频桥接器出现故障 你好, 我正在做一个项目,需要将 FPGA 连接到我们定制的 i.MX8MP 板。我正在尝试修改 tc358746(并行 -> CSI2)驱动程序,以支持我们的 yocto lf-5.15.71 版本。 我希望视频管道(FPGA (YUV4:2:2) -> bridge (YUV4:2:2/4-lane) -> mipi_csi0 -> isi0)目前以 YUV4:2:2 格式输出 1920x1080@30Hz,但我无法使用 Gstreamer 或 v4l2-ctl 捕获任何帧。 v4l-subdev1 不会出现在 v4l2 设备列表中。 请查看网桥的 media-ctl 输出和 dmesg 日志,非常感谢您能提供任何故障排除方面的见解。 root@:~$ media-ctl -p
Media controller API version 5.15.71
Media device information
------------------------
driver mxc-md
model FSL Capture Media Device
serial
bus info
hw revision 0x0
driver version 5.15.71
Device topology
- entity 1: mxc_isi.0 (16 pads, 2 links)
type V4L2 subdev subtype Unknown flags 0
pad0: Sink
<- "mxc-mipi-csi2.0":4 [ENABLED]
pad1: Sink
pad2: Sink
pad3: Sink
pad4: Sink
pad5: Sink
pad6: Sink
pad7: Sink
pad8: Sink
pad9: Sink
pad10: Sink
pad11: Sink
pad12: Source
-> "mxc_isi.0.capture":0 [ENABLED]
pad13: Source
pad14: Source
pad15: Sink
- entity 18: mxc_isi.0.capture (1 pad, 1 link)
type Node subtype V4L flags 0
device node name /dev/video2
pad0: Sink
<- "mxc_isi.0":12 [ENABLED]
- entity 22: mxc-mipi-csi2.0 (8 pads, 2 links)
type Node subtype V4L flags 0
device node name /dev/v4l-subdev0
pad0: Sink
<- "tc358748 2-000e":0 [ENABLED,IMMUTABLE]
pad1: Sink
pad2: Sink
pad3: Sink
pad4: Source
-> "mxc_isi.0":0 [ENABLED]
pad5: Source
pad6: Source
pad7: Source
- entity 31: tc358748 2-000e (1 pad, 1 link)
type V4L2 subdev subtype Unknown flags 0
device node name /dev/v4l-subdev1
pad0: Source
[fmt:UYVY8_2X8/1920x1080@1/30 field:none colorspace:srgb]
-> "mxc-mipi-csi2.0":0 [ENABLED,IMMUTABLE] root@:~$ v4l2-ctl --list-devices
():
/dev/v4l-subdev0
mxc-isi-cap (platform:32e00000.isi:cap_devic):
/dev/video2
FSL Capture Media Device (platform:mxc-md):
/dev/media0
vsi_v4l2dec (platform:vsi_v4l2dec):
/dev/video1
vsi_v4l2enc (platform:vsi_v4l2enc):
/dev/video0 root@:~$ v4l2-ctl --device /dev/video2 --list-formats-ext
ioctl: VIDIOC_ENUM_FMT
Type: Video Capture Multiplanar
[3]: 'YUYV' (YUYV 4:2:2)
Size: Discrete 1920x1080
Interval: Discrete 0.033s (30.000 fps)
Interval: Discrete 0.033s (30.000 fps) root@:~$ v4l2-ctl -d /dev/video2 --all
Driver Info:
Driver name : mxc-isi-cap
Card type : mxc-isi-cap
Bus info : platform:32e00000.isi:cap_devic
Driver version : 5.15.71
Capabilities : 0x84201000
Video Capture Multiplanar
Streaming
Extended Pix Format
Device Capabilities
Device Caps : 0x04201000
Video Capture Multiplanar
Streaming
Extended Pix Format
Media Driver Info:
Driver name : mxc-md
Model : FSL Capture Media Device
Serial :
Bus info :
Media version : 5.15.71
Hardware revision: 0x00000000 (0)
Driver version : 5.15.71
Interface Info:
ID : 0x03000014
Type : V4L Video
Entity Info:
ID : 0x00000012 (18)
Name : mxc_isi.0.capture
Function : V4L2 I/O
Pad 0x01000013 : 0: Sink
Link 0x02000021: from remote pad 0x100000e of entity 'mxc_isi.0' (Video Pixel Formatter): Data, Enabled
Priority: 2
Format Video Capture Multiplanar:
Width/Height : 1920/1080
Pixel Format : 'RGBP' (16-bit RGB 5-6-5)
Field : None
Number of planes : 1
Flags :
Colorspace : sRGB
Transfer Function : Default
YCbCr/HSV Encoding: ITU-R 601
Quantization : Full Range
Plane 0 :
Bytes per Line : 3840
Size Image : 4147200
Crop Capability Video Output:
Bounds : Left 0, Top 0, Width 1920, Height 1080
Default : Left 0, Top 0, Width 1920, Height 1080
Pixel Aspect: 1/1
Selection Video Output: compose, Left 0, Top 0, Width 1920, Height 1080, Flags:
Selection Video Output: compose_default, Left 0, Top 0, Width 1920, Height 1080, Flags:
Selection Video Output: compose_bounds, Left 0, Top 0, Width 1920, Height 1080, Flags:
Streaming Parameters Video Capture:
Capabilities : timeperframe
Frames per second: 30.000 (30/1)
Read buffers : 0
User Controls
horizontal_flip 0x00980914 (bool) : default=0 value=0
vertical_flip 0x00980915 (bool) : default=0 value=0
alpha_component 0x00980929 (int) : min=0 max=255 step=1 default=0 value=0 [ 15.547696] tc358748 2-000e: tc358748_get_pad_format code=0x2006, w/h=(1920,1080), colorspace=8, field=1
[ 26.966015] tc358748 2-000e: tc358748_get_pad_format code=0x2006, w/h=(1920,1080), colorspace=8, field=1
.
.
.
[ 26.968164] tc358748 2-000e: tc358748_get_pad_format code=0x2006, w/h=(1920,1080), colorspace=8, field=1
[ 26.968181] tc358748 2-000e: tc358748_get_pad_format code=0x2006, w/h=(1920,1080), colorspace=8, field=1
[ 26.968195] tc358748 2-000e: tc358748_get_pad_format code=0x2006, w/h=(1920,1080), colorspace=8, field=1
[ 26.968210] tc358748 2-000e: tc358748_get_pad_format code=0x2006, w/h=(1920,1080), colorspace=8, field=1
[ 26.971188] mxc_isi.0: Not match format, set default
[ 26.971199] mxc_isi.0: Not match format, set default
[ 27.305025] tc358748 2-000e: tc358748_get_pad_format code=0x2006, w/h=(1920,1080), colorspace=8, field=1
[ 27.305150] tc358748 2-000e: tc358748_get_pad_format code=0x2006, w/h=(1920,1080), colorspace=8, field=1
[ 27.305352] tc358748 2-000e: tc358748_get_pad_format code=0x2006, w/h=(1920,1080), colorspace=8, field=1
[ 27.305392] tc358748 2-000e: tc358748_get_pad_format code=0x2006, w/h=(1920,1080), colorspace=8, field=1
[ 27.305442] tc358748 2-000e: tc358748_get_pad_format code=0x2006, w/h=(1920,1080), colorspace=8, field=1
[ 27.305507] tc358748 2-000e: tc358748_get_pad_format code=0x2006, w/h=(1920,1080), colorspace=8, field=1
[ 27.309455] enter tc358748_s_power = ON
[ 27.309471] tc358748 2-000e: tc358748_enable_hw
[ 27.311682] tc358748 2-000e: tc358748_set_pad_format
[ 27.311696] tc358748 2-000e: tc358748_get_pad_format code=0x2006, w/h=(1920,1080), colorspace=8, field=1
[ 27.311705] tc358748 2-000e: tc358748_get_pad_format code=0x2006, w/h=(1920,1080), colorspace=8, field=1
[ 27.316716] bypass csc
[ 27.316724] input fmt YUV4
[ 27.316728] output fmt YUYV
[ 27.667770] tc358748 2-000e: tc358748_get_pad_format code=0x2006, w/h=(1920,1080), colorspace=8, field=1
[ 27.667876] tc358748 2-000e: tc358748_set_pad_format
[ 27.667882] tc358748 2-000e: tc358748_get_pad_format code=0x2006, w/h=(1920,1080), colorspace=8, field=1
[ 27.667889] tc358748 2-000e: tc358748_get_pad_format code=0x2006, w/h=(1920,1080), colorspace=8, field=1
[ 27.672900] bypass csc
[ 27.672909] input fmt YUV4
[ 27.672912] output fmt YUYV
[ 27.672922] enter tc358748_s_power = OFF
[ 27.672929] tc358748 2-000e: tc358748_disable_hw
[ 27.701511] enter tc358748_s_power = ON
[ 27.701530] tc358748 2-000e: tc358748_enable_hw
[ 27.703406] tc358748 2-000e: tc358748_set_pad_format
[ 27.703418] tc358748 2-000e: tc358748_get_pad_format code=0x2006, w/h=(1920,1080), colorspace=8, field=1
[ 27.703427] tc358748 2-000e: tc358748_get_pad_format code=0x2006, w/h=(1920,1080), colorspace=8, field=1
[ 27.708440] bypass csc
[ 27.708451] input fmt YUV4
[ 27.708456] output fmt YUYV
[ 28.035292] tc358748 2-000e: [tc358748_stream,1152]: Stream enable ...
[ 28.035309] tc358748 2-000e: tc358748_set_pll
[ 28.035313] tc358748 2-000e: tc358748_calc_pll
[ 28.035382] tc358748 2-000e: PLL: refclk 10000000, fbd 88, prd 0, frs 1
[ 28.035388] tc358748 2-000e: PLL: pll_clk: 445000000, CSIClk 222500000, CSIByteClk 55625000
[ 28.035393] tc358748 2-000e: PLL: pclk 74166666 (FPGA(Hardcode=>: 74250000MHz))
[ 28.037869] tc358748 2-000e: tc358748_sw_reset
[ 28.038566] tc358748 2-000e: tc358748_apply_misc_config
[ 28.038902] tc358748 2-000e: DATAFMT: 0x60
[ 28.039301] tc358748 2-000e: CONFCTL[PDATAF]: 0x0
[ 28.039642] tc358748 2-000e: FIFOCTL: 0x20
[ 28.039976] tc358748 2-000e: WORDCNT: 0xf00
[ 28.039984] tc358748 2-000e: tc358748_enable_csi_lanes: 1
[ 28.040454] tc358748 2-000e: CLW_CNTRL: 0 0x140
[ 28.040777] tc358748 2-000e: D0W_CNTRL: 0 0x144
[ 28.041158] tc358748 2-000e: D1W_CNTRL: 0 0x148
[ 28.041538] tc358748 2-000e: D2W_CNTRL: 0 0x14c
[ 28.041899] tc358748 2-000e: D3W_CNTRL: 0 0x150
[ 28.041908] tc358748 2-000e: tc358748_apply_dphy_config
[ 28.041912] tc358748 2-000e: dsiclk_nsk: 4494
[ 28.041916] tc358748 2-000e: ui_nsk: 2247
[ 28.041920] tc358748 2-000e: csibclk_nsk: 17977
[ 28.041924] tc358748 2-000e: phy_delay_nsk: 26965
[ 28.042278] tc358748 2-000e: LINEINITCNT: 0x15ba
[ 28.042661] tc358748 2-000e: LPTXTIMECNT: 0x2
[ 28.043043] tc358748 2-000e: TCLK_HEADERCNT: 0xa03
[ 28.043456] tc358748 2-000e: TCLK_TRAILCNT: 0xffffffff
[ 28.043803] tc358748 2-000e: THS_HEADERCNT: 0xffffee03
[ 28.044156] tc358748 2-000e: TWAKEUP: 0x49e0
[ 28.044535] tc358748 2-000e: TCLK_POSTCNT: 0x7
[ 28.044914] tc358748 2-000e: THS_TRAILCNT: 0x1
[ 28.045298] tc358748 2-000e: HSTXVREGEN: 0x1f
[ 28.045307] tc358748 2-000e: tc358748_enable_csi_module: 1
[ 28.045680] tc358748 2-000e: STARTCNTRL: 0x1
[ 28.046025] tc358748 2-000e: CSI_START: 0x1
[ 28.046407] tc358748 2-000e: CSI_CONFW_REG: 2734719110 (0x518)
[ 32.176687] tc358748 2-000e: tc358748_get_pad_format code=0x2006, w/h=(1920,1080), colorspace=8, field=1
[ 32.176772] tc358748 2-000e: tc358748_get_pad_format code=0x2006, w/h=(1920,1080), colorspace=8, field=1
[ 32.178272] tc358748 2-000e: [tc358748_stream,1152]: Stream disable ...
[ 32.240654] enter tc358748_s_power = OFF
[ 32.240673] tc358748 2-000e: tc358748_disable_hw
[ 60.422080] imx-sdma 30bd0000.dma-controller: firmware found.
[ 60.422080] imx-sdma 30e10000.dma-controller: firmware found.
[ 60.422326] imx-sdma 30bd0000.dma-controller: loaded firmware 4.6
[ 66.531400] cfg80211: failed to load regulatory.db
i.MX 8M | i.MX 8M Mini | i.MX 8M Nano Re: Trouble with (TC358748) Parallel to CSI2 video bridge @shaswath 你解决这个问题了吗?如果可以的话,能否分享一下您的TC358748 内核驱动代码和最新的设备树文件?因为我也遇到了同样的问题。非常感谢! Re: Trouble with (TC358748) Parallel to CSI2 video bridge 你不能随意选择格式,这取决于你的桥接端设置。检查你的 TC358748 寄存器,看看你在那里设置的是什么格式,然后选择 imx8mp 端的正确格式。 Re: Trouble with (TC358748) Parallel to CSI2 video bridge 你好, 很抱歉回复晚了。我按照您建议的格式使用了数据,现在可以看到一些数据,但正如您从附件示例中看到的那样。它还不完美。我尝试了不同的 MEDIA_BUS_FMT 和 V4L2_PIX_FMT,也尝试了不同的频率(23.98、50、60 等)。 MEDIA_BUS_FMT_YUYV8_1X16 / UYVY8_1X16 / 2X8。 V4L2_PIX_FMT_YUYV / UYVY / YUV422P。 但从 dmesg 日志中可以看到,有很多 CRC 错误。另外,我注意到从 media-ctl -p 中,除了桥接节点之外,其他节点都没有格式信息。 Re: Trouble with (TC358748) Parallel to CSI2 video bridge 或许你需要考虑一下格式。我检查了 CHNL_IMG_CTRL,它是 100000 字节的 YUV422_1P8P 格式,每个颜色元器件 8 位;单平面,YUV 交错打包字节。
https://github.com/nxp-imx/linux-imx/blob/lf-5.15.y/drivers/staging/media/imx/imx8-isi-fmt.c
{ 。姓名= "YUYV-16", .fourcc= V4L2_PIX_FMT_YUYV, 。深度= { 16 }, 。颜色= MXC_ISI_OUT_FMT_YUV422_1P8P, .memplanes= 1, .colplanes= 1, 。对齐= 3, .mbus_code= MEDIA_BUS_FMT_YUYV8_1X16, }
你应该从 ISI 选择此格式作为默认格式,并且也要检查你的桥接端。 Re: Trouble with (TC358748) Parallel to CSI2 video bridge 我检查了您的 dts 文件设置,TC358748 有 4 个数据通道,但日志文件只显示 1 个通道([ 39.473097] tc358748 2-000e: tc358748_enable_csi_lanes: 1),请再次检查。 --> 这只是为了指示函数调用,在该行下面您可以看到启用 4 个数据通道和 1 个时钟通道的这些行。 tc358748 2-000e:CLW_CNTRL:0 0x140 tc358748 2-000e:D0W_CNTRL:0 0x144 tc358748 2-000e:D1W_CNTRL:0 0x148 tc358748 2-000e:D2W_CNTRL:0 0x14c tc358748 2-000e:D3W_CNTRL:0 0x150 在你的 csi&isi dump.txt 文件中,[ 58.212425] tc358748 2-000e: PLL: pclk 218750000 (FPGA(硬编码>: 74250000MHz)) 但在 gst-lauch-1.0.txt 中,[ 39.413394] tc358748 2-000e: PLL: pclk 218750000 (FPGA(Hardcode=>: 148500000MHz)) --> 我们使用 148.5MHz。 那么你究竟设定的是哪个时间呢?我查看了你的DTS文件,你设置了74.25M像素时钟,我建议你测量一下时钟频率,并设置hs-settle和clk-settle。 --> hs-settle 值是根据以下公式设置的:(像素速率 * 每像素位数)/(通道数 * 2),即 148.5 pixclk * 16bpp / 2 * 4 通道 = 475.2 MBits/s所以 RX_HS_SETTLE 为 10。 此外,我们板上的数据通道也互换了。修改之后,当我使用 Gstreamer 或 v4l2-ctl 用上市,不用发布视频捕获时,会出现绿屏。 gst-launch-1.0 -e \ v4l2src device=/dev/video3 ! \ 'video/x-raw,format=YUY2,width=1920,height=1080,framerate=60/1' ! \ videoconvert ! queue ! waylandsink Setting pipeline to PAUSED ... Pipeline is live and does not need PREROLL ... Pipeline is PREROLLED ... Setting pipeline to PLAYING ... New clock: GstSystemClock Redistribute latency... ^Chandling interrupt. Interrupt: Stopping pipeline ... EOS on shutdown enabled -- Forcing EOS on the pipeline Waiting for EOS... Got EOS from element "pipeline0". EOS received - stopping pipeline... Execution ended after 0:00:09.751003250 Setting pipeline to NULL ... Total showed frames (544), playing for (0:00:09.750853750), fps (55.790) Re: Trouble with (TC358748) Parallel to CSI2 video bridge 我检查了您的 dts 文件设置,TC358748 有 4 个数据通道,但日志文件只显示 1 个通道([ 39.473097] tc358748 2-000e: tc358748_enable_csi_lanes: 1),请再次检查。
在你的 csi&isi dump.txt 文件中,[ 58.212425] tc358748 2-000e: PLL: pclk 218750000 (FPGA(硬编码>: 74250000MHz))
但在 gst-lauch-1.0.txt 中,[ 39.413394] tc358748 2-000e: PLL: pclk 218750000 (FPGA(Hardcode=>: 148500000MHz))
那么你究竟设定的是哪个时间呢?我查看了你的DTS文件,你设置了74.25M像素时钟,我建议你测量一下时钟频率,并设置hs-settle和clk-settle。
Re: Trouble with (TC358748) Parallel to CSI2 video bridge 你好@joanxie , 是的,TC358748 的输入信号正常,我看到 TC358748 有信号输出。 要开始使用 GStreamer 进行捕获: gst-用上市,不用发布-1.0v4l2src 设备=/dev/video2 !video/x-raw,宽度=1920,高度=1080!自动视频接收器 另一个问题是,当在 dts 中启用 ISI 节点时,系统会在几分钟后挂起。 Re: Trouble with (TC358748) Parallel to CSI2 video bridge 目前我无法使用 Gstreamer 或 v4l2-ctl 捕获任何帧。
您使用的是哪种 GStreamer 命令?您收到了什么消息?能否确认一下来自 TC358748 的信号是否完全正常?你检查过TC358748那边了吗? Re: Trouble with (TC358748) Parallel to CSI2 video bridge 请查找他的注册表转储文件。 Re: Trouble with (TC358748) Parallel to CSI2 video bridge 从imx8mp这边来看,我没有发现任何问题,连接设置正确。
[ 7.992257] mx8-img-md:已注册传感器子设备:tc358748 2-000e (1) [ 8.002921] mx8-img-md:创建链接 [mxc_isi.0]=> [mxc_isi.0.捕获] [ 8.018980] mx8-img-md:创建链接 [mxc-mipi-csi2.0]
[[ ## completed ##]]=> [mxc_isi.0] [ 8.025519] mx8-img-md: 创建链接 [tc358748 2-000e] => [mxc-mipi-csi2.0] [ 8.032634] mxc-md 32c00000.总线:camera:mxc_md_create_links
实际上,isi0 是为 mipi csi0 设计的,在 mipi csi0 中添加 port@1 后,当前的 电路板支持包 应该会出现一些错误,所以你是否更改了任何 mipi 驱动程序?但由于您的设置正确,这应该不会影响您的数据捕获。您可以检查 FPGA 端,确认其是否设置了正确的时钟或发送了正确的数据,并仔细检查 TC358748 的寄存器。此外,请导出 MIPI CSI 和 ISI 寄存器,以检查是否存在任何错误位。 Re: Trouble with (TC358748) Parallel to CSI2 video bridge 请查收附件。 Re: Trouble with (TC358748) Parallel to CSI2 video bridge 能否将日志文件和DTS文件发送给我?
View full article