2 2

OV5640 not working NanoPi Neo Air

Recommended Posts

I haven't had any luck getting the ov5640 camera module working with the nanopi air. I have compiled the latest dev version of bionic and enabled the ov5640 as a module in menuconfig. I currently cannot get it showing up under /dev/video*


Any ideas?

Share this post

Link to post
Share on other sites

A couple of things to check:


* check if ov5640 and csi are loaded. 


dmesg|grep 5640 & dmesg|grep csi


* check if you have the correct camera module


Share this post

Link to post
Share on other sites

Thanks for your reply!


I double checked I definitely have the cam500b. This is the output of:

dmesg|grep 5640 & dmesg|grep csi
root@nanopiair:~# dmesg|grep 5640 & dmesg|grep csi
[1] 1425
[    8.895031] ov5640 0-003c: Linked as a consumer to regulator.5
[    8.895101] ov5640 0-003c: Linked as a consumer to regulator.6
[    8.895156] ov5640 0-003c: Linked as a consumer to regulator.4
[1]+  Done                    dmesg | grep --color=auto 5640

It looks like the ov5640 driver has loaded but not the CSI?

Share this post

Link to post
Share on other sites

Hello cam,


I managed to get the camera module ov3640 working with the NanoPi M1 and OrangePi PC+ on armbian with Ubuntu xenial (3.4.113). A driver for the ov3640 is missing there, so I used a driver for the ov5640 with some modifications.


In addition, I had to change a section [csi0] in the /boot/script.bin (it's a symbolic link) file. You can convert the linked BIN file (probably /boot/bin/nanopiair.bin) to readable FEX file by command bin2fex. You can edit the FEX file and convert it back to BIN file by command fex2bin.  For more information just visit http://linux-sunxi.org/Fex_Guide


In the section csi_gpio_configuration of that page you can see something like this:

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 = "ov3640"
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 = 0
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

This is a configuration for the CSI interface. Note the important properties: 

  • vip_dev0_mname - kernel module name, in my case it is ov3640. You should set it to ov5640.
  • vip_dev0_twi_addr - I2C (TWI) address of your I2C device. For the OV5640 it is 0x78 but must be set in decimals which is 120.

Everything else should be left as it was.


After changing the FEX file you have to convert it back to the BIN file and store it at the same location as before. Then reboot is needed.


Afterwards, you need to load the modules:

# modprobe ov5640 vfe_v4l2

Also you can check system logs to see more information:

# dmesg


Hopefully, I helped you ;) 


Good luck!

Share this post

Link to post
Share on other sites
On 11/20/2018 at 11:20 PM, cam said:

It looks like the ov5640 driver has loaded but not the CSI?

I was looking for errors, CSI does not really show up in dmesg.

Seems no errors.


I think more info is needed so others can help: armbianmonitor -u


PS: You should have something similar to this depending on how is your kernel defconfig:


Module                  Size  Used by
sun6i_csi              24576  0
videobuf2_dma_contig    20480  1 sun6i_csi
ov5640                 32768  1
videobuf2_memops       16384  1 videobuf2_dma_contig
videobuf2_v4l2         20480  1 sun6i_csi
v4l2_fwnode            16384  2 ov5640,sun6i_csi
videobuf2_common       36864  2 sun6i_csi,videobuf2_v4l2
v4l2_common            16384  1 ov5640
videodev              139264  6 ov5640,v4l2_fwnode,v4l2_common,videobuf2_common,sun6i_csi,videobuf2_v4l2
sunxi_cir              16384  0
media                  24576  3 ov5640,videodev,sun6i_csi
hci_uart               36864  0
btintel                16384  1 hci_uart
bluetooth             327680  2 hci_uart,btintel
ecdh_generic           28672  1 bluetooth
brcmfmac              188416  0
brcmutil               16384  1 brcmfmac
ipv6                  397312  18


Edited by @lex
modules loaded as reference

Share this post

Link to post
Share on other sites

OS: Armbian_5.67_Nanopiair_Ubuntu_xenial_next_4.14.88.img, Ubuntu 16.04.5 LTS


Trying to get the CAM500B working with ov5640. Nothing looks anything like what's been described here.


No sign of 5640 or csi in dmesg. No /dev/video0. No vfe_v4l2 module available.

No /boot/script.bin. No /boot/bin/nanopiair.bin.


cir, i2c, spi are active from armbian-config.


I have


It loads (modprobe). Nothing changes in dmesg.


Any clues much appreciated!




Share this post

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

2 2