BPI M3 Front camera (OV5640) not working


(bpibananasai) #1
Hi,
I am using BPI M3 with camera module https://bananapi.gitbooks.io/bpi-accessories/en/bpim3camera.html, following the instructions on https://bananapi.gitbooks.io/bpi-m3/en/bpim3csicamerainterface.html
I am able to capture images from ov8865. 


However, following the same instructions for OV5640, 
How to use OV5640 on BPI-M3:
Step 1: Install git
$ sudo apt-get install git
Step 2: Update bpi-tools
$ git clone https://github.com/BPI-SINOVOIP/bpi-tools.git5
(NOTE: git5 is incorrect, it should be git)
$ cd bpi-tools

$ sudo ./bpi.tools -u -U
Step 3: Use bpi-update to update kerenl
$ mkdir update\_file
$ cd update\_file
$ sudo bpi-update -c bpi-m3.conf
(NOTE: THERE IS NO ov5640 driver in update in bpi-tools)
$ sudo reboot 

The Kernel did not upgrade. 

This is what I have:
uname -a
Linux bpi-iot-ros-ai 3.4.39-BPI-M3-Kernel #1 SMP PREEMPT Fri Nov 3 01:03:00 UTC 2017 armv7l armv7l armv7l GNU/Linux


ls  update_file/
3.4.39-BPI-M3-Kernel.tgz    bpi-m3-ov8865.conf  camera.tgz
addons.tgz                  bpi-service.tgz     libvdpau_sunxi.tgz
BOOTLOADER-bpi-m3.tgz       bpi-tools.tgz       ov5640
BPI-BOOT-bpi-m3-ov8865.tgz  brcm.tgz            ov8865-enable.tgz
BPI-BOOT-bpi-m3.tgz         bt.tgz              ov8865.tgz
bpi-m3.conf                 camera-apps.tgz


I am not sure if  it is the driver issue or the camera (ov5640) board is incorrect. 
I saw in the BPI-M3 schematics CSI-PWDN-F is connected to PD15 pin of A83T, while in the A83T_TABLET_STD_V1_2 schematics CSI-PWDN-F is connected to PE19.

Tried to contact Nora.Lee but she is not helpful, although she showed the video of ov5640.

#2

another thing to check for possible errors:

dmesg|grep ov and dmesg|grep OV

and if i recall correctly, you need I2C available to talk to ov5640 sensor, so you must disable one if one is used for other purpose. Can’t remember if it was twi1 or twi2 that must be disabled, please check the PINs used.


(bpibananasai) #3
Thanks for your reply:

pi@bpi-iot-ros-ai:~$ dmesg | grep VFE
[    9.136218] [VFE]cci probe start cci_sel = 0!
[    9.152809] [VFE]cci probe end cci_sel = 0!
[    9.187240] [VFE]cci_init end
[    9.312962] [VFE]Welcome to Video Front End driver
[    9.331119] [VFE]pdev->id = 0
[    9.345263] [VFE]dev->mipi_sel = 0
[    9.359411] [VFE]dev->vip_sel = 0
[    9.390617] [VFE]dev->isp_sel = 0
[    9.410906] [VFE_WARN]vfe vpu clock is null
[    9.420493] [VFE]vfe_init end
[    9.430115] [VFE]probe_work_handle start!
[    9.430138] [VFE]..........................vfe clk open!.......................
[    9.430461] [VFE]v4l2 subdev register input_num = 0
[    9.430642] [VFE]vfe sensor detect start! input_num = 0
[    9.430668] [VFE]Find sensor name is "ov5640", i2c address is 78, type is "YUV" !
[    9.430691] [VFE]Sub device register "ov5640" i2c_addr = 0x78 start!
[    9.430716] [VFE_ERR]Error registering v4l2 subdevice No such device!
[    9.430737] [VFE_ERR]vfe sensor register check error at input_num = 0
[    9.430772] [VFE]V4L2 device registered as vfe-0
[    9.430868] [VFE]..........................vfe clk close!.......................
[    9.430915] [VFE]probe_work_handle end!


pi@bpi-iot-ros-ai:~$ dmesg | grep ov
[    0.000000] Linux version 3.4.39-BPI-M3-Kernel (root@9f35b27b2653) (gcc version 4.6.3 (Ubuntu/Linaro 4.6.3-1ubuntu5) ) #1 SMP PREEMPT Fri Nov 3 01:03:00 UTC 2017
[    2.441820]  lun0: LUN: removable file: (no medium)
[    2.441837]  lun1: LUN: removable file: (no medium)
[    2.441852]  lun2: LUN: removable file: (no medium)
[    4.157970] [mmc]: SD/MMC/SDIO Host Controller Driver(v1.113 2015-5-20 17:17) Compiled in Nov  3 2017 at 01:01:57
[    5.665073] IPv4 over IPv4 tunneling driver
[    9.430668] [VFE]Find sensor name is "ov5640", i2c address is 78, type is "YUV" !
[    9.430691] [VFE]Sub device register "ov5640" i2c_addr = 0x78 start!
[   47.461932] Compiled in drivers/net/wireless/bcmdhd on Nov  3 2017 at 01:02:11
[   53.088540] Compiled in drivers/net/wireless/bcmdhd on Nov  3 2017 at 01:02:11
[   62.495873] netlink: 20 bytes leftover after parsing attributes.
[   62.495924] netlink: 20 bytes leftover after parsing attributes.
[   62.496603] netlink: 20 bytes leftover after parsing attributes.
[   62.497161] netlink: 20 bytes leftover after parsing attributes.
[   63.296971] netlink: 20 bytes leftover after parsing attributes.
[   63.297044] netlink: 20 bytes leftover after parsing attributes.
[   63.297857] netlink: 20 bytes leftover after parsing attributes.
[   63.298557] netlink: 20 bytes leftover after parsing attributes.
pi@bpi-iot-ros-ai:~$ ls -la /dev/video0
ls: cannot access '/dev/video0': No such file or directoryPreformatted text

