BPI-M2+ OV5640 camera linux driver is work fine

BPI-M2+ OV5640 camera linux driver is work fine :)

‘Fine’? OV5640 is a 5MP camera and you show us 640x480 pixel and call this fine? Really?

Can we take this already as a confirmation that you are not able to improve the situation with the OV5640 camera driver and 640x480 is still the maximum we get (as it’s the situation with M1/M1+ since years)? What about framerates?

we just fixed driver issue on BPI-M2+, and will update driver to github, maybe you can help us fixed more issue.

Where is the driver working? None of your Ubuntu images are working with any OV5640.

[ 1100.777091] [VFE]vfe_open [ 1100.777115] [VFE]…vfe clk open!.. [ 1100.777151] [VFE]vfe_open ok [ 1100.777538] [VFE]Set vfe core clk = 216000000, after Set vfe core clk = 200000000 [ 1100.777554] NOT_SUPPORT_THIS_FUNCTION:sun8iw7p1_isp_set_table_addr, line: 372 [ 1100.790867] [VFE]mclk on [ 1100.920523] [VFE_WARN]v4l2 sub device queryctrl unsuccess,id = 80000000! [ 1100.920594] [VFE_ERR]try bayer bus error when pix fmt is bayer rgb at try_fmt_internal! [ 1100.929478] [VFE_ERR]pixel format (0x20363159) width 384 height 288 invalid at vidioc_try_fmt_vid_cap. [ 1100.940133] [VFE]vfe_close [ 1100.940147] [VFE]mclk off [ 1100.976308] [VFE]…vfe clk close!.. [ 1100.976339] [VFE]vfe_close end

This is your github commit history: https://github.com/BPI-SINOVOIP/BPI-M2P-bsp/commits/master

Everyone can have a look. So why do you tell always these moronic stories you would work on the software side of things since you don’t? You fiddle around in the sources here and there from time to time and that’s it. Please show us a demonstration that you got the camera working. Not a fake video as usual but one as proof of a working camera driver that only shows BPi M2+, camera module and video output on a connected display.

new driver:

Hi,

I use the latest armbian 5.20. I succeed to use an USB webcam on it but I didn’t find any information or help to use a 5640 camera module with it. Do you have some information or link to help me? Thank you

the steps:

  • Edit /etc/modules and add the two line: ov5640 vfe_v4l2

  • Edit script.bin and make sure you have the OV5640 enabled search Armbian for the tools and how to edit it

  • reboot with the sensor attached

  • check if the sensor was recognized: dmesg | grep ov5640 or dmesg | grep OK

  • Always check for updates and fix and latest drivers as Igor has announced: http://image.armbian.com/

Hope it helps.

Thank you for your help Avaf.

I add the module in /etc/modules and I checked that OV5640 was enabled in script.bin.

Unfortunately the sensor is not recognized: no ov5640 in the dmesg log.

I will check for update and fix.

I don’t know if somebody else has already test the camera with armbian on BPi M2+

Oups, my mistake, I miss these 2 messages in dmesg:

[ 5.242088] [OV5640@lex]CSI_SUBDEV_PWR_ON! [ 5.310824] [OV5640@lex]CSI_SUBDEV_PWR_OFF!

I will check why the device is powered off

Hi,

I switch back on this point.

I tried again to make my camera working. So, I load the 2 modules: ov5640 followed by vfe_v4l2

root@ice001:~# sudo modprobe ov5640 root@ice001:~# dmesg [ 76.635959] [OV5640@lex]init_sensor - frame_rate: 0, max_win_size: 11 root@ice001:~#

root@ice001:~# sudo modprobe vfe_v4l2 root@ice001:~# dmesg [ 76.635959] [OV5640@lex]init_sensor - frame_rate: 0, max_win_size: 11 [ 129.559950] [ISP] isp platform_id = 5! [ 129.572122] [OV5640@lex]CSI_SUBDEV_PWR_ON! [ 129.640038] [OV5640@lex]sensor_init 0x0 [ 129.640789] [OV5640@lex]sensor read retry=2 [ 129.640800] [OV5640@lex]error at sensor_detect [ 129.640808] [OV5640@lex]chip found is not an target chip. [ 129.640818] [OV5640@lex]CSI_SUBDEV_PWR_OFF! root@ice001:~#

I use the following ov5640 module:

Any help will be apreciated Thank you BR

You need Sinovoip OV5640 or you need to reverse the pins 180º to make this sensor work.

I tried to reverse the cable, but it seems not possible to simply reverse the cable of my camera. Do you have a simple solution to do it? any idea?

Thanks again for your help.

we ust test our OV5640 module on BPI-M2+

https://bananapi.gitbooks.io/bpi-m2-/content/en/bpim2+csicamerainterface.html

Hi @avaf / @sinovoip,

