Jump to content
  • 0

Armbian 5.25 on OrangePI PC: The gc2035 video camera doesn't work


IgZero
 Share

Question

After update from armbian5.23 to armbian5.25 driver for gc2035 not work. The device isn't defined.

=========== Armbian 5.25 ==============
root@orangepipc:~# ls /dev/video*
/dev/video0  /dev/video1
 
Where: /dev/video0 and /dev/video1 - v4l2loopback
 
root@orangepipc:~# cat /etc/modules
#8189es
#rfcomm
#w1-sunxi
#w1-gpio
#w1-therm
gc2035
vfe_v4l2
#sunxi-cir
v4l2loopback
 
root@orangepipc:~# modinfo vfe_v4l2
filename:       /lib/modules/3.4.113-sun8i/kernel/drivers/media/video/sunxi-vfe/vfe_v4l2.ko
description:    Video front end driver for sunxi
license:        Dual BSD/GPL
author:         raymonxiu
depends:        videobuf-core,vfe_os,vfe_subdev,videobuf-dma-contig,cci
intree:         Y
vermagic:       3.4.113-sun8i SMP preempt mod_unload modversions ARMv7 p2v8
parm:           ccm:string
parm:           i2c_addr:uint
parm:           act_name:string
parm:           act_slave:uint
parm:           define_sensor_list:uint
parm:           vfe_i2c_dbg:uint
parm:           isp_log:uint
parm:           vips:uint
root@orangepipc:~# modinfo gc2035
filename:       /lib/modules/3.4.113-sun8i/kernel/drivers/media/video/sunxi-vfe/device/gc2035.ko
license:        GPL
description:    A low-level driver for GalaxyCore gc2035 sensors
author:         @lex
author:         leonardo lontra
author:         raymonxiu
alias:          i2c:gc2035
depends:        cci,vfe_subdev
intree:         Y
vermagic:       3.4.113-sun8i SMP preempt mod_unload modversions ARMv7 p2v8
parm:           hres:hres=0 (640x480|1280x720|1600x1200 - 15 FPS), hres=1 (800x600|1600x1200 - 10 FPS), hres=2 (320x240|640x480|800x600 - 20 FPS), hres=3 (320x240|352x288|640x480 - 15 FPS) (default=0) (uint)
parm:           mclk:mclk override (default=0) (uint)
parm:           frate:frate override (default=0) (uint)
root@orangepipc:~# dmesg | grep GC2035
[    5.938267] [CSI_ERR][GC2035]sensor_read err at sensor_detect!
[    5.938289] [CSI_ERR][GC2035]chip found is not an target chip.
root@orangepipc:~# uname -a
Linux orangepipc 3.4.113-sun8i #28 SMP PREEMPT Thu Feb 2 02:01:28 CET 2017 armv7l armv7l armv7l GNU/Linux
root@orangepipc:~# cat /etc/armbian-release
# PLEASE DO NOT EDIT THIS FILE
BOARD=orangepipc
BOARD_NAME="Orange Pi PC"
VERSION=5.25
LINUXFAMILY=sun8i
BRANCH=default
ARCH=arm
IMAGE_TYPE=stable
 
root@orangepipc:~#
================================
 

Under armbian5.23 the gc2035 driver works. The device is defined.

=========== Armbian 5.23 ==============
root@orangepipc:~# ls /dev/video*
/dev/video0  /dev/video1  /dev/video2
 
Where: /dev/video0 and /dev/video1 - v4l2loopback, /dev/video2 - gc2035
 
root@orangepipc:~# cat /etc/modules
#8189es
#gpio_sunxi
#w1-sunxi
#w1-gpio
#w1-therm
gc2035
vfe_v4l2
#sunxi-cir
v4l2loopback
 
