2009-03-03 09:26:11     The problem about the V4L_test

Document created by Aaronwu Employee on Aug 14, 2013
Version 1Show Document
  • View in full screen mode

2009-03-03 09:26:11     The problem about the V4L_test

bin zhang (CHINA)

Message: 70289   

 

Hi!

 

We use ADV7181B and CCD camera to do the capture task.

 

Our system's boot information about the ADV7181B is here:

 

root:~> modprobe blackfin-cam

Linux video capture interface: v2.00

driver for ADV7181B get_camops

driver for ADV7181B get_camops

ADV7181B: detecting client on address 0x40

driver for ADV7181B init

ADV7181B: V4L driver Blackfin CMOS Camera now ready

ADV7181B: i2c driver ready

 

And,the information about the V4L_test is here:

 

root:~> v4l_test -o usr/output_file

 

capture rate: 30, height: 288, widht: 352

open /dev/video0

found Blackfin CMOS Camera device. (maxsize=720x576)

default picture properties: brightness=27714,hue=25441,colour=26219,contrast=28265,depth=16, palette=7.

trying to set capture size to 352x288

capture size set to 352x288

 

The problem is: the system hangs at  ioctl(devfd, VIDIOCSYNC, &frame_id)  in v4l_test.c file.

 

We don't konw  why this happens!!  We really need your help!

TranslateQuoteReplyEditDelete

 

 

2009-03-03 09:37:29     RE: The problem about the V4L_test

Michael Hennerich (GERMANY)

Message: 70291    I guess the driver doesn't receive a DMA Done Interrupt.

So it waits for the first frame to finish.

 

This can have several reasons.

 

 

Check your PPI Clock.

Make sure you programmed the ADV7181 the right way.

etc

 

Can you explain the HW you are using?

 

-Michael

 

QuoteReplyEditDelete

 

 

2009-03-04 03:08:13     RE: The problem about the V4L_test

bin zhang (CHINA)

Message: 70338   

 

Hi ,Michael!

 

    We use the ITU656 mode , and have check the reg value of ADV7181B. That's right!

 

    The problem is still unsolved.

 

    I have another question!   Does the  V4L_test use the fuction {v4l_ioctl()--  in the blackfin_cam.c }??

 

   And where is the definition of the fuction such as "ioctl(devfd, VIDIOCGPICT, &pict)" in v4l_test.c ????

 

 

TranslateQuoteReplyEditDelete

 

 

2009-03-04 08:53:17     RE: The problem about the V4L_test

Michael Hennerich (GERMANY)

Message: 70368    I never used the v4l_test.c utility.

Try ffmpeg

 

-Michael

 

 

QuoteReplyEditDelete

 

 

2009-03-04 11:12:38     RE: The problem about the V4L_test

bin zhang (CHINA)

Message: 70373   

 

Could you tell me how to use pr_debug() ??  We need the debug information to trace the capture process just like printk()!!

 

And  there is a strange problem!

 

Look at the followed print messages!  The print information is not in order. I don't  know why this happens!

 

It looks like several print messages mix together. I could hard tell which is which.

 

Could you please tell me  how to solve the problem and why this happens??  Maybe it's normal.

 

root:~> v4l_test

usag*:**i*e*_*a* **r*<*r*m*_*at*>* *-* *o*t*u* *i*e*]*s*n* *ebacla pe_tonpen**************************

 

0oxe57/6e /wiien0d e.g.t. u7s,iwndgt  722

                  ow

urOfCuStYpNcCu*e*p*o*e*t*e*:*b*i*h*n*s*=*7*1*,*u*=*5**1*c*l

  26219,contrast=28265,depth=16, palette=7.

trying to set capture size to 720x576

capture size set to 720x576

**********************start to mmap************************

*********************finish mmap**************************

**********************start while************************

TranslateQuoteReplyEditDelete

 

 

2009-03-04 12:26:13     RE: The problem about the V4L_test

Michael Hennerich (GERMANY)

Message: 70375    >Could you tell me how to use pr_debug() ??

 

You need to #define DEBUG before doing any #includes

 

I tested the v4l_test utility, for me it works expected. The only thing I did was to change the default VIDEO_FMT in order to use it with the VS6624 sensor.

 

#define DEFAULT_FMT VIDEO_PALETTE_UYVY

 

-Michael

 

 

Linux version 2.6.28.7-ADI-2009R1-pre-svn6153 (michael@mhenneri-D02) (gcc version 4.1.2 (ADI svn)) #811 Wed Mar 4 18:13:32 CET 2009

console [early_BFuart0] enabled

early printk enabled on early_BFuart0

