how to setup mv-mipi-imx287m on rpi zero 2w?
-
UPD solved
Hi,
I'm trying to run mv-mipi-imx287m on rpi zero 2w, following this guide: https://wiki.veye.cc/index.php/V4L2_mode_for_Raspberry_Pi
My actions:
#!/bin/bash set -ex cd ~/ rm -rf raspberry* wget https://github.com/veyeimaging/raspberrypi_v4l2/releases/latest/download/raspberrypi_v4l2.tgz tar xzf raspberrypi_v4l2.tgz # build driver cd ~/raspberrypi_v4l2/driver_source/cam_drv_src/rpi-6.6.y make # build dtbo cd ~/raspberrypi_v4l2/driver_source/dts/rpi-6.6.y ./build_dtbo.sh cd ~/raspberrypi_v4l2/release # create bin dir for current kernel mkdir -p driver_bin/$(uname -r) cp ~/raspberrypi_v4l2/driver_source/cam_drv_src/rpi-6.6.y/*.ko driver_bin/$(uname -r)/ cp ~/raspberrypi_v4l2/driver_source/dts/rpi-6.6.y/*.dtbo driver_bin/$(uname -r)/ ls -l driver_bin/$(uname -r)/*.{ko,dtbo} cd ~/raspberrypi_v4l2/release chmod +x *.sh yes no | ./uninstall_driver.sh veye_mvcam sed -i 's/\/boot\/cmdline\.txt/\/boot\/firmware\/cmdline\.txt/g' install_driver.sh yes | ./install_driver.sh veye_mvcam
Result:
user@rpizero:~ $ dmesg | tail -n 10 [ 10.013388] Bluetooth: hci0: BCM43436 37.4MHz Class 1.5 RaspBerry Pi Zero2 [Version: 1017.1042] [ 10.013428] Bluetooth: hci0: BCM43430A1 (001.002.009) build 1042 [ 10.014738] Bluetooth: hci0: BCM: Using default device address (43:43:a1:12:1f:ac) [ 10.152275] 8021q: 802.1Q VLAN Support v1.8 [ 10.595384] veye_mvcam: loading out-of-tree module taints kernel. [ 10.596516] mvcam 10-003b: veye mv series camera driver version: 01.01.06 [ 10.944723] brcmfmac: brcmf_cfg80211_set_power_mgmt: power save enabled [ 11.165153] mvcam: mvcam_read: Reading register 0x04 failed [ 11.165219] mvcam 10-003b: failed to read chip id [ 16.219244] systemd[647]: memfd_create() called without MFD_EXEC or MFD_NOEXEC_SEAL set
user@rpizero:~ $ ls -l /dev/video0 ls: cannot access '/dev/video0': No such file or directory
user@rpizero:~ $ uname -a Linux rpizero 6.6.74+rpt-rpi-v8 #1 SMP PREEMPT Debian 1:6.6.74-1+rpt1 (2025-01-27) aarch64 GNU/Linux user@rpizero:~ $ lsb_release -a No LSB modules are available. Distributor ID: Debian Description: Debian GNU/Linux 12 (bookworm) Release: 12 Codename: bookworm
Did anyone try to setup this camera module on rpi zero 2w?
UPD: I have the same error with rpi5 (used
install_driver_rpi5.sh
instead ofinstall_driver.sh
). I've checked my cable connections and everything looks correct (please correct me if I'm wrong)UPD2: SOLVED. The problem was that I've tried to put ribbon cable under brown plastic thing. Ribbon should go above it, and contacts should be faced up, not to the board. Like this:
And this is wrong:
-
-
@veye_xumm do you know what framerate can be achieved on rpi zero 2w with imx287?
I'm getting ~320 fps + ~80 frames drops per second when using v4l2-ctl
$ v4l2-ctl --stream-mmap --stream-count=-1 -d /dev/video0 --stream-to=/dev/null <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< 319.87 fps, dropped buffers: 79
and ~240 fps + ~80 frame drops per second when using my C program (
V4L2_BUF_TYPE_VIDEO_CAPTURE
+V4L2_MEMORY_MMAP
, used 3 buffers)VIDIOC_DQBUF
takes ~4000 microseconds in my casefps: 252 dropped: 77 dq: 3996 fps: 250 dropped: 71 dq: 4031 fps: 247 dropped: 74 dq: 4041 fps: 248 dropped: 75 dq: 4033
I've set camera fps using this command
v4l2-ctl --set-ctrl frame_rate=523
the interesting thing is that I have frame drops even if I set very low fps, e.g. 10
<<<<<<< 6.67 fps, dropped buffers: 2 <<<< 7.50 fps, dropped buffers: 3 <<<<<< 6.87 fps, dropped buffers: 1
as well as using v4l2 C interface (
dq
is dequeue time in microseconds)fps: 7 dropped: 0 dq: 170145 fps: 6 dropped: 1 dq: 166645 fps: 5 dropped: 2 dq: 299999 fps: 3 dropped: 2 dq: 366619 fps: 8 dropped: 0 dq: 124991
and after setting fps to 2000, roi to 264x64, expmode=0 and metime=18 I have this:
$ ./test_fps.sh 2>&1 | awk '{ print $2" "$3" "$4" "$5" "$6 }' 1179.27 fps, dropped buffers: 309 1190.98 fps, dropped buffers: 311 1211.59 fps, dropped buffers: 313 1194.65 fps, dropped buffers: 309 1179.99 fps, dropped buffers: 322 1205.69 fps, dropped buffers: 315 1208.82 fps, dropped buffers: 315 1199.75 fps, dropped buffers: 328
I had no issues with ov9281 cams from different vendors when using v4l2 C interface on rpi zero 2w, these cams have 1280x800 resolution, 8-bits per pixel and 144 max fps for this format (I'm not sure about rpi zero 2w capabilities though, it seems at least ~385 fps should be possible (?) with imx287:
(704×544×523) == 191 Mb/s (ideal) (1280×800×144) == 140Mb/s 704×544×250 == 91 Mb/s (264*64*1200) == 19 Mb/s
According to driver output CSI speed is limited to
178 Mb/s
(per lane?):[ 11.153106] mvcam: mvcam_get_mipifeature: lane num 2, datarate 1500000000 bps [ 11.153141] mvcam 10-003b: Success to get mvcam endpoint data lanes, dts uses 2 lanes,will set to camera
can these drops be related to veye driver? Do you have any ideas where I can start from to debug it?
Here
mca312
had similar problemhttps://forum.veye.cc/topic/469/imx287-fps
and you suggested to use the latest firmware, it seems I have the latest one (
MV-MIPI-IMX287M_C1.43_L2.07_upgrade_20240910.bin.zip
) :$ ./mv_mipi_i2c_new.sh -r version version is C 01.43 and L 02.07 $ dmesg | grep mvcam | grep firmware [ 11.148332] mvcam 10-003b: firmware version: 0x1430207
I've saved fps=523 to camera memory and defined
DEBUG_PRINTK
inveye_mvcam.c
, so I have the following dmesg (last lines come from v4l2-ctrl stream command mentioned above)[ 0.054968] /soc/csi@7e801000: Fixed dependency cycle(s) with /soc/i2c0mux/i2c@1/veyemvcam@3b [ 0.055063] /soc/i2c0mux/i2c@1/veyemvcam@3b: Fixed dependency cycle(s) with /soc/csi@7e801000 [ 0.061709] /soc/csi@7e801000: Fixed dependency cycle(s) with /soc/i2c0mux/i2c@1/veyemvcam@3b [ 0.062030] /soc/i2c0mux/i2c@1/veyemvcam@3b: Fixed dependency cycle(s) with /soc/csi@7e801000 [ 8.318547] /soc/csi@7e801000: Fixed dependency cycle(s) with /soc/i2c0mux/i2c@1/veyemvcam@3b [ 8.319204] /soc/i2c0mux/i2c@1/veyemvcam@3b: Fixed dependency cycle(s) with /soc/csi@7e801000 [ 10.560822] veye_mvcam: loading out-of-tree module taints kernel. [ 10.561878] mvcam 10-003b: veye mv series camera driver version: 01.01.06 [ 11.146706] mvcam_power_on [ 11.147538] mvcam 10-003b: camera is: MV_MIPI_IMX287M [ 11.148332] mvcam 10-003b: firmware version: 0x1430207 [ 11.149903] mvcam: mvcam_identify_module: max width 720; max height 544;min width 264; mini height 64 [ 11.149914] /home/user/raspberrypi_v4l2/driver_source/cam_drv_src/rpi-6.6.y/veye_mvcam.c mvcam_enum_pixformat 1008 [ 11.150702] mvcam: mvcam_enum_pixformat: format count: 3; format cap 0x7 [ 11.150713] /home/user/raspberrypi_v4l2/driver_source/cam_drv_src/rpi-6.6.y/veye_mvcam.c mvdatatype_to_mbus_code 968 [ 11.150719] mvcam: mvcam_enum_pixformat support format index 0 mbuscode 8193 datatype: 0 [ 11.150727] /home/user/raspberrypi_v4l2/driver_source/cam_drv_src/rpi-6.6.y/veye_mvcam.c mvdatatype_to_mbus_code 968 [ 11.150733] mvcam: mvcam_enum_pixformat support format index 1 mbuscode 8202 datatype: 1 [ 11.150740] /home/user/raspberrypi_v4l2/driver_source/cam_drv_src/rpi-6.6.y/veye_mvcam.c mvdatatype_to_mbus_code 968 [ 11.150746] mvcam: mvcam_enum_pixformat support format index 2 mbuscode 8211 datatype: 2 [ 11.151533] mvcam: mvcam_enum_pixformat: cur format: 0 [ 11.153106] mvcam: mvcam_get_mipifeature: lane num 2, datarate 1500000000 bps [ 11.153141] mvcam 10-003b: Success to get mvcam endpoint data lanes, dts uses 2 lanes,will set to camera [ 11.154719] mvcam: mvcam_probe: max width 720; max height 544 [ 11.157865] mvcam: mvcam_getroi:get roi(0,0,704,544) [ 11.158664] mvcam: mvcam_v4l2_ctrl_init:default trigger mode 0 [ 11.159456] mvcam: mvcam_v4l2_ctrl_init:default trigger source 1 [ 11.161025] mvcam: mvcam_v4l2_ctrl_init:default framerate 523 , max fps 523 [ 11.161039] /home/user/raspberrypi_v4l2/driver_source/cam_drv_src/rpi-6.6.y/veye_mvcam.c mvcam_enum_controls 1298 [ 11.161106] mvcam: mvcam_s_ctrl: cid = (0x9E0902), value = (166). [ 11.161116] mvcam: mvcam_s_ctrl: cid = (0x9E0901), value = (16). [ 11.161122] mvcam: mvcam_s_ctrl: cid = (0x980911), value = (16). [ 11.161129] mvcam: mvcam_s_ctrl: cid = (0x9E0903), value = (16). [ 11.161135] mvcam: mvcam_s_ctrl: cid = (0x981901), value = (0). [ 11.161142] mvcam write 0x404 val 0x0 [ 11.162448] mvcam: mvcam_s_ctrl: cid = (0x981902), value = (1). [ 11.162465] mvcam write 0x408 val 0x1 [ 11.163151] mvcam: mvcam_s_ctrl: cid = (0x981904), value = (523). [ 11.163160] mvcam write 0x814 val 0xcc4c [ 11.163840] mvcam: mvcam_s_ctrl: cid = (0x981905), value = (0). [ 11.163849] mvcam: set roi_x 0 round to 0. [ 11.163856] mvcam: mvcam_s_ctrl: cid = (0x981906), value = (0). [ 11.163863] mvcam: set roi_y 0 round to 0. [ 11.163870] /home/user/raspberrypi_v4l2/driver_source/cam_drv_src/rpi-6.6.y/veye_mvcam.c mvcam_enum_controls 1333 [ 11.163882] mvcam 10-003b: mvcam_enum_controls success [ 11.163889] mvcam write 0x400 val 0x0 [ 11.164567] mvcam write 0x83c val 0x2 [ 11.165315] mvcam 10-003b: mvcam_csi2_get_fmt: width: (704) height: (544) code: (0x2001) [ 11.165327] mvcam 10-003b: mvcam_csi2_get_fmt: width: (704) height: (544) code: (0x2001) [ 19.981817] mvcam 10-003b: mvcam_csi2_enum_mbus_code: index = (0) mbus code (2001) [ 19.981855] mvcam 10-003b: mvcam_csi2_enum_framesizes: code = (0x2001), index = (0) [ 19.981881] mvcam 10-003b: mvcam_csi2_enum_framesizes: code = (0x2001), index = (2) [ 19.981894] mvcam 10-003b: mvcam_csi2_enum_mbus_code: index = (0) mbus code (2001) [ 19.981906] mvcam 10-003b: mvcam_csi2_enum_mbus_code: index = (1) mbus code (200a) [ 19.981919] mvcam 10-003b: mvcam_csi2_enum_mbus_code: index = (0) mbus code (2001) [ 19.981926] mvcam 10-003b: mvcam_csi2_enum_mbus_code: index = (1) mbus code (200a) [ 19.981938] mvcam 10-003b: mvcam_csi2_enum_framesizes: code = (0x200A), index = (0) [ 19.981959] mvcam 10-003b: mvcam_csi2_enum_framesizes: code = (0x200A), index = (2) [ 19.981971] mvcam 10-003b: mvcam_csi2_enum_mbus_code: index = (0) mbus code (2001) [ 19.981978] mvcam 10-003b: mvcam_csi2_enum_mbus_code: index = (1) mbus code (200a) [ 19.981985] mvcam 10-003b: mvcam_csi2_enum_mbus_code: index = (2) mbus code (2013) [ 19.981996] mvcam 10-003b: mvcam_csi2_enum_mbus_code: index = (0) mbus code (2001) [ 19.982003] mvcam 10-003b: mvcam_csi2_enum_mbus_code: index = (1) mbus code (200a) [ 19.982010] mvcam 10-003b: mvcam_csi2_enum_mbus_code: index = (2) mbus code (2013) [ 19.982021] mvcam 10-003b: mvcam_csi2_enum_framesizes: code = (0x2013), index = (0) [ 19.982041] mvcam 10-003b: mvcam_csi2_enum_framesizes: code = (0x2013), index = (2) [ 19.982052] mvcam 10-003b: mvcam_csi2_enum_mbus_code: index = (0) mbus code (2001) [ 19.982060] mvcam 10-003b: mvcam_csi2_enum_mbus_code: index = (1) mbus code (200a) [ 19.982066] mvcam 10-003b: mvcam_csi2_enum_mbus_code: index = (2) mbus code (2013) [ 19.989868] mvcam: mvcam_g_volatile_ctrl: cid = (0x981901), value = (0). [ 19.990730] mvcam: mvcam_g_volatile_ctrl: cid = (0x981902), value = (1). [ 19.991634] mvcam: mvcam_g_volatile_ctrl: cid = (0x981904), value = (523). [ 19.992678] mvcam: mvcam_g_volatile_ctrl: cid = (0x981901), value = (0). [ 19.993534] mvcam: mvcam_g_volatile_ctrl: cid = (0x981902), value = (1). [ 19.994396] mvcam: mvcam_g_volatile_ctrl: cid = (0x981904), value = (523). [ 19.994665] mvcam 10-003b: mvcam_csi2_enum_mbus_code: index = (0) mbus code (2001) [ 19.994690] mvcam 10-003b: mvcam_csi2_enum_framesizes: code = (0x2001), index = (0) [ 19.994736] mvcam 10-003b: mvcam_csi2_enum_framesizes: code = (0x2001), index = (2) [ 19.994748] mvcam 10-003b: mvcam_csi2_enum_mbus_code: index = (0) mbus code (2001) [ 19.994755] mvcam 10-003b: mvcam_csi2_enum_mbus_code: index = (1) mbus code (200a) [ 19.994768] mvcam 10-003b: mvcam_csi2_enum_mbus_code: index = (0) mbus code (2001) [ 19.994776] mvcam 10-003b: mvcam_csi2_enum_mbus_code: index = (1) mbus code (200a) [ 19.994788] mvcam 10-003b: mvcam_csi2_enum_framesizes: code = (0x200A), index = (0) [ 19.994809] mvcam 10-003b: mvcam_csi2_enum_framesizes: code = (0x200A), index = (2) [ 19.994820] mvcam 10-003b: mvcam_csi2_enum_mbus_code: index = (0) mbus code (2001) [ 19.994827] mvcam 10-003b: mvcam_csi2_enum_mbus_code: index = (1) mbus code (200a) [ 19.994834] mvcam 10-003b: mvcam_csi2_enum_mbus_code: index = (2) mbus code (2013) [ 19.994845] mvcam 10-003b: mvcam_csi2_enum_mbus_code: index = (0) mbus code (2001) [ 19.994852] mvcam 10-003b: mvcam_csi2_enum_mbus_code: index = (1) mbus code (200a) [ 19.994859] mvcam 10-003b: mvcam_csi2_enum_mbus_code: index = (2) mbus code (2013) [ 19.994870] mvcam 10-003b: mvcam_csi2_enum_framesizes: code = (0x2013), index = (0) [ 19.994890] mvcam 10-003b: mvcam_csi2_enum_framesizes: code = (0x2013), index = (2) [ 19.994901] mvcam 10-003b: mvcam_csi2_enum_mbus_code: index = (0) mbus code (2001) [ 19.994908] mvcam 10-003b: mvcam_csi2_enum_mbus_code: index = (1) mbus code (200a) [ 19.994915] mvcam 10-003b: mvcam_csi2_enum_mbus_code: index = (2) mbus code (2013) [ 101.857898] mvcam 10-003b: mvcam_csi2_get_fmt: width: (704) height: (544) code: (0x2001) [ 101.860285] /home/user/raspberrypi_v4l2/driver_source/cam_drv_src/rpi-6.6.y/veye_mvcam.c mvcam_set_stream 1134 [ 101.860320] /home/user/raspberrypi_v4l2/driver_source/cam_drv_src/rpi-6.6.y/veye_mvcam.c mvcam_start_streaming 1088 [ 101.860327] mvcam_start_streaming [ 101.860331] mvcam write 0x400 val 0x1 [ 101.861056] mvcam 10-003b: mvcam_csi2_get_fmt: width: (704) height: (544) code: (0x2001) [ 105.460732] /home/user/raspberrypi_v4l2/driver_source/cam_drv_src/rpi-6.6.y/veye_mvcam.c mvcam_set_stream 1134 [ 105.460759] /home/user/raspberrypi_v4l2/driver_source/cam_drv_src/rpi-6.6.y/veye_mvcam.c mvcam_stop_streaming 1107 [ 105.460767] mvcam write 0x400 val 0x0 [ 105.461465] mvcam_stop_streaming
Thanks in advance