root@orangepipc:~# modinfo vfe_v4l2
filename:       /lib/modules/3.4.112-sun8i/kernel/drivers/media/video/sunxi-vfe/vfe_v4l2.ko
description:    Video front end driver for sunxi
license:        Dual BSD/GPL
author:         raymonxiu
depends:        videobuf-core,vfe_os,vfe_subdev,videobuf-dma-contig,cci
intree:         Y
vermagic:       3.4.112-sun8i SMP preempt mod_unload modversions ARMv7 p2v8
parm:           ccm:string
parm:           i2c_addr:uint
parm:           act_name:string
parm:           act_slave:uint
parm:           define_sensor_list:uint
parm:           vfe_i2c_dbg:uint
parm:           isp_log:uint
parm:           vips:uint
root@orangepipc:~# modinfo gc2035
filename:       /lib/modules/3.4.112-sun8i/kernel/drivers/media/video/sunxi-vfe/device/gc2035.ko
license:        GPL
description:    A low-level driver for GalaxyCore gc2035 sensors
author:         @lex
author:         leonardo lontra
author:         raymonxiu
alias:          i2c:gc2035
depends:        cci,vfe_subdev
intree:         Y
vermagic:       3.4.112-sun8i SMP preempt mod_unload modversions ARMv7 p2v8
parm:           hres:hres=0 (640x480|1280x720|1600x1200 - 15 FPS), hres=1 (800x600|1600x1200 - 10 FPS), hres=2 (320x240|640x480|800x600 - 20 FPS), hres=3 (320x240|352x288|640x480 - 15 FPS) (default=0) (uint)
parm:           mclk:mclk override (default=0) (uint)
parm:           frate:frate override (default=0) (uint)
root@orangepipc:~# dmesg | grep GC2035
[    5.353480] [CSI][GC2035]V4L2_IDENT_SENSOR=2035
[    5.780057] [CSI][GC2035]disalbe oe!
root@orangepipc:~# uname -a
Linux orangepipc 3.4.112-sun8i #10 SMP PREEMPT Sun Oct 23 16:06:55 CEST 2016 armv7l GNU/Linux
root@orangepipc:~# cat /etc/armbian-release
# PLEASE DO NOT EDIT THIS FILE
BOARD=orangepipc
BOARD_NAME="Orange Pi PC"
VERSION=5.23
LINUXFAMILY=sun8i
BRANCH=default
ARCH=arm
 
root@orangepipc:~#
================================
 
P.S.: Settings of parameters in section [csi0] are identical in both versions of the orangepipc.fex file
Link to comment
Share on other sites

Recommended Posts

  • 0

I'm hitting this same issue with the orangepi zero plus2 (h3). I'm trying to get the 5.20 version of Arbian built for my board now (which is pretty tricky because that is not a build option for my board)

 

Robert, is the the camera breakout board you have? Could you send me a picture of what you had to do to make it work? 

IMG_20170719_162448228.jpg

Link to comment
Share on other sites

Search Before Posting!

  • 0

I finally worked around the issue by modifying boot.cmd adding the lines

gpio set PL10
gpio set PG11

at the beginning, right after the "DO NOT EDIT THIS FILE " comment.

The I regenerated boot.scr

 

mkimage -A arm -T script -O linux -d boot.cmd boot.scr

And rebooted.

 

Before that I tried

 

sudo sunxi-pio -m PL10'<default><default<default><1>'
sudo sunxi-pio -m PG11'<default><default<default><1>'

but it didn't work

 

 

Link to comment
Share on other sites

  • 0
On 8/7/2017 at 11:41 AM, Igor said:

 

There were some changes / fixes in driver sources. I don't have this camera ... Can you check? Just switch to beta repository, upgrade and reboot.

Using the beta repository at least solves the segmentation fault when trying to remove vfe_v4l2 but the gc2035 module doesn't accept the hres parameter anymore and the image is worse.

 

Edit: I spoke too soon: the segmentation fault is still there.

Edit 2: it seems the hres parameter isn't necessary, I just had to change motion config to get the same image as before. Maybe before the driver didn't respect the required picture size while now it does?

Edited by olivluca
Link to comment
Share on other sites

  • 0

I've given olivluca's solution a shot and that does not work for me. 

 

Taking a look at the orangepizeroplus2-h3.fex file in the kernel source I an see what appears to be a lot of different GPIO settings in there. Might setting these make a difference? 

Link to comment
Share on other sites

  • 0
1 minute ago, dmorse said:

I've given olivluca's solution a shot and that does not work for me.

 

Sorry, I forgot to say that mine is an orange pi pc. I got the gpios from the boot.cmd in 5.20 but it seems that's not an option in your case.

Link to comment
Share on other sites

  • 0
7 minutes ago, dmorse said:

@Leonardo Lontra Asp previously mentioned, building 5.20 for the pi zero h3 is difficult because that board was not supported back then. 

