Jump to content

using ov5640 with sopine/pine64so baseboard


Recommended Posts

Has anyone gotten the ov5640 camera working with the SOPINE and baseboard?  I'm using a prebuilt image from https://www.armbian.com/download/ - Armbian 5.38 stable Ubuntu 16.04.4 LTS 3.10.107-pine64

I've set camera_type=ov5640 in /boot/armbianEnv.txt and rebooted, but I'm having some trouble loading the camera module:

Spoiler

 


pi@pine64so:~$ sudo modprobe -r -f ov5640
pi@pine64so:~$ sudo modprobe -r -f vfe_v4l2
pi@pine64so:~$ sudo modprobe ov5640
pi@pine64so:~$ sudo modprobe vfe_v4l2
pi@pine64so:~$ dmesg
[  241.175358] [OV5640@lex]sensor_remove ov5640 sd = ffffffc076b9be00!
[  250.718969] [VFE]vfe_exit
[  250.719007] [VFE]vfe_runtime_resume
[  250.730977] [VFE]..........................vfe clk open!.......................
[  250.730983] [VFE_WARN]vfe dphy clock is null
[  250.731034] [VFE]vfe_runtime_suspend
[  250.731038] [VFE]..........................vfe clk close!.......................
[  250.737214] [VFE_WARN]os_gpio_release, hdl is INVALID
[  250.737232] [VFE_WARN]os_gpio_release, hdl is INVALID
[  250.737236] [VFE_WARN]os_gpio_release, hdl is INVALID
[  250.737239] [VFE_WARN]os_gpio_release, hdl is INVALID
[  250.737258] sunxi_vfe vfe.13: unregistering (null)
[  250.737283] [VFE]vfe_remove ok!
[  250.738752] [VFE]platform_driver_unregister
[  250.738767] [VFE]vfe_release ok!
[  250.738771] [VFE]csi_exit start
[  250.740101] [VFE]csi_exit end
[  250.740119] [VFE]sunxi_isp_platform_unregister start
[  250.740604] [VFE]isp_device_release
[  250.741806] [VFE]sunxi_isp_platform_unregister end
[  250.741820] [VFE]mipi_exit start
[  250.742222] [VFE]mipi_device_release
[  250.742440] [VFE]mipi_exit end
[  250.742445] [VFE]flash_exit start
[  250.742449] [VFE]flash_exit end
[  250.742452] [VFE]vfe_exit end
[  250.747405] [VFE]cci_exit start
[  250.747703] [VFE]cci_exit end
[  258.372331] [VFE]cci probe end cci_sel = 0!
[  258.372568] [VFE]cci_init end
[  258.373650] [OV5640@lex]init_sensor - frame_rate: 0, max_win_size: 11
[  258.373715] [OV5640@lex]sensor_probe - frame_rate: 0
[  263.277353] [VFE]Welcome to Video Front End driver
[  263.277778] [VFE]csi probe end csi_sel = 0!
[  263.278087] [VFE]csi_init end
[  263.278651] [VFE]isp probe start isp_sel = 0!
[  263.279866] [ISP] isp platform_id = 3!
[  263.279896] [VFE]isp probe end isp_sel = 0!
[  263.280054] [VFE]sunxi_isp_platform_register end
[  263.280610] [VFE]mipi probe start mipi_sel = 0!
[  263.280640] [VFE]mipi probe end mipi_sel = 0!
[  263.280725] [VFE]mipi_init end
[  263.280732] [VFE]flash_init end
[  263.281649] [VFE]pdev->id = 0
[  263.281667] [VFE]dev->vip_sel = 0
[  263.281697] [VFE_WARN]fetch csi0_dev0_twi_id from device_tree failed
[  263.281733] [VFE_WARN]fetch csi0_dev0_afvdd from device_tree failed
[  263.281740] [VFE_WARN]fetch csi0_dev0_afvdd_vol from device_tree failed
[  263.281749] [VFE_WARN]fetch csi0_dev0_power_en from device_tree failed
[  263.281798] [VFE_WARN]fetch csi0_dev0_flash_en from device_tree failed
[  263.281806] [VFE_WARN]fetch csi0_dev0_flash_mode from device_tree failed
[  263.281818] [VFE_WARN]fetch csi0_dev0_af_pwdn from device_tree failed
[  263.282294] [VFE]vfe_init end
[  263.284221] [VFE]probe_work_handle start!
[  263.284410] [VFE]vfe_runtime_resume
[  263.296358] [VFE]..........................vfe clk open!.......................
[  263.296371] [VFE_WARN]vfe dphy clock is null
[  263.296394] [VFE]v4l2 subdev register input_num = 0
[  263.296542] [VFE]vfe sensor detect start! input_num = 0
[  263.296551] [VFE]Find sensor name is "ov5640", i2c address is 78, type is "YUV" !
[  263.296556] [VFE]Sub device register "ov5640" i2c_addr = 0x78 start!
[  263.296565] [VFE]v4l2_device_register_subdev return 0
[  263.296569] [VFE]registered sensor subdev is OK!
[  263.296572] [VFE]Check sensor!
[  263.309107] [OV5640@lex]CSI_SUBDEV_PWR_ON!
[  263.310333] [VFE]mclk on
[  263.377031] [OV5640@lex]sensor_init: 0x0
[  263.377283] [VFE CCI_0 ERR] Status error at addr_8bit = 78, wr_flag = 1, val = fc540a30
[  263.377524] [VFE CCI_0 ERR] Status error at addr_8bit = 78, wr_flag = 1, val = fc540a30
[  263.377765] [VFE CCI_0 ERR] Status error at addr_8bit = 78, wr_flag = 1, val = fc540a30
[  263.377773] ov5640 sensor read retry=2
[  263.377778] [OV5640@lex]error at sensor_detect
[  263.377781] [OV5640@lex]chip found is not an target chip.
[  263.377786] [OV5640@lex]CSI_SUBDEV_PWR_OFF!
[  263.377790] [VFE]mclk off
[  263.413710] [VFE]vfe sensor subdev unregister!
[  263.413721] [VFE]Sub device register "ov5640" failed!
[  263.413726] [VFE_ERR]vfe sensor register check error at input_num = 0
[  263.413737] [VFE]V4L2 device registered as (null)
[  263.413774] [VFE]vfe_runtime_suspend
[  263.413778] [VFE]..........................vfe clk close!.......................
[  263.419840] [VFE]probe_work_handle end!

