Giter Club home page Giter Club logo

sun4i_csi's Introduction

OV5640-camera driver for Sunxi-A20

This is a replacement driver for the existing Linux Sunxi CSI Camera Driver "sun4i_csi". compatible with A10 (sun4i), A12/A13/A10S (sun5i) and A20 (sun7i) SoCs.

Possible kernel sources:

https://github.com/linux-sunxi/linux-sunxi/tree/stage/sunxi-3.4

or

https://github.com/nisenbeck/linux-bananapi

or

https://github.com/LeMaker/linux-sunxi

directory path: ../linux-bananapi/drivers/media/video/sun4i_csi/...

...to be replaced with this subbranch.

Developed on Banana Pi Version 1 (the first one) Allwinner A20 CSI parallel port, using OV5640 camera module.

This provides a new CSI Driver and a new sub-device driver for the OV5640 Camera.

I have been working on this for the last ..3 years on and off when there was spare time.

The old CSI driver had issues like artifacts first capture being present in the video stream and so on.

The OV5640 Subdevice driver was basicly rewritten and now supports discrete windowsize selection and FPS display.

I tried autofocus but no success with my camera module.

I will include a "docu" subdirectory to include some usefull scripts for compiling the driver and the camera-subdevice, plus a self made tool to test the camera output. ie. FPS display, parameter selection and display.

Howto use (compile on the bananapi):

apt-get install git build-essential libncurses5-dev u-boot-tools uboot-mkimage   - get compiler and tools
cd          go home
git clone https://github.com/nisenbeck/linux-bananapi.git --depth 1    - get kernel source code into new directory linux-bananapi

cd linux-bananapi/drivers/media/video
//remove or rename the directory sun4i_csi
mv sun4i_csi sun4i_csi_bak    or   rm -r sun4i_csi
git clone https://github.com/xenpac/sun4i_csi.git   -  get new code,  this will create new directory "sun4i_csi" with new code

cd  - go home
cd linux-bananapi
make sun7i_defconfig  -  make the default kernel .config for A20 bananapi

make -j2 uImage modules  -  compile the kernel into uImage, the modules into the .ko files.  -j2 = use 2 threads
make modules_install    -    copys all generated modules .ko from this compile directory to /lib/modules/kernelversion/
                        -     ie. u have one module branch for each specific kernel-version!

mv  /boot/bananapi/uImage /boot/bananapi/uImage.ori  -  backup old kernel just in case!

cp /home/bananapi/linux-bananapi/arch/arm/boot/uImage /boot/bananapi/  -  copy new kernel to boot

reboot  - (into the new kernel)

you now have ov5640 ready on /dev/video0

comments are welcome, xenpac

sun4i_csi's People

Contributors

xenpac avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

sun4i_csi's Issues

Port TVP5150 to sunxi csi a20

Hello
I try to port tvp5150 ... finally these errors are displayed :

[CSI_DEBUG]buf ptr=ee041000
[CSI_DEBUG] Nobody is waiting on this buffer,buf = 0xee041000
[CSI_DEBUG]buf ptr=eead9280
[CSI_DEBUG]csi_buf_addr_y=482e4000
[CSI_DEBUG]csi_buf_addr_cb=48338600
[CSI_DEBUG]csi_buf_addr_cr=4834d780
[CSI_DEBUG]csi_isr
[CSI_DEBUG]buf ptr=ee041680
[CSI_DEBUG] Nobody is waiting on this buffer,buf = 0xee041680
[CSI_DEBUG]buf ptr=eead9b00
[CSI_DEBUG]csi_buf_addr_y=48363000
[CSI_DEBUG]csi_buf_addr_cb=483b7600
[CSI_DEBUG]csi_buf_addr_cr=483cc780
[CSI_DEBUG]csi_isr
[CSI_DEBUG]buf ptr=eead9280
[CSI_DEBUG] Nobody is waiting on this buffer,buf = 0xeead9280
[CSI_DEBUG]buf ptr=eead9380
[CSI_DEBUG]csi_buf_addr_y=483e2000
[CSI_DEBUG]csi_buf_addr_cb=48436600
[CSI_DEBUG]csi_buf_addr_cr=4844b780
[CSI_DEBUG]csi_isr
[CSI_DEBUG]buf ptr=eead9b00
[CSI_DEBUG] Nobody is waiting on this buffer,buf = 0xeead9b00
[CSI_DEBUG]buf ptr=eead9100
[CSI_DEBUG]csi_buf_addr_y=48461000
[CSI_DEBUG]csi_buf_addr_cb=484b5600
[CSI_DEBUG]csi_buf_addr_cr=484ca780
[CSI_DEBUG]csi_isr
[CSI_DEBUG]buf ptr=eead9380
[CSI_DEBUG] Nobody is waiting on this buffer,buf = 0xeead9380
[CSI_DEBUG]No more free frame on next time
[CSI_DEBUG]csi_isr
[CSI_DEBUG]buf ptr=eead9100
[CSI_DEBUG] Nobody is waiting on this buffer,buf = 0xeead9100
[CSI_DEBUG]No more free frame
[CSI_DEBUG]csi_isr
<6>[CSI_ERR]No active queue to serve
[CSI_DEBUG]csi_isr
<6>[CSI_ERR]No active queue to serve
[CSI_DEBUG]csi_isr
<6>[CSI_ERR]No active queue to serve

And with your CSI driver These errors are displayed:

ubieaio login: <6>Linux video capture interface: v2.00
<2>[CSI_DRIVER]Welcome to CSI driver
[ 200.612929] [CSI_DRIVER]Welcome to CSI driver
<2>[CSI_DRIVER]- csi_init
[ 200.621131] [CSI_DRIVER]- csi_init
<2>[CSI_DRIVER]------------------- csi_probe start>>
[ 200.632364] [CSI_DRIVER]------------------- csi_probe start>>
<2>[CSI_DRIVER]sizeof struct csi_camera:732
[ 200.643492] [CSI_DRIVER]sizeof struct csi_camera:732
<2>[CSI_DRIVER]pcam->id:1
[ 200.652020] [CSI_DRIVER]pcam->id:1
<2>[CSI_DRIVER]v4l2_device_register start
[ 200.660349] [CSI_DRIVER]v4l2_device_register start
<2>[CSI_DRIVER]v4l2_device_registered
[ 200.669752] [CSI_DRIVER]v4l2_device_registered
<2>[CSI_DRIVER]vd alloc
[ 200.677436] [CSI_DRIVER]vd alloc
<2>[CSI_DRIVER]vd register start
[ 200.684589] [CSI_DRIVER]vd register start
<2>[CSI_DRIVER]video_register_deviceed
[ 200.693944] [CSI_DRIVER]video_register_deviceed
<2>[CSI_DRIVER]V4L2 device registered as video0
[ 200.703909] [CSI_DRIVER]V4L2 device registered as video0
<2>[CSI_DRIVER]vb2 que init done
<2>[CSI_DRIVER]- csi_open
<2>[CSI_DR[ 200.713365] [CSI_DRIVER]vb2 que init done
IVER]ioctl -[ 200.715731] [CSI_DRIVER]- csi_open
vidioc_querycap=sun4i_csi
<2>[CSI_D[ 200.727562] [CSI_DRIVER]ioctl - vidioc_querycap=sun4i_csi
RIVER]- csi_close
<2>[CSI_DR[ 200.735600] [CSI_DRIVER]- csi_close
IVER]++Close++++++++Error1:0 Error2:0 Error3:0 Error4:0 Error5:0 Error6:0 Error7:0 Error8:0 Error9:0 Error10:0 Error11:0
<1>Unable to h[ 200.750543] [CSI_DRIVER]++Close++++++++Error1:0 Error2:0 Error3:0 Error4:0 Error5:0 Error6:0 Error7:0 Error8:0 Error9:0 Error10:0 Error10
andle kernel NULL pointer dereference at virtual address 00000000
<1>pgd = ee118[ 200.770087] Unable to handle kernel NULL pointer dereference at virtual address 00000000
000
<1>[00000000][ 200.779820] pgd = ee118000
*pgd=6ea1e831,[ 200.784860] [00000000] *pgd=6ea1e831 *pte=00000000,, *pte=00000000 *ppte=00000000
<0>Internal er , *ppte=00000000
ror: Oops: 17 [#1] PREEMPT SMP ARM
Modules linke[ 200.798353] Internal error: Oops: 17 [#1] PREEMPT SMP ARM
d in: [ 200.805572] Modules linked in:sun4i_csi1(+) sun4i_csi1(+)videobuf2_dma_contig videobuf2_dma_contigvideobuf2_memops videobuf2_memopsvideobuf2_i
CPU: 1 Not ta i
inted (3.4.103MTA-v1.3+ #52)
PC is at _wake_up[ 200.828021] CPU: 1 Not tainted (3.4.103MTA-v1.3+ #52)
common+0x20/0x78
LR is at __wake_up+[ 200.836626] PC is at __wake_up_common+0x20/0x78
0x3c/0x50
pc : [] [ 200.843767] LR is at __wake_up+0x3c/0x50
lr : [] psr: 60010093
sp : ee12feb0 ip : c07aabb0 fp : ee12fed4
r10: ee91ca88 r9 :[ 200.856524] pc : [] lr : [] psr: 60010093
00000010 r8 : 00000000
r[ 200.856528] sp : ee12feb0 ip : c07aabb0 fp : ee12fed4
7 : 00000003 r6 : 00000000 r5 : ef09ad7c r4 : ef09ad74
r3 : 00000000 r2 : [ 200.866683] r10: ee91ca88 r9 : 00000010 r8 : 00000000
00000000 r1 : 00000003 r0 : ff[ 200.877100] r7 : 00000003 r6 : 00000000 r5 : ef09ad7c r4 : ef09ad74
fffff4
Flags: nZCv IRQs o[ 200.894015] r3 : 00000000 r2 : 00000000 r1 : 00000003 r0 : fffffff4
ff FIQs on Mode SVC_32 ISA ARM Segment user
Control: 10c5387d [ 200.906427] Flags: nZCv IRQs off FIQs on Mode SVC_32 ISA ARM Segment user
Table: 6e11806a DAC: 00000015

PC: 0xc0053a34:[ 200.918057] Control: 10c5387d Table: 6e11806a DAC: 00000015

3a34 e1a00005 e[ 200.925440]

How to solve this problems?

thanks a lot.
Uploading device.zip…

Query regarding zoom_image

Hi ! This is not an issue but a query.

Thank you for publishing your code. It is very helpful.

I am trying to obtain a 320x240 crop from a (2592x1944) on OV5640 setup.

I used the zoom_image function in your code to generate values for cropping. But I get only black image returned as data from sensor.

All the register values generated by the function are set in the same order.

Is there anything else I should look at ?

Regards,
Anup

SXGA (1280*960) with subsampling

Hi, this not an issue, it is only a question.

Is it possible to get SXGA with subsampling in order to reach more FPS than scaling solution ?.

Regards.

Problems changing driver

Hi, I've been trying to find a better driver for the Ov5640 camera for a few months now and although I found a few alternatives I've been having problems on how to use them, what I mean is for using an alternative such as the one on this repository should I try to insmod the solution or compile a new kernel altogether ?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.