Warning: limiting memory to 56MB due to hardware anomaly 05000263

Board Memory: 64MB

Kernel Managed Memory: 64MB

Memory map:

fixedcode = 0x00000400-0x00000490

text = 0x00100000-0x00223a80

rodata = 0x00223a80-0x002820fc

bss = 0x00282100-0x002912f8

data = 0x002912f8-0x002a4000

stack = 0x002a2000-0x002a4000

init = 0x002a4000-0x007a4000

available = 0x007a4000-0x037ff000

DMA Zone = 0x03f00000-0x04000000

Hardware Trace Active and Enabled

Boot Mode: 0

Blackfin support (C) 2004-2009 Analog Devices, Inc.

Compiled for ADSP-BF537 Rev 0.2

Warning: Compiled for Rev 2, but running on Rev 3

Blackfin Linux support by http://blackfin.uclinux.org/

Processor Speed: 500 MHz core clock and 125 MHz System Clock

NOMPU: setting up cplb tables

Instruction Cache Enabled for CPU0

Data Cache Enabled for CPU0 (write-through)

Built 1 zonelists in Zone order, mobility grouping off. Total pages: 14223

Kernel command line: root=/dev/mtdblock0 rw clkin_hz=25000000 earlyprintk=serial,uart0,57600 console=ttyBF0,57600 ip=192.168.1.45:192.168.1.1:192.168.0.1:255.255.255.0:bf537f

Configuring Blackfin Priority Driven Interrupts

PID hash table entries: 256 (order: 8, 1024 bytes)

console handover: boot [early_BFuart0] -> real [ttyBF0]

Dentry cache hash table entries: 8192 (order: 3, 32768 bytes)

Inode-cache hash table entries: 4096 (order: 2, 16384 bytes)

Memory available: 48936k/65536k RAM, (5120k init code, 1166k kernel code, 514k data, 1024k dma, 8776k reserved)

Calibrating delay loop... 997.37 BogoMIPS (lpj=1994752)

Security Framework initialized

Mount-cache hash table entries: 512

Blackfin Scratchpad data SRAM: 4 KB

Blackfin L1 Data A SRAM: 16 KB (15 KB free)

Blackfin L1 Data B SRAM: 16 KB (16 KB free)

Blackfin L1 Instruction SRAM: 48 KB (41 KB free)

PDA for CPU0 reserved at 002831e8

net_namespace: 288 bytes

NET: Registered protocol family 16

Blackfin GPIO Controller

Blackfin DMA Controller

stamp_init(): registering device resources

NET: Registered protocol family 2

IP route cache hash table entries: 1024 (order: 0, 4096 bytes)

TCP established hash table entries: 2048 (order: 2, 16384 bytes)

TCP bind hash table entries: 2048 (order: 1, 8192 bytes)

TCP: Hash tables configured (established 2048 bind 2048)

TCP reno registered

NET: Registered protocol family 1

msgmni has been set to 95

io scheduler noop registered

io scheduler anticipatory registered (default)

io scheduler cfq registered

Serial: Blackfin serial driver

bfin-uart.1: ttyBF0 at MMIO 0xffc00400 (irq = 18) is a BFIN-UART

brd: module loaded

bfin_mii_bus: probed

bfin_mac: attached PHY driver [SMSC LAN83C185] (mii_bus:phy_addr=0:01, irq=-1, mdc_clk=2500000Hz(mdc_div=24)@sclk=125MHz)

bfin_mac bfin_mac.0: Blackfin on-chip Ethernet MAC driver, Version 1.1

Linux video capture interface: v2.00

i2c-bfin-twi i2c-bfin-twi.0: Blackfin BF5xx on-chip I2C TWI Contoller, regs_base@ffc01400

VS6624: detecting client on address 0x20

VS6624: Firmware Version 0.12

VS6624: Patch Version 0.0

VS6624: V4L driver Blackfin CMOS Camera now ready

VS6624: i2c driver ready

bfin-spi bfin-spi.0: Blackfin on-chip SPI Controller Driver, Version 1.0, regs_base@ffc00500, dma channel@7

rtc-bfin rtc-bfin: rtc core: registered rtc-bfin as rtc0

i2c /dev entries driver

bfin-wdt: initialized: timeout=20 sec (nowayout=0)

TCP cubic registered

NET: Registered protocol family 17

rtc-bfin rtc-bfin: setting system clock to 1970-01-03 05:49:18 UTC (193758)

IP-Config: Gateway not on directly connected network.

Freeing unused kernel memory: 5120k freed

dma_alloc_init: dma_page @ 0x007a1000 - 256 pages at 0x03f00000