(bpibananasai) #4
pi@bpi-iot-ros-ai:~$ dmesg | grep ov
[    0.000000] Linux version 3.4.39-BPI-M3-Kernel (root@9f35b27b2653) (gcc version 4.6.3 (Ubuntu/Linaro 4.6.3-1ubuntu5) ) #1 SMP PREEMPT Fri Nov 3 01:03:00 UTC 2017
[    2.441820]  lun0: LUN: removable file: (no medium)
[    2.441837]  lun1: LUN: removable file: (no medium)
[    2.441852]  lun2: LUN: removable file: (no medium)
[    4.157970] [mmc]: SD/MMC/SDIO Host Controller Driver(v1.113 2015-5-20 17:17) Compiled in Nov  3 2017 at 01:01:57
[    5.665073] IPv4 over IPv4 tunneling driver
[    9.430668] [VFE]Find sensor name is "ov5640", i2c address is 78, type is "YUV" !
[    9.430691] [VFE]Sub device register "ov5640" i2c_addr = 0x78 start!
[   47.461932] Compiled in drivers/net/wireless/bcmdhd on Nov  3 2017 at 01:02:11
[   53.088540] Compiled in drivers/net/wireless/bcmdhd on Nov  3 2017 at 01:02:11
[   62.495873] netlink: 20 bytes leftover after parsing attributes.
[   62.495924] netlink: 20 bytes leftover after parsing attributes.
[   62.496603] netlink: 20 bytes leftover after parsing attributes.
[   62.497161] netlink: 20 bytes leftover after parsing attributes.
[   63.296971] netlink: 20 bytes leftover after parsing attributes.
[   63.297044] netlink: 20 bytes leftover after parsing attributes.
[   63.297857] netlink: 20 bytes leftover after parsing attributes.
[   63.298557] netlink: 20 bytes leftover after parsing attributes.
pi@bpi-iot-ros-ai:~$ ls -la /dev/video0
ls: cannot access '/dev/video0': No such file or directory

#5

two possible things:

  • i2c is not avaiable as i have written on another post (please, read and apply the necessary changes)
  • your sensor is not properly connected (are you using the one from Sinovoip?)

(bpibananasai) #6
Can you please point me to the post for the i2c changes?

Sensor is working properly, ov8860 works fine, I am able to take pictures with it from ffmpeg.
https://www.ebay.com/i/322615981069?chn=ps

(bpibananasai) #7
I think the problem is the kernel code, I am looking at /media/pi/BPI-BOOT/bananapi/bpi-m3/linux/sys_config.fex.ov8865 (**NO sys_config.fex.ov5640 present**). The pwdn pin is connected to PE19 instead of PE15 as shown in schematics.

vip_dev1_mname           = "hi253"
vip_dev1_pos                 = "front"
vip_dev1_lane            = 1
vip_dev1_twi_id = 0
vip_dev1_twi_addr = 64
vip_dev1_isp_used        = 0
vip_dev1_fmt             = 0
vip_dev1_stby_mode       = 1
vip_dev1_vflip           = 0
vip_dev1_hflip           = 0
vip_dev1_iovdd           =
vip_dev1_iovdd_vol       =
vip_dev1_avdd            = "axp81x_dldo4"
vip_dev1_avdd_vol        = 2800000
vip_dev1_dvdd            = "axp81x_eldo3"
vip_dev1_dvdd_vol        = 1800000
vip_dev1_afvdd           =
vip_dev1_afvdd_vol       =
vip_dev1_power_en        =
vip_dev1_reset           = port:PE18<1><default><default><default>
**vip_dev1_pwdn            = port:PE19<1><default><default><default>**
vip_dev1_flash_en        =
vip_dev1_flash_mode      =
vip_dev1_af_pwdn         =

#8

You should have this FEX section (as an example) with OV5640 configuration and not with OV8865:

About the i2c i think is related to H3 and not M3, ignore this.

You coud decompile the script.bin and check if you have ov5640 in this section.


(bpibananasai) #9

Hi, What is the location of script.bin and how can I decompile it. Thanks,