I not have an orange pi zero for test, but you can try check:

- If i2cdetect shows camera address:

   $ i2cdetect -y 1 (Paste the stdout for us)

 

Maybe it's a wrong address in the fex file.

Link to comment
Share on other sites

  • 0

@Leonardo Lontra I'm not sure how this utility works, but this looks pretty empty to me.

 

root@orangepizeroplus2:~#  i2cdetect -y 1  
     0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f
00:          -- -- -- -- -- -- -- -- -- -- -- -- -- 
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
70: -- -- -- -- -- -- -- --                         
root@orangepizeroplus2:~#

 

 

Link to comment
Share on other sites

  • 0
45 minutes ago, dmorse said:

@Leonardo Lontra I'm not sure how this utility works, but this looks pretty empty to me.

 


root@orangepizeroplus2:~#  i2cdetect -y 1  
     0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f
00:          -- -- -- -- -- -- -- -- -- -- -- -- -- 
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
70: -- -- -- -- -- -- -- --                         
root@orangepizeroplus2:~#

Can you write another image that is not armbian and check if the camera works? If works, it's a point to start investigating this.

 

Link to comment
Share on other sites

  • 0

I get the same result using the standard ubuntu server build from the orangepi website, but at least with that one I can see /dev/video0. I haven't actually tried to use the device yet, will do that next.

 

root@OrangePI:~# i2cdetect -y 1 
     0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f
00:          -- -- -- -- -- -- -- -- -- -- -- -- -- 
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
70: -- -- -- -- -- -- -- --                         
root@OrangePI:~# ls /dev/video0 
/dev/video0
root@OrangePI:~#

 

Link to comment
Share on other sites

  • 0
4 hours ago, dmorse said:

I get the same result using the standard ubuntu server build from the orangepi website, but at least with that one I can see /dev/video0. I haven't actually tried to use the device yet, will do that next.

 

 

 

In that image it seems uboot activates PL10 and PA17.

Try following my instructions but using PA17 instead of PG11.

Link to comment
Share on other sites

  • 0
Quote

In that image it seems uboot activates PL10 and PA17.

Try following my instructions but using PA17 instead of PG11

 I don't have a boot.cmd file in /media/boot in that build, only a boot.scr

 

Do you know a way to turn the boot.scr into a boot.cmd for editing and then turn it back? 

Link to comment
Share on other sites

  • 0

I added this to the top of my /boot/boot.cmd on that build

# DO NOT EDIT THIS FILE
gpio set PL10
gpio set PA17

and then make a boot.scr out of it and started up from that. Sill can't see /dev/video0. 

Still getting this out of dmesg

 

root@orangepizeroplus2:~# dmesg | grep -i gc2035
[    4.539492] [CSI_ERR][GC2035]sensor_read err at sensor_detect!
[    4.539514] [CSI_ERR][GC2035]chip found is not an target chip.
root@orangepizeroplus2:~#

 

 

 

Link to comment
Share on other sites

  • 0
On 19/7/2017 at 7:17 PM, olivluca said:

I finally worked around the issue by modifying boot.cmd adding the lines


gpio set PL10
gpio set PG11

....

Before that I tried

 


sudo sunxi-pio -m PL10'<default><default<default><1>'
sudo sunxi-pio -m PG11'<default><default<default><1>'

but it didn't work

 

 

 

I wonder why setting the gpio with uboot works while setting them in userspace doesn't work. Maybe the syntax of sunxi-pio is wrong or something else is missing?

 

Link to comment
Share on other sites

  • 0

I got past the error

[ISP] isp platform_id = 5!
[CSI_ERR][GC2035]sensor_read err at sensor_detect!
[CSI_ERR][GC2035]chip found is not an target chip.

 

following is seen in dmesg output now

[    7.787818] [CSI][GC2035]V4L2_IDENT_SENSOR=2035
[    8.210055] [CSI][GC2035]disalbe oe!
 

but when I try capturing an image from the camera from a python script using pyimage, it crashes with the following error

[ 2173.632135] [CSI][GC2035]enable oe!
[ 2173.632583] [CSI][GC2035]V4L2_IDENT_SENSOR=2035
[ 2174.125239] [VFE_ERR]try rgb888 bus error when pix fmt is rgb888/prgb888 at try_fmt_internal!
[ 2174.134937] [VFE_ERR]pixel format (0x33424752) width 640 height 480 invalid at vidioc_s_fmt_vid_cap.
[ 2174.545886] [VFE_ERR]buffer count is invalid, set to 3 in video capture
 