_____________________________________

a8888b. / Welcome to the uClinux distribution \

d888888b. / _ _ \

8P"YP"Y88 / | | |_| __ __ (TM) |

8|o||o|88 _____/ | | _ ____ _ _ \ \/ / |

8' .88 \ | | | | _ \| | | | \ / |

8`._.' Y8. \ | |__ | | | | | |_| | / \ |

d/ `8b. \ \____||_|_| |_|\____|/_/\_\ |

dP . Y8b. \ For embedded processors including |

d8:' " `::88b \ the Analog Devices Blackfin /

d8" 'Y88b \___________________________________/

:8P ' :888

8a. : _a88P For further information, check out:

._/"Yaa_: .| 88P| - http://blackfin.uclinux.org/

\ YP" `| 8P `. - http://docs.blackfin.uclinux.org/

/ \.___.d| .' - http://www.uclinux.org/

`--..__)8888P`._.' jgs/a:f - http://www.analog.com/blackfin

 

Have a lot of fun...

PHY: 0:01 - Link is Up - 100/Full

 

 

BusyBox v1.13.2 (2009-03-04 14:57:48 CET) built-in shell (msh)

Enter 'help' for a list of built-in commands.

 

root:/

 

root:/> v4l_test -r 15 -o foo &

capture rate: 15, height: 288, widht: 352

device: /dev/video0, output: foo

open /dev/video0

204

root:/> found Blackfin CMOS Camera device. (maxsize=640x480)

default picture properties: brightness=27714,hue=25441,colour=26219,contrast=28265,depth=16, palette=9.

trying to set capture size to 352x288

root:/> v4l_test -r 15 -o foo & ...using 352x288 window

capture size set to 352x288

 

root:/> cat /proc/interrupts

6: 13325 CORE Blackfin Core Timer

10: 1 INTN rtc-bfin

11: 44 INTN PPI_DMA

16: 8744 INTN i2c-bfin-twi

18: 0 INTN BFIN_UART_RX

19: 84 INTN BFIN_UART_TX

24: 2 INTN EMAC_RX

42: 0 ERROR PPI ERROR

NMI: 0 CORE Non Maskable Interrupt

Err: 0

root:/> ls -l foo

----r----x 1 root root 14395392 Jan 3 05:50 foo

 

 

QuoteReplyEditDelete

 

 

2009-03-05 03:13:02     RE: The problem about the V4L_test

bin zhang (CHINA)

Message: 70414   

 

I had traced the err.

 

And the debug information is here:

 

root:~> bcap_open called

bcap_open:

bcap open setting PPI done

  setting PPI to 720x576

  specified video device opened sucessfullly

VIDIOCGCAP ioctl called

  setting 'type of interface' to 0x00000101

  setting 'name' to Blackfin CMOS Camera

  setting 'channels' to 1

  setting 'audios' to 0

  setting 'maxwidth' to 720

  setting 'maxheight' to 576

  setting 'minwidth' to 80

  setting 'minheight' to 60

VIDIOCGPICT called

VIDIOCSPICT called

VIDIOCSWIN called

  setting PPI to 352x288

  ...using 352x288 window

VIDIOCGWIN called

VIDIOCGMBUF called (16906721)

  capture 202752 byte, 352x288 (WxH) frame

bcap_mmap: vm mapped to [0x00001000-0x00032800]

VIDIOCMCAPTURE(0) called (16906733)

  capture 202752 byte, 352x288 (WxH) frame

  grabbing frame 0 [0x00001000]

bcap_ppi2dma: reading 202752 bytes (352x288) into [0x00001000]

bcap_ppi2dma: done read in 202752 bytes for [0x00001000-0x00032800]

-->bcap_ppi_irq_error: PPI Status = 0x1000 ----------------------means FIFO overflow

-->bcap_ppi_irq_error: PPI Status = 0x1000

VIDIOCMCAPTURE(1) called (16906761)

  capture 202752 byte, 352x288 (WxH) frame

-->bcap_ppi_irq_error: PPI Status = 0x800   -----------------------means Frame Track Error

-->bcap_ppi_irq_error: PPI Status = 0x1000

-->bcap_ppi_irq_error: PPI Status = 0x1000

VIDIOCSYNC(0) called (16906781)

-->bcap_ppi_irq_error: PPI Status = 0x800

-->bcap_ppi_irq_error: PPI Status = 0x1000

 

-->bcap_ppi_irq_error: PPI Status = 0x1000

-->bcap_ppi_irq_error: PPI Status = 0x800

-->bcap_ppi_irq_error: PPI Status = 0x1000