Here's a link from armbianmonitor diagnostics: http://ix.io/11OU

 

I've attached an image of the sensors I'm trying to use.

 

I originally bought these from the Banana Pi folks for use with the M64, so I thought they should also work with the SOPINE. 

 

Any ideas are appreciated! 

 

Thanks,

Max

20180324_075028.jpg

Edited by Tido
Added spoiler
Link to comment
Share on other sites

There are only contacts on one side of the FFC, so if you plugged them in the wrong way, should still be fine since it's isolated? Did you check if the BPi camera has the same pinout as the Pine64 camera module?

Link to comment
Share on other sites

They look the same but reversed... The cables only have contacts on one side, but I thought that it looked like the connector had contacts on both sides. 

 

You're right though. I cut open one of the cables and tested it with a multimeter.  When the contacts on the ribbon are facing up (the wrong way for the connector, the right way for the sopine), there is no connection made.

 

I tried using them in a bpi m64 without any luck, so I though for sure the cameras were dead. I'll have to give that another try.

 

bpi m64 connector:

bpim64-camera-connector.png

 

sopine baseboard connector:

pine64so-camera-connector.png

Link to comment
Share on other sites

I looked around for an ov5640 that would work with the sopine/pine64 board connectors but didn't have any luck. Anyone know a place to buy these?

 

Anyway, I bought a "Himax 5 Megapixel Camera Module" from the pine64 store. I tested it out on the pre-built ubuntu desktop legacy image (Armbian_5.38_Pine64_Ubuntu_xenial_default_3.10.107_desktop) and the image quality is pretty good! However, when I try capturing an image on the headless version (Armbian_5.38_Pine64_Ubuntu_xenial_default_3.10.107), the device locks up:

 

pi@pine64:~$ fswebcam  -r 640x480 -p YUV420P  test.jpg

--- Opening /dev/video0...

Trying source module v4l2...

/dev/video0 opened.

No input was specified, using the first.

--- Capturing frame...

Captured frame in 0.00 seconds.

(device locks up here)

 

After cutting the power and booting again, I don't see anything new in the logs.  

 

I've tried this a few times with fresh images, and each time the device seems to lock up when using the headless image. Here are the steps I'm taking:

1. apt-get update && apt-get install fswebcam

2. Edit armbianEnv.txt and set camera_type=s5k4ec

3. Add the following to /etc/modules:

    s5k4ec

    vfe_v4l2

4.  reboot

5.  test the camera: fswebcam  -r 640x480 -p YUV420P  test.jpg

 

I've also tried using this fswebcam fork:  https://github.com/avafinger/fswebcam with the same results.

 

Does anyone have any ideas why this would work on the desktop version, but not the headless version? Or does anyone have any advice on how to debug this better? 

 

Link to comment
Share on other sites

8 hours ago, LeopoldVonBuschLight said:

Anyone know a place to buy these?

 

After recovering from the April Fools' day, not a complete recovery though, still shaking and panicking when typing in... Here i go...

 

https://www.aliexpress.com/item/OV5640-A28-OV5640-170-degree-wide-angle-lens-500-megapixel-camera-module/32587714258.html?spm=a2g0s.9042311.0.0.bAmW0v

 

beware, it does not work with mmBoard! :lol:

 

Regarding the lock-up, I would suggest double check your DTS (decompile both dtb and do a compare).

8 hours ago, LeopoldVonBuschLight said:

Or does anyone have any advice on how to debug this better

Enable VFE debugging messages and recompile.

 

Good luck.

 

Link to comment
Share on other sites

 

2 hours ago, @lex said:

Regarding the lock-up, I would suggest double check your DTS (decompile both dtb and do a compare).

11 hours ago, LeopoldVonBuschLight said:

Or does anyone have any advice on how to debug this better

The device trees are identical, but that was a good idea!

 

I used the build system to make a server image and it works fine! I didn't change any kernel settings or add any user patches, so I'm not sure why this one works and the pre-built one doesn't. 

 

Thanks @lex - for the support and the driver for this camera!

 

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
×
×
  • Create New...

Important Information

Terms of Use - Privacy Policy - Guidelines