tried fswebcam also and same error occurs there as well;

 

Have any of you encountered it before and can help?

Link to comment
Share on other sites

  • 0

hi guys, it looks like mainline uboot doesnt set PG11 (CSI_EN) on opipc etc anymore. i was lucky to have it enabled on my opi0+2h3. so to make camera work on opipc/opipc+/opilite/opi1 you have to:

sunxi-pio -m "PG11<1><0><1><1>"

then load modules (or create uboot which enables it at boot time). and PA17 is CSI_PWR_EN which is already set correctly in fex as vip_dev0_power_en. (btw. on opi0+2 CSI_PWR_EN is PA08).

Link to comment
Share on other sites

  • 0
5 minutes ago, kotc said:

hi guys, it looks like mainline uboot doesnt set PG11 (CSI_EN) on opipc etc anymore.

Why should it? Enabling CSI power it's not a job for the u-boot. As I said earlier in this thread, somebody needs to get their hands dirty and add a new option to the CSI driver, and the pin in question should be parsed from script.bin

Link to comment
Share on other sites

  • 0

now that i look at it, i enabled PG13 on opi0+2h3, which probably also supplied power and made camera powered. ho hum. funny those little boards, stealing power from any source they can ;). and yeah, i agree camera driver should handle all powering. not to mention it would be nice if it didnt segfault on rmmod

Link to comment
Share on other sites

  • 0
7 hours ago, kotc said:

if i understand schematics correctly, on opi0+2h3 both csi_en and csi_pwr_en are connected to pa08

Yes, looks right, so it needs to be configurable per board (i.e. OPi One uses PA17 for CSI-PWR-EN and PG11 for CSI-EN)

 

7 hours ago, kotc said:

i enabled PG13 on opi0+2h3, which probably also supplied power and made camera powered.

Looks like PG13 is wired to the I2S/PCM interface of the AP6212 module.

Link to comment
Share on other sites

  • 0

I had solved this problem by my friend.

Run this script

sunxi-pio -m "PG11<1><0><1><1>"
modprobe gc2035
modprobe vfe_v4l2

The most import is that don't load gc2035 & vfe_v4l2 before. So you had better remove it in /etc/modules

This is my /etc/modules

#w1-sunxi
#w1-gpio
#w1-therm
#gc2035
#vfe_v4l2
#sunxi-cir
#v4l2loopback

you may see /dev/video0, but when you reboot, it lose again

I add my scrip to /etc/rc.local

this is my /etc/rc.local

sunxi-pio -m "PG11<1><0><1><1>"
modprobe gc2035
modprobe vfe_v4l2
sleep 5
modprobe v4l2loopback devices=2
/root/vidcopy/vidcopy -w 640 -h 480 -r 30 -i /dev/video0 -o /dev/video1 -f UYVY
sleep 5
/root/vidcopy/vidcopy -w 640 -h 480 -r 30 -i /dev/video1 -o /dev/video2 -f UYVY
exit 0

Thanks my friend: "虚耗"

Link to comment
Share on other sites

  • 0
On 19/7/2017 at 8:06 PM, Leonardo Lontra said:

@olivluca Your Don't need more hres mode, now is a dynamic change. For example, If you want 1600x1200 with more image quality, sets resolution and fps to <=8, or 1600x1200 with higher fps, but less image resolution, sets fps to >= 20. Internally, change hres based on resolution or/and framerate.

 

I'm getting weird results with motion:

 

If I set 800x600 the image is OK but flipped horizontally

If I set 640x480 the image is OK

if I set 1600x1200 this is what I get:

imatge.thumb.png.1af6cc465106cb8c152794188acf2caa.png

Link to comment
Share on other sites

  • 0

It turns out that after a few hours of running motion the captured image have a green tint (not like the above sample at 1600x1200, just a normal image with almost no red-blue components). Since I'm using the beta repository I though it was a problem of the kernel of the day, in fact updating and rebooting solved the issue.

It turns out that's enough to stop and start motion to get a normally coloured image.

Do you think it's an hardware or driver issue?

Link to comment
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.

Guest
Answer this question...

×   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.

Loading...
 Share

×
×
  • Create New...