I am trying to get this camera working, I have both a BPI-M2M and BPI-M2Z and I am trying to get the OV5640 working on either one of them and I get the same error on both: [OV5640]error at sensor_detect

I am using the HDF5640 camera module but I cannot find a pinout of the CSI connector anywhere for these modules, the only pin outs I can find are for the 40-pin connector, not the 24pin found on the M2M and the M2Z.

BPI-M2M-HDF5640-qnt

Above is the board (with camera) and below is the boot log part where I get the error:

[   11.762415] systemd[1]: Started Journal Service.
[   17.350387] EXT4-fs error (device mmcblk0p2): ext4_mb_generate_buddy:741: group 15, 9216 clusters in bitmap, 9179 in gd
[   21.850386] [VFE_DEV_I2C_ERR]cci_read_a16_d8 error! slave = 0x3c, addr = 0x300a, value = 0xd5
[   21.850392]  
[   21.877717] [VFE_DEV_I2C_ERR]cci_read_a16_d8 error! slave = 0x3c, addr = 0x300a, value = 0xd5
[   21.877723]  
[   21.878003] [VFE_DEV_I2C_ERR]cci_read_a16_d8 error! slave = 0x3c, addr = 0x300a, value = 0xd5
[   21.878009]  [OV5640]error at sensor_detect
[   21.912067] ctp_fetch_sysconfig_para: ctp_power_io script_get_item err. 
[   21.912081] ctp_irq gpio number is 37
[   21.916845] [VFE_ERR]vfe sensor register check error at input_num = 0


Ubuntu 16.04.3 LTS bpi-iot-ros-ai ttyS2

bpi-iot-ros-ai login: 

If you have any ideas at all or if you know where I can find a pin diagram for the 24-pin CSI connector I would be incredibly grateful.

Thanks

Flex,

You need a camera sensor with the pins reversed 180 º, like this: pin 1 sensor => pin 24 board, pin 2 sensor => pin 23 board, and so on.

You have two choices:

  • Buy a BPI camera sensor
  • Reverse the pins

This has been extensively discussed here:

Edit: all schematics here: https://drive.google.com/drive/u/0/folders/0B4PAo2nW2KfnflVqbjJGTFlFTTd1b1o1OUxDNk5ackVDM0RNUjBpZ0FQU19SbDk1MngzZWM?tid=0B4PAo2nW2Kfndjh6SW9MS2xKSWs

Hi Avaf,

Thanks for this, the schematics are very useful :slight_smile:

I did read somewhere about reversing the pins and I have tried this but I don’t think its making a decent connection as I get the same error, I have bought some breakout boards and ribbon cable so I can try reversing the pins, once they arrive I will give it another go.

I did try to find some of the BPI camera sensors however unless I wait a month for delivery or pay €30 extra I can’t get them in my country, I was trying to use a sensor that was readily available. With the pins reversed I get the following error:

root@bpi-iot-ros-ai:/home/pi# dmesg | grep -P 'ov564|OV564|VFE'
[ 9.171912] [OV5640@lex]init_sensor - frame_rate: 0, max_win_size: 11
[ 9.310135] [OV5640@lex]CSI_SUBDEV_PWR_ON!
[ 9.388408] [OV5640@lex]sensor_init 0x0
[ 9.398437] [OV5640@lex]sensor read retry=2
[ 9.407827] [OV5640@lex]error at sensor_detect
[ 9.417251] [OV5640@lex]chip found is not an target chip.
[ 9.427711] [OV5640@lex]CSI_SUBDEV_PWR_OFF!

I assume that means the pins are not making contact properly? (This is on the M2Z)

Thanks for your help.

BPI OV5640 Camera works with M2Z (Armbian by bpi) if i recall correctly, no changes were necessary. I can’t remember if attaching a sensor without the pins reversed could damage the sensor. You have to check if 3.3v was not applied to a pin that should get 2.8v, only you can check this by reading your sensor pinout.

sensor read retry=2 usually means that it could not talk to the sensor via i2c (SDA/CLK), one possibility is TWI2 (you can search if is TW1 or TW2) is in use on your fex. You must not enable it, or are not making contact.

As you could see on that thread, the author did the reversing successfully and i could not do that… :wink:

Ah maybe its TWI thats the problem then?

I’ve just looked in my fex file and it has this:

[twi0]
twi_used = 1
twi_scl = port:PH02<2><default><default><default>
twi_sda = port:PH03<2><default><default><default>

[twi1]
twi_used = 1
twi_scl = port:PH04<2><default><default><default>
twi_sda = port:PH05<2><default><default><default>

[twi2]
twi_used = 1
twi_scl = port:PE12<3><default><default><default>
twi_sda = port:PE13<3><default><default><default>

So should I disable TWI2 or all of them?

Thanks again, your help is much appreciated.