lordofduct Posted November 18, 2016 Posted November 18, 2016 Hello all, just joined the forum since this is my first time using Armbian.So I got a NanoPi M1 and the dvp cam500b.From what I understand this camera uses the omnivision ov5640.I am having trouble getting this thing recognized in armbian. I get /dev/video0 to be listed by adding it to /etc/modules, but if I go to access it with any software it reports back 'no such device' or to the similar effect (this includes mjpg-streamer, fswebcam, ffmpeg). Researching around I find many forum posts of people saying one must modify the 'fex' file... to which I found out this is the decompiled version of the /boot/script.bin file using the sunxi-tools/bin2fex.Thing is, when I go into this 'fex' file, I have no idea what I must do. I find a location in it referring to [csi0], under which the gc2035 camera like so: vip_used = 1 vip_mode = 0 vip_dev_qty = 1 vip_define_sensor_list = 0 vip_csi_pck = port:PE00<2><default><default><default> vip_csi_mck = port:PE01<2><default><default><default> vip_csi_hsync = port:PE02<2><default><default><default> vip_csi_vsync = port:PE03<2><default><default><default> vip_csi_d0 = port:PE04<2><default><default><default> vip_csi_d1 = port:PE05<2><default><default><default> vip_csi_d2 = port:PE06<2><default><default><default> vip_csi_d3 = port:PE07<2><default><default><default> vip_csi_d4 = port:PE08<2><default><default><default> vip_csi_d5 = port:PE09<2><default><default><default> vip_csi_d6 = port:PE10<2><default><default><default> vip_csi_d7 = port:PE11<2><default><default><default> vip_csi_sck = port:PE12<2><default><default><default> vip_csi_sda = port:PE13<2><default><default><default> vip_dev0_mname = "gc2035" vip_dev0_pos = "front" vip_dev0_lane = 1 vip_dev0_twi_id = 2 vip_dev0_twi_addr = 120 vip_dev0_isp_used = 0 vip_dev0_fmt = 0 vip_dev0_stby_mode = 0 vip_dev0_vflip = 1 vip_dev0_hflip = 1 vip_dev0_iovdd = "" vip_dev0_iovdd_vol = 2800000 vip_dev0_avdd = "" vip_dev0_avdd_vol = 2800000 vip_dev0_dvdd = "" vip_dev0_dvdd_vol = 1800000 vip_dev0_afvdd = "" vip_dev0_afvdd_vol = 2800000 vip_dev0_power_en = port:PA17<1><default><default><1> vip_dev0_reset = port:PE14<1><default><default><1> vip_dev0_pwdn = port:PE15<1><default><default><0> vip_dev0_flash_en = vip_dev0_flash_mode = vip_dev0_af_pwdn = vip_dev0_act_used = 0 vip_dev0_act_name = "ad5820_act" vip_dev0_act_slave = 24 vip_dev1_mname = "" vip_dev1_pos = "rear" vip_dev1_lane = 1 vip_dev1_twi_id = 0 vip_dev1_twi_addr = vip_dev1_isp_used = 0 vip_dev1_fmt = 1 vip_dev1_stby_mode = 0 vip_dev1_vflip = 0 vip_dev1_hflip = 0 vip_dev1_iovdd = "" vip_dev1_iovdd_vol = 2800000 vip_dev1_avdd = "" vip_dev1_avdd_vol = 2800000 vip_dev1_dvdd = "" vip_dev1_dvdd_vol = 1500000 vip_dev1_afvdd = "" vip_dev1_afvdd_vol = 2800000 vip_dev1_power_en = vip_dev1_reset = vip_dev1_pwdn = vip_dev1_flash_en = vip_dev1_flash_mode = vip_dev1_af_pwdn =
nz1 Posted November 18, 2016 Posted November 18, 2016 I went on a wild goose chase trying to get this camera to work with my orangepi pc, until I rediscovered this link. http://www.cnx-software.com/2015/09/26/how-to-use-orange-pi-camera-in-linux-with-motion/ I think Armban is already mostly setup to handle this camera, so for me no editing fex files or installing modules was needed.
ChAoSWK Posted November 18, 2016 Posted November 18, 2016 Hi there, in the meantime does there exist a how to do with the raspberry camera??? There are many information on this topic, but for me it is not clear: is there a clear guideline how I use the RPi Cam with my OPi PC Plus? As I understood how ever the PINs must be reversed 1 -> 24 and 24 -> 1??? Does this "reversion of the pins" apply to the OPi board which need the adapter for the OPi cam or does this apply to the boards where you can directly connect the OPi Cam (sun8xi sells 2 versions of their camera module)???
@lex Posted November 18, 2016 Posted November 18, 2016 Hello all, just joined the forum since this is my first time using Armbian. So I got a NanoPi M1 and the dvp cam500b. From what I understand this camera uses the omnivision ov5640. I am having trouble getting this thing recognized in armbian. I get /dev/video0 to be listed by adding it to /etc/modules, but if I go to access it with any software it reports back 'no such device' or to the similar effect (this includes mjpg-streamer, fswebcam, ffmpeg). Researching around I find many forum posts of people saying one must modify the 'fex' file... to which I found out this is the decompiled version of the /boot/script.bin file using the sunxi-tools/bin2fex. Thing is, when I go into this 'fex' file, I have no idea what I must do. I find a location in it referring to [csi0], under which the gc2035 camera like so: vip_used = 1 vip_mode = 0 vip_dev_qty = 1 vip_define_sensor_list = 0 vip_csi_pck = port:PE00<2><default><default><default> vip_csi_mck = port:PE01<2><default><default><default> vip_csi_hsync = port:PE02<2><default><default><default> vip_csi_vsync = port:PE03<2><default><default><default> vip_csi_d0 = port:PE04<2><default><default><default> vip_csi_d1 = port:PE05<2><default><default><default> vip_csi_d2 = port:PE06<2><default><default><default> vip_csi_d3 = port:PE07<2><default><default><default> vip_csi_d4 = port:PE08<2><default><default><default> vip_csi_d5 = port:PE09<2><default><default><default> vip_csi_d6 = port:PE10<2><default><default><default> vip_csi_d7 = port:PE11<2><default><default><default> vip_csi_sck = port:PE12<2><default><default><default> vip_csi_sda = port:PE13<2><default><default><default> vip_dev0_mname = "gc2035" vip_dev0_pos = "front" vip_dev0_lane = 1 vip_dev0_twi_id = 2 vip_dev0_twi_addr = 120 vip_dev0_isp_used = 0 vip_dev0_fmt = 0 vip_dev0_stby_mode = 0 vip_dev0_vflip = 1 vip_dev0_hflip = 1 vip_dev0_iovdd = "" vip_dev0_iovdd_vol = 2800000 vip_dev0_avdd = "" vip_dev0_avdd_vol = 2800000 vip_dev0_dvdd = "" vip_dev0_dvdd_vol = 1800000 vip_dev0_afvdd = "" vip_dev0_afvdd_vol = 2800000 vip_dev0_power_en = port:PA17<1><default><default><1> vip_dev0_reset = port:PE14<1><default><default><1> vip_dev0_pwdn = port:PE15<1><default><default><0> vip_dev0_flash_en = vip_dev0_flash_mode = vip_dev0_af_pwdn = vip_dev0_act_used = 0 vip_dev0_act_name = "ad5820_act" vip_dev0_act_slave = 24 vip_dev1_mname = "" vip_dev1_pos = "rear" vip_dev1_lane = 1 vip_dev1_twi_id = 0 vip_dev1_twi_addr = vip_dev1_isp_used = 0 vip_dev1_fmt = 1 vip_dev1_stby_mode = 0 vip_dev1_vflip = 0 vip_dev1_hflip = 0 vip_dev1_iovdd = "" vip_dev1_iovdd_vol = 2800000 vip_dev1_avdd = "" vip_dev1_avdd_vol = 2800000 vip_dev1_dvdd = "" vip_dev1_dvdd_vol = 1500000 vip_dev1_afvdd = "" vip_dev1_afvdd_vol = 2800000 vip_dev1_power_en = vip_dev1_reset = vip_dev1_pwdn = vip_dev1_flash_en = vip_dev1_flash_mode = vip_dev1_af_pwdn = In order to use the OV5640 you need the following: * Change script.bin (/boot/script.bin) to use OV5640 in this section. Use bin2fex and fex2bin tools to edit and change this section. Search forum to get the correct OV5640 configuration. * Edit /etc/modules and add the two lines: ov5640 vfe_v4l2 Boot the board and check if you have: ls /dev/video and if the camera was recognized: dmesg | grep OK CAM500B is on the way, as soon as i get this i post a basic Howto. 2
lordofduct Posted November 18, 2016 Author Posted November 18, 2016 Thanks @lex for confirming those are the steps. So I went and found a fex file on the forums that looked like it might work: [csi0] vip_used = 1 vip_mode = 0 vip_dev_qty = 1 vip_define_sensor_list = 0 vip_csi_pck = port:PE00<2><default><default><default> vip_csi_mck = port:PE01<2><default><default><default> vip_csi_hsync = port:PE02<2><default><default><default> vip_csi_vsync = port:PE03<2><default><default><default> vip_csi_d0 = port:PE04<2><default><default><default> vip_csi_d1 = port:PE05<2><default><default><default> vip_csi_d2 = port:PE06<2><default><default><default> vip_csi_d3 = port:PE07<2><default><default><default> vip_csi_d4 = port:PE08<2><default><default><default> vip_csi_d5 = port:PE09<2><default><default><default> vip_csi_d6 = port:PE10<2><default><default><default> vip_csi_d7 = port:PE11<2><default><default><default> vip_csi_sck = port:PE12<2><default><default><default> vip_csi_sda = port:PE13<2><default><default><default> vip_dev0_mname = "ov5640" vip_dev0_pos = "rear" vip_dev0_lane = 4 vip_dev0_twi_id = 2 vip_dev0_twi_addr = 0x78 vip_dev0_isp_used = 1 vip_dev0_fmt = 0 vip_dev0_stby_mode = 1 vip_dev0_vflip = 1 vip_dev0_hflip = 0 vip_dev0_iovdd = "" vip_dev0_iovdd_vol = 2800000 vip_dev0_avdd = "" vip_dev0_avdd_vol = 2800000 vip_dev0_dvdd = "" vip_dev0_dvdd_vol = 1500000 vip_dev0_afvdd = "" vip_dev0_afvdd_vol = 2800000 vip_dev0_power_en = port:PD14<1><default><default><default> vip_dev0_reset = port:PE14<1><default><default><default> vip_dev0_pwdn = port:PE15<1><default><default><default> vip_dev0_flash_en = vip_dev0_flash_mode = vip_dev0_af_pwdn = vip_dev0_act_used = 0 vip_dev0_act_name = "ad5820_act" vip_dev0_act_slave = 0x18 vip_dev1_mname = "" vip_dev1_pos = "rear" vip_dev1_lane = 1 vip_dev1_twi_id = 0 vip_dev1_twi_addr = vip_dev1_isp_used = 0 vip_dev1_fmt = 1 vip_dev1_stby_mode = 0 vip_dev1_vflip = 0 vip_dev1_hflip = 0 vip_dev1_iovdd = "" vip_dev1_iovdd_vol = 2800000 vip_dev1_avdd = "" vip_dev1_avdd_vol = 2800000 vip_dev1_dvdd = "" vip_dev1_dvdd_vol = 1500000 vip_dev1_afvdd = "" vip_dev1_afvdd_vol = 2800000 vip_dev1_power_en = vip_dev1_reset = vip_dev1_pwdn = vip_dev1_flash_en = vip_dev1_flash_mode = vip_dev1_af_pwdn = ...edit... ok weird, the other stuff I put in my post didn't appear for some reason. Have to retype it. So after a reboot it shows up as /dev/video0. Furthermore the dmesg reports this: admin@nanopim1:~$ dmesg | grep OK [ 4.570152] [VFE]registered sensor subdev is OK! So, looks good. But, ffmpeg and fswebcam still report the same things again: admin@nanopim1:~$ ffmpeg -t 5 -f v4l2 -channel 0 -video_size 1280x720 -i /dev/video0 -pix_fmt nv12 -r 30 \ -b:v 64k -c:v cedrus264 test.mp4 ffmpeg version 3.1.3-1~bpo8+1 Copyright (c) 2000-2016 the FFmpeg developers built with gcc 4.9.2 (Debian 4.9.2-10) configuration: --prefix=/usr --extra-version='1~bpo8+1' --toolchain=hardened --libdir=/usr/lib/arm-linux-gnueabihf --incdir=/usr/include/arm-linux-gnueabihf --cc=cc --cxx=g++ --enable-gpl --enable-shared --disable-stripping --disable-decoder=libopenjpeg --disable-decoder=libschroedinger --enable-avresample --enable-avisynth --enable-gnutls --enable-ladspa --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --disable-libebur128 --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libmodplug --enable-libmp3lame --enable-libopenjpeg --enable-libopus --enable-libpulse --enable-librubberband --enable-librtmp --enable-libschroedinger --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx265 --enable-libxvid --enable-libzvbi --enable-openal --enable-opengl --enable-x11grab --enable-libdc1394 --enable-libiec61883 --enable-libzmq --enable-frei0r --enable-chromaprint --enable-libopencv --enable-libx264 libavutil 55. 28.100 / 55. 28.100 libavcodec 57. 48.101 / 57. 48.101 libavformat 57. 41.100 / 57. 41.100 libavdevice 57. 0.101 / 57. 0.101 libavfilter 6. 47.100 / 6. 47.100 libavresample 3. 0. 0 / 3. 0. 0 libswscale 4. 1.100 / 4. 1.100 libswresample 2. 1.100 / 2. 1.100 libpostproc 54. 0.100 / 54. 0.100 [video4linux2,v4l2 @ 0x144c3d0] ioctl(VIDIOC_S_INPUT): No such device /dev/video0: No such device admin@nanopim1:~$ fswebcam -d /dev/video0 --verbose test.jpg --- Opening /dev/video0... Trying source module v4l2... /dev/video0 opened. src_v4l2_get_capability,87: /dev/video0 information: src_v4l2_get_capability,88: cap.driver: "sunxi-vfe" src_v4l2_get_capability,89: cap.card: "sunxi-vfe" src_v4l2_get_capability,90: cap.bus_info: "sunxi_vfe sunxi_vfe.0" src_v4l2_get_capability,91: cap.capabilities=0x05000001 src_v4l2_get_capability,92: - VIDEO_CAPTURE src_v4l2_get_capability,101: - READWRITE src_v4l2_get_capability,103: - STREAMING No input was specified, using the first. Unable to query input 0. VIDIOC_ENUMINPUT: Invalid argument
@lex Posted November 18, 2016 Posted November 18, 2016 admin@nanopim1:~$ dmesg | grep OK [ 4.570152] [VFE]registered sensor subdev is OK! OV5640 was not recognized. You should have another line with: "ov5640" is OK! check: dmesg | grep OV5640 and dmesg | grep ov5640 and for complete log dmesg | grep VFE
lordofduct Posted November 18, 2016 Author Posted November 18, 2016 Ah, darn... admin@nanopim1:~$ dmesg | grep OV5640 [ 9.081894] [OV5640]error at sensor_detect [ 9.081900] [OV5640]chip found is not an target chip. OK, so chip not a target chip? Does this mean that the camera isn't ov5640??? admin@nanopim1:~$ dmesg | grep ov5640 [ 9.001216] [VFE]Find sensor name is "ov5640", i2c address is 78, type is "YUV" ! [ 9.001226] [VFE]Sub device register "ov5640" i2c_addr = 0x78 start! [ 9.128089] [VFE]Sub device register "ov5640" failed! OK, so it failed. admin@nanopim1:~$ dmesg | grep VFE [ 8.816405] [VFE]cci probe start cci_sel = 0! [ 8.816445] [VFE]cci probe end cci_sel = 0! [ 8.816532] [VFE]cci_init end [ 8.875185] [VFE]Welcome to Video Front End driver [ 8.886588] [VFE]pdev->id = 0 [ 8.895492] [VFE]dev->mipi_sel = 0 [ 8.904752] [VFE]dev->vip_sel = 0 [ 8.913784] [VFE]dev->isp_sel = 0 [ 8.928819] [VFE_WARN]vfe vpu clock is null [ 8.946244] [VFE]..........................vfe clk open!....................... [ 8.959833] [VFE]vfe_init end [ 8.990468] [VFE]probe_work_handle start! [ 9.001192] [VFE]v4l2 subdev register input_num = 0 [ 9.001205] [VFE]vfe sensor detect start! input_num = 0 [ 9.001216] [VFE]Find sensor name is "ov5640", i2c address is 78, type is "YUV" ! [ 9.001226] [VFE]Sub device register "ov5640" i2c_addr = 0x78 start! [ 9.001239] [VFE]v4l2_device_register_subdev return 0 [ 9.001248] [VFE]registered sensor subdev is OK! [ 9.001253] [VFE]Check sensor! [ 9.014558] [VFE]mclk on [ 9.081331] [VFE CCI_0 ERR] Status error at addr_8bit = 78, wr_flag = 1, val = 12f0a30 [ 9.081607] [VFE CCI_0 ERR] Status error at addr_8bit = 78, wr_flag = 1, val = 1000a30 [ 9.081881] [VFE CCI_0 ERR] Status error at addr_8bit = 78, wr_flag = 1, val = 1000a30 [ 9.081908] [VFE]mclk off [ 9.118049] [VFE]vfe sensor subdev unregister! [ 9.128089] [VFE]Sub device register "ov5640" failed! [ 9.138717] [VFE_ERR]vfe sensor register check error at input_num = 0 [ 9.151200] [VFE]V4L2 device registered as video0 [ 9.161457] [VFE]..........................vfe clk close!....................... [ 9.174762] [VFE]probe_work_handle end! [ 10.988651] [VFE]vfe_open [ 10.997761] [VFE]..........................vfe clk open!....................... [ 11.012341] [VFE]vfe_open ok [ 11.012569] [VFE]vfe_close [ 11.012579] [VFE]vfe select input flag = 0, s_input have not be used . [ 11.012596] [VFE]..........................vfe clk close!....................... [ 11.012625] [VFE]vfe_close end [ 11.054387] [VFE]vfe_open [ 11.054403] [VFE]..........................vfe clk open!....................... [ 11.054441] [VFE]vfe_open ok [ 11.054618] [VFE]vfe_close [ 11.054628] [VFE]vfe select input flag = 0, s_input have not be used . [ 11.054644] [VFE]..........................vfe clk close!....................... [ 11.054673] [VFE]vfe_close end I honestly have no idea what this all means.
nz1 Posted November 18, 2016 Posted November 18, 2016 Sorry, I was actually referring to the gc2035 camera in message #2. My mistake.
lvmc Posted November 19, 2016 Posted November 19, 2016 @lordofduct, can you provide me remote SSH access to your board? I can check the ov5640 stuff for you. Me and @lex has been doing an extensive job to support cameras on cheap boards. Send me a private message, if you need help. 1
g40 Posted July 29, 2017 Posted July 29, 2017 Greetings. I cannot get my M1 to recognize that the cam500B is attached at all. I am using the Ubuntu xenial headless image here: https://dl.armbian.com/nanopim1/Ubuntu_xenial_default.7z Anyone got a quick solution before I start hacking into the VFE code? The `[ISP] isp platform_id = 5!` is unusual ... TAIA Jerry ~$ uname -a Linux nanopim1 3.4.113-sun8i #28 SMP PREEMPT Thu Feb 2 02:01:28 CET 2017 armv7l armv7l armv7l GNU/Linux nanopim1:~$ lsmod Module Size Used by vfe_v4l2 1015779 0 videobuf_dma_contig 3509 1 vfe_v4l2 videobuf_core 14682 2 vfe_v4l2,videobuf_dma_contig ov5640 42234 0 vfe_subdev 4507 2 vfe_v4l2,ov5640 cci 22800 2 vfe_v4l2,ov5640 vfe_os 4277 3 cci,vfe_v4l2,vfe_subdev pcf8591 3363 0 bmp085 3487 0 btrfs 712409 0 nanopim1:~$ dmesg | tail [ 59.082564] [OV5640@lex]init_sensor - frame_rate: 0, max_win_size: 11 [ 72.413069] [ISP] isp platform_id = 5! [ 72.420133] [VFE_ERR]Error registering v4l2 subdevice No such device!
@lex Posted July 29, 2017 Posted July 29, 2017 Please, firstly make sure your M1 version supports CAM500B. Earlier version had support for the CAM500A, if that is the case the CAM500B is not going to work with this M1 pcb version. I have no idea when they have released the board to work with CAM500B. Some users had some issues (detecting the camera i mean, search the forum, there is a workaround for that) with newer Armbian release, maybe you could try older version an see if it is detected. Hope this help.
g40 Posted July 29, 2017 Posted July 29, 2017 Hi and thanks. Hmm. Hard to tell. These are the 1GB models and were acquired in the last few months. The friendlyarm website has this: http://www.friendlyarm.com/index.php?route=product/product&product_id=155&search=cam500b&description=true&category_id=0&sub_category=true which claims the 500B matches the H3. If you have this combination working one thing to know would be if I've got the cable orientated correctly. The (silver) connector side faces the inside of the board, whilst the blue insulation faces out. Does that make sense?
@lex Posted July 29, 2017 Posted July 29, 2017 Looks like the connection is OK and the board is new and should be CAM500B compactible. Have a look at: Try to edit the script.bin and check if i2c is available for the CSI, something like: [twi2] twi_used = 0 Hope this helps
g40 Posted July 30, 2017 Posted July 30, 2017 Thank you for the picture. Most reassuring Which options did you use for the distro/kernel? And did the camera work out of the box? TAIA
g40 Posted July 30, 2017 Posted July 30, 2017 The twi2 settings seem correct but I'm wondering about the CSI definition itself. Does this match your own script.bin? RTAIA. [csi0] vip_used = 1 vip_mode = 0 vip_dev_qty = 1 vip_define_sensor_list = 0 vip_csi_pck = port:PE00<2><default><default><default> vip_csi_mck = port:PE01<2><default><default><default> vip_csi_hsync = port:PE02<2><default><default><default> vip_csi_vsync = port:PE03<2><default><default><default> vip_csi_d0 = port:PE04<2><default><default><default> vip_csi_d1 = port:PE05<2><default><default><default> vip_csi_d2 = port:PE06<2><default><default><default> vip_csi_d3 = port:PE07<2><default><default><default> vip_csi_d4 = port:PE08<2><default><default><default> vip_csi_d5 = port:PE09<2><default><default><default> vip_csi_d6 = port:PE10<2><default><default><default> vip_csi_d7 = port:PE11<2><default><default><default> vip_csi_sck = port:PE12<2><default><default><default> vip_csi_sda = port:PE13<2><default><default><default> vip_dev0_mname = "gc2035" vip_dev0_pos = "front" vip_dev0_lane = 1 vip_dev0_twi_id = 2 vip_dev0_twi_addr = 120 vip_dev0_isp_used = 0 vip_dev0_fmt = 0 vip_dev0_stby_mode = 0 vip_dev0_vflip = 1 vip_dev0_hflip = 1 vip_dev0_iovdd = "" vip_dev0_iovdd_vol = 2800000 vip_dev0_avdd = ""
@lex Posted July 30, 2017 Posted July 30, 2017 1 hour ago, g40 said: vip_dev0_mname = "gc2035" This is for the GC2035 (OrangePi camera) sensor, you need OV5640 configuration, please read @lordofduct answer in this thread. 1
g40 Posted July 30, 2017 Posted July 30, 2017 Perfect. Thanks very much. Help greatly appreciated. For anyone else with the same issue I've attached a working FEX file. Back up the existing copy (/boot/script.bin), compile with fex2bin script.fex > script.bin and copy the new file into /boot. Reboot, modprobe the OV5640 and vfe_v4l2 modules. You should then have a /dev/video0. v4l-utils contains v4l-ctl. Trying to get a control listing will end up with a load of errors in dmesg but this is a driver shortcoming, not a hardware problem. The attached bitmap is a VGA sized snap. Note it is backwards script.fex desktop.bmp
@lex Posted July 30, 2017 Posted July 30, 2017 Try to change this two flags: vip_dev0_vflip = 1 (vertical) => 0 : 1 vip_dev0_hflip = 1 (horizontal) => 0 : 1
Recommended Posts