I use iMX8MMINI in combination with pico-pi evaluation board. I'm trying to connect adv7282-m converter (with mainline driver https://github.com/TechNexion/linux-tn-imx/blob/tn-imx_5.10.72_2.2.0-next/drivers/media/i2c/adv7180.c) to the Camera2 mipi interface. I got it initalized on the i2c and mipi busses, clocks and data seem to start flowing judging by the oscillograph readings. On attempt to record data with gstreamer, however, no frames are recorded into file. Module doesn't seem to throw errors, but gstreamer throws warning of impossibility to subscribe v4l2src events
I modified driver to output some extra logs in attempt to trace the error, but didn't get much luck out of it
I build the module from the Technexion github repo kernel version 5.10.72_2.2.0-next. As a rootfs baseline I use https://ftp.technexion.com/images/pico-imx8mm/pi-dsi1280x720/ubuntu-20.04.xz image since it has gstreamer vpu support out of the box. Module is installed separately with insmod
Attached are dmesg logs
Device-tree modifications
&iomuxc {
pinctrl_csi1_pwn: csi1_pwn_grp {
fsl,pins = <
MX8MM_IOMUXC_UART4_RXD_GPIO5_IO28 0x20 /* CSI PWDN */
>;
};
...
};
&ecspi2 {
status = "okay";
spidev0: spi@0 {
reg = <0>;
compatible = "rohm,dh2228fv";
spi-max-frequency = <1000000>;
};
};
&i2c2 {
clock-frequency = <400000>;
pinctrl-names = "default";
pinctrl-0 = <&pinctrl_i2c2>;
status = "okay";
adv728x_mipi1: adv728x_mipi1@21 {
status = "okay";
compatible = "adi,adv7282-m";
reg = <0x21>;
pinctrl-names = "default";
//pinctrl-0 = <&pinctrl_csi_rst>;
pinctrl-0 = <&pinctrl_csi1_pwn>;
clocks = <&clk IMX8MM_CLK_CLKO1>;
clock-names = "csi_mclk";
csi_id = <0>;
pwn-gpios = <&gpio5 12 GPIO_ACTIVE_HIGH>;
rst-gpios = <&gpio1 13 GPIO_ACTIVE_HIGH>;
mclk = <24000000>;
mclk_source = <0>;
port {
adv728x_mipi1_ep: endpoint {
remote-endpoint = <&mipi1_sensor_ep>;
};
};
};
...
};
pinctrl_csi1_pwn: csi1_pwn_grp {i2c-detect -y 1
v4l2-ctl --list-formats-ext
ioctl: VIDIOC_ENUM_FMT
Type: Video Capture
[0]: 'UYVY' (UYVY 4:2:2)
gst-device-monitor-1.0
Probing devices...
Device found:
name : Monitor of Dummy Output
class : Audio/Source
caps : audio/x-raw, format={ (string)S16LE, (string)S16BE, (string)F32LE, (string)F32BE, (string)S32LE, (string)S32BE, (string)S24LE, (string)S24BE, (string)S24_32LE, (string)S24_32BE, (string)U8 }, layout=interleaved, rate=[ 1, 384000 ], channels=[ 1, 32 ]
audio/x-alaw, rate=[ 1, 384000 ], channels=[ 1, 32 ]
audio/x-mulaw, rate=[ 1, 384000 ], channels=[ 1, 32 ]
properties:
device.description = "Monitor\ of\ Dummy\ Output"
device.class = monitor
device.icon_name = audio-input-microphone
is-default = true
gst-launch-1.0 pulsesrc device=auto_null.monitor ! ...
Device found:
name : Dummy Output
class : Audio/Sink
caps : audio/x-raw, format={ (string)S16LE, (string)S16BE, (string)F32LE, (string)F32BE, (string)S32LE, (string)S32BE, (string)S24LE, (string)S24BE, (string)S24_32LE, (string)S24_32BE, (string)U8 }, layout=interleaved, rate=[ 1, 384000 ], channels=[ 1, 32 ]
audio/x-alaw, rate=[ 1, 384000 ], channels=[ 1, 32 ]
audio/x-mulaw, rate=[ 1, 384000 ], channels=[ 1, 32 ]
properties:
device.description = "Dummy\ Output"
device.class = abstract
device.icon_name = audio-card
is-default = true
gst-launch-1.0 ... ! pulsesink device=auto_null
Device found:
name : i.MX6S_CSI
class : Video/Source
caps : video/x-raw(format:Interlaced), format=UYVY, framerate=[ 0/1, 2147483647/1 ], width=720, height=240, pixel-aspect-ratio=1/1, interlace-mode=alternate
video/x-raw, format=UYVY, framerate=[ 0/1, 2147483647/1 ], width=720, height=240, pixel-aspect-ratio=1/1, interlace-mode={ (string)progressive, (string)interleaved }
video/x-raw(format:Interlaced), format=UYVY, framerate=[ 0/1, 2147483647/1 ], width=720, height=240, pixel-aspect-ratio=1/1, interlace-mode=alternate
properties:
udev-probed = true
device.bus_path = platform-32e20000.csi1_bridge
sysfs.path = "/sys/devices/platform/soc\@0/32c00000.bus/32e20000.csi1_bridge/video4linux/video0"
device.subsystem = video4linux
device.product.name = i.MX6S_CSI
device.capabilities = :capture:
device.api = v4l2
device.path = /dev/video0
v4l2.device.driver = mx6s-csi
v4l2.device.card = i.MX6S_CSI
v4l2.device.bus_info = platform:32e20000.csi1_bridge
v4l2.device.version = 330312 (0x00050a48)
v4l2.device.capabilities = 2216689665 (0x84200001)
v4l2.device.device_caps = 69206017 (0x04200001)
gst-launch-1.0 v4l2src ! ...
GST_DEBUG=3 gst-launch-1.0 v4l2src -e device=/dev/video0 norm=NTSC ! vpuenc_h264 ! h264parse ! mp4mux ! filesink location=test.mp4
Would be glad for any help. Thank you in advance
解決済! 解決策の投稿を見る。
To anyone with the same problem, I found this thread very useful in obtaining the image. The main problem is that the actual data stream in the driver begins before the `MIPI CSI` bridge expects any data to arrive, so no interrupts will occur. To solve this, move enabling of CSI-TX from `adv7180_set_power()` function to `adv7180_s_stream()` and it should start working at least partially.
The other problem still remains is `base address change error` in the DMA buffer, but commenting out DMA buffer refresh on this interrupt solves the deal for me, at least for now. Using the other instructions present in the thread I managed to obtaied the continuous picture from the ADV7282A-M.
Be warned though, that `V4L2` system may not use the `adv7180_querystd()`, which may lead to using the `NTSC` standard that may not coincide with your camera standard. To try fixing this, look at the `adv7180_probe()` function assignment of
state->curr_norm = V4L2_STD_NTSC;
And change to whatever value you need
Hope this solution will be useful to you
To anyone with the same problem, I found this thread very useful in obtaining the image. The main problem is that the actual data stream in the driver begins before the `MIPI CSI` bridge expects any data to arrive, so no interrupts will occur. To solve this, move enabling of CSI-TX from `adv7180_set_power()` function to `adv7180_s_stream()` and it should start working at least partially.
The other problem still remains is `base address change error` in the DMA buffer, but commenting out DMA buffer refresh on this interrupt solves the deal for me, at least for now. Using the other instructions present in the thread I managed to obtaied the continuous picture from the ADV7282A-M.
Be warned though, that `V4L2` system may not use the `adv7180_querystd()`, which may lead to using the `NTSC` standard that may not coincide with your camera standard. To try fixing this, look at the `adv7180_probe()` function assignment of
state->curr_norm = V4L2_STD_NTSC;
And change to whatever value you need
Hope this solution will be useful to you
I researched and tried lots of different shinanigans from that time. I managed to acquire several frames from the decoder with gstreamer using very strange approach. I noticed that when I try to capture video with gstreamer, mxc interrupt never happens from the debug. Accidentally I caught interrupts by trying to capture video from FFMpeg, stopping the recording without writing to the file and starting the gstreamer capture afterwards. With this sequence Gstreamer prompted me with a timer that froze on 0.01 and a file with single frame and growing size with time left to me
I noticed that second dma buffer is never being read 'base address switching Change Err' error occurs and dma is being wiped all the time, so I disabled this functionality and this way managed to extend the "recording" time to 0.3 seconds, also I noticed that the second buffer now was being filled and read, however, the recording always stopped at around 0.2-0.3 seconds and nothing got captured afterwards, despite the fact that data flow could be observed with the oscilloscope as well as with dma debug
cat /sys/kernel/debug/dma_buf/bufinfo
Dma-buf Objects:
size flags mode count exp_name ino
00692224 00000002 00080007 00000001 videobuf2_dma_contig 00161338
Attached Devices:
Total 0 devices attached
00692224 00000002 00080007 00000001 videobuf2_dma_contig 00161337
Attached Devices:
Total 0 devices attached
00692224 00000002 00080007 00000001 videobuf2_dma_contig 00161336
Attached Devices:
Total 0 devices attached
00692224 00000002 00080007 00000001 videobuf2_dma_contig 00161335
Attached Devices:
Total 0 devices attached
00692224 00000002 00080007 00000001 videobuf2_dma_contig 00161334
Attached Devices:
Total 0 devices attached
04198400 00000002 00080007 00000002 ion 00161325
Attached Devices:
Total 0 devices attached
Total 6 objects, 7659520 bytes
When the timer is displayed in gstreamer the number of dma_buff objects shown with the debug is doubled compared with situations when there's no timer
After receiving at least some results I decided to attempt to at least replicate the result with my target 5.4.70 Linux Kernel version. However, it seems that changes in the v4l2 driver in newer version introduced this bug and absolutely no image is being acquired in older version with the adv7282a-m mainline driver on my side
From what I understand, the problem is on the intersection of mxc csi bridge and adv7282a-m and Mainline driver doesn't have enough instruction "details" to inform the csi bridge via v4l2 API. Is that correct? If yes, what should be done to enable proper communication with the csi bridge without completely rewriting the driver? Thanks for any help