-->bcap_ppi_irq_error: PPI Status = 0x800

-->bcap_ppi_irq_error: PPI Status = 0x1000

-->bcap_ppi_irq_error: PPI Status = 0x1000

-->bcap_ppi_irq_error: PPI Status = 0x800

-->bcap_ppi_irq_error: PPI Status = 0x1000

-->bcap_ppi_irq_error: PPI Status = 0x1000

-->bcap_ppi_irq_error: PPI Status = 0x800

 

Could give me some advice that what the read number means??

 

And why the FIFO overflow and Frame Track Error happen?  ?

 

 

TranslateQuoteReplyEditDelete

 

 

2009-03-05 03:43:17     RE: The problem about the V4L_test

bin zhang (CHINA)

Message: 70419   

 

I konw the red number's meaning.

 

formula: jiffise*1000/ Hz  ( we choose Hz = 250 ).

 

But I can't connet it to our problems.

TranslateQuoteReplyEditDelete

 

 

2009-03-05 03:52:55     RE: The problem about the V4L_test

Michael Hennerich (GERMANY)

Message: 70421    The ADV7181B Sensor driver is not in our svn.

So obviously you have done it your own.

 

Meaning of those errors are explained in the Blackfin (Peripheral) Hardware Reference Manuals (PHRM, HRM). You should start reading there.

If you have questions beyond what is detailed in the PHRM, feel free to ask questions.

 

But please read the manual first.

 

-Michael

 

QuoteReplyEditDelete

 

 

2009-03-07 11:21:08     RE: The problem about the V4L_test

bin zhang (CHINA)

Message: 70560   

 

Hi!!  We have solved the problem and the capture task runs well on our board.

 

We modify the height's size in file v4l_test.c,change it from 576 to 288 and the width is 720. (Because one frame is divided into two fields .We use two bufs to load the two fields' data. each size ----288*720 pixels)

 

We also modify set_dma_x_modify(CH_PPI, 2),set_dma_y_modify(CH_PPI, 2) to set_dma_x_modify(CH_PPI, 4) and set_dma_y_modify(CH_PPI, 4). (Our trans mode is 32bit.)

 

Thank you,Michael!!!  Thanks a lot !!  Your answers and test information helped us a lot!!  Thank you!

 

-Zhang Bin

TranslateQuoteReplyEditDelete

 

 

2009-03-09 10:19:22     RE: The problem about the V4L_test

bin zhang (CHINA)

Message: 70613   

 

Hi,Michael

 

    We have met new problems! The frame is right that we use ffmpeg to capture the video at 720*288 ,but when we change it to 352*288 , the frame is wrong!  I want to know how to use ffmpeg to correct the error at different resolution.

 

 

Our raw video is uyvy 422 720*288

TranslateQuoteReplyEditDelete

 

 

2009-03-09 12:20:27     RE: The problem about the V4L_test

Michael Hennerich (GERMANY)

Message: 70618    Hi Bin,

 

ffmpeg knows tons of command line options. I'm sure there is one to efficiently scale the input horizontally by 2.

I would ask on the ffmpeg mailing list.

 

-Michael

 

 

QuoteReplyEditDelete

 

 

2009-03-10 02:49:34     RE: The problem about the V4L_test

bin zhang (CHINA)

Message: 70645   

 

Hi Michael

 

Why ffmpeg don't have libx264? Should we do something to enable the libx264??

 

root:~> ffmpeg -f video4linux -r 10 -s 720*288 -i /dev/video0 -vcodec libx264 -a

n -f avi video.avi

FFmpeg version UNKNOWN, Copyright (c) 2000-2007 Fabrice Bellard, et al.

  configuration: --prefix=/usr --source-path=/root/uClinux-dist-2008R1-RC8/lib/f

fmpeg/build/../ffmpeg-svn-11114 --target-os=Linux --cpu=bfin --arch=bfin --extra

-ldflags=       -mcpu=bf561-0.3 --enable-static --enable-shared --enable-gpl --e

nable-pp --disable-strip --cross-prefix=bfin-linux-uclibc-

  libavutil version: 49.5.0

  libavcodec version: 51.48.0

  libavformat version: 52.1.0

  built on Mar  9 2009 08:07:25, gcc: 4.1.2 (ADI svn)

Input #0, video4linux, from '/dev/video0':

  Duration: N/A, start: 1167609710.944031, bitrate: 33177 kb/s

    Stream #0.0: Video: rawvideo, uyvy422, 720x288 [PAR 0:1 DAR 0:1], 33177 kb/s

, 10.00 tb(r)

Unknown encoder 'libx264'

Attachments

    Outcomes