2009-11-24 07:22:25     Problem with ADV7183B and BF548 on EZ-KIT lite

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

2009-11-24 07:22:25     Problem with ADV7183B and BF548 on EZ-KIT lite

Massimo Savina (ITALY)

Message: 82698   

 

Hi,

 

I'm developing an application based on BF548 and the decoder ADV7183B.

I'm working on EZ-KIT Lite (BF548) with plugged in the BLACKFIN A-V EZ-EXTENDER.

The uClinux version is 2.6.31.3-ADI-2010R1-pre.

 

After kernel boots, I load modules I2C and blackfin_cam, but the /dev/video0 seems to be corrupted.

 

....

BusyBox v1.15.1 (2009-11-23 16:58:46 CET) hush - the humble shell

 

root:/> modprobe i2c-bfin-twi

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

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

root:/> modprobe blackfin-cam

driver for ADV7183B get_camops

driver for ADV7183B get_camops

driver for ADV7183B init

ADV7183B: detected client on address 0x20

ADV7183B: V4L driver Blackfin CMOS Camera now ready

root:/> cat /dev/video0

: couldn't allocate dma buffer.

cat: can't open '/dev/video0': Cannot allocate memory

root:/>

 

 

Some hardware considerations:

 

    ADV7183B is correctly powered and not in reset.

    Signals SDA and SCL from ADV7183B are routed respectively on PE15/SDA0 and PE14/SCL0 on the blackfin (with the scope on the decoder's pins, I can see the first transaction when I load blackfin_cam module)

    The OE pin of ADV7183B is grounded.

    The ALSB pin il grounded.

    The 8 data bits are routed on PPI0.

    Also VDEC_HS and VDEC_VS seems to be routed correctly.

    LLC1 decoder's pin clock is routed on PPI0_CLK.

    

 

Some software considerations:

 

    Kernel is built with "0x100000" Kernel load address for booting

    Kernel is built with "Enable DMA Support --> Uncached SDRAM region (Enable 2M DMA region)"

    Kernel is built with the framebuffer for LCD module disabled

    I paste also a dmesg print

    ....net eth0: SMSC911x/921x identified at 0x24000000, IRQ: 175

    IP-Config: Gateway not on directly connected network.

    Freeing unused kernel memory: 10992k freed

    i2c-core: driver [dummy] registered

    i2c-adapter i2c-0: adapter [i2c-bfin-twi] registered

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

    i2c-adapter i2c-1: adapter [i2c-bfin-twi] registered

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

    driver for ADV7183B get_camops

    i2c-core: driver [sensor] registered

    i2c 0-0020: uevent

    sensor 0-0020: probe

    driver for ADV7183B get_camops

    driver for ADV7183B init

    i2c-adapter i2c-0: master_xfer[0] W, addr=0x20, len=2

    i2c-adapter i2c-0: master_xfer[0] W, addr=0x20, len=2

    i2c-adapter i2c-0: master_xfer[0] W, addr=0x20, len=2

    i2c-adapter i2c-0: master_xfer[0] W, addr=0x20, len=2

    i2c-adapter i2c-0: master_xfer[0] W, addr=0x20, len=2

    i2c-adapter i2c-0: master_xfer[0] W, addr=0x20, len=2

    i2c-adapter i2c-0: master_xfer[0] W, addr=0x20, len=2

    i2c-adapter i2c-0: master_xfer[0] W, addr=0x20, len=2

    i2c-adapter i2c-0: master_xfer[0] W, addr=0x20, len=2

    i2c-adapter i2c-0: master_xfer[0] W, addr=0x20, len=2

    i2c-adapter i2c-0: master_xfer[0] W, addr=0x20, len=2

    i2c-adapter i2c-0: master_xfer[0] W, addr=0x20, len=2

    i2c-adapter i2c-0: master_xfer[0] W, addr=0x20, len=2

    i2c-adapter i2c-0: master_xfer[0] W, addr=0x20, len=2

    i2c-adapter i2c-0: master_xfer[0] W, addr=0x20, len=2

    i2c-adapter i2c-0: master_xfer[0] W, addr=0x20, len=2

    i2c-adapter i2c-0: master_xfer[0] W, addr=0x20, len=2

    i2c-adapter i2c-0: master_xfer[0] W, addr=0x20, len=2

    i2c-adapter i2c-0: master_xfer[0] W, addr=0x20, len=2

    ADV7183B: detected client on address 0x20

    ADV7183B: V4L driver Blackfin CMOS Camera now ready

    i2c-adapter i2c-0: client [sensor] registered with bus id 0-0020

    : couldn't allocate dma buffer.

    root:/>

    

 

My doubts:

 

    Why the ADV7183B is detected on address 0x20 and not on 0x40 as the other posts in this forum?

    Why the message after "...CMOS Camera now ready" like other posts "ADV7183B: i2c driver ready" is missing?

    

 

Any suggestions?

 

Best regards,

 

Massimo

TranslateQuoteReplyEditDelete

 

 

2009-11-24 07:32:21     Problem with ADV7183B and BF548 on EZ-KIT lite

Michael Hennerich (GERMANY)

Message: 82700    "ADV7183B: i2c driver ready"

 

Search the driver source - I think I removed this recently.

 

I would start looking here:

 

> : couldn't allocate dma buffer.

 

...Increase the DMA region...

 

-Michael

QuoteReplyEditDelete

 

 

2009-11-24 10:04:32     Re: Problem with ADV7183B and BF548 on EZ-KIT lite

Massimo Savina (ITALY)

Message: 82705   

 

Great!

 

Increasing DMA to 4M dma buffer problem was solved.

 

But now when I start ffmpeg test, process hungs up:

 

root:/>

root:/>

root:/> ffmpeg -f video4linux -r 10.0 -s 720x288 -i /dev/video0 -qscale 6 -f mjpeg foo

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

  configuration: --prefix=/usr --source-path=/home/massimo/blackfin/uclinux-dist-trunk-svn-8948/lib/ffmpeg/build/../ffmpeg-svn-11114 --target-os=Linux --cpu=bfin --arch=bfin --extra-ldflags=    -mcpu=bf548-0.2 --enable-static --enable-shared --enable-gpl --enable-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 Nov 23 2009 16:55:45, gcc: 4.1.2 (ADI svn)

 

Is there a test that can I do to verify the connection with the decoder?

TranslateQuoteReplyEditDelete

 

 

2009-11-24 11:29:15     Re: Problem with ADV7183B and BF548 on EZ-KIT lite

Robin Getz (UNITED STATES)

Message: 82710   

 

Massimo:

 

I thought there were a few simple frame capture applications that would test a capture device in the dist. What release are you using?

 

-Robin

QuoteReplyEditDelete

 

 

2009-11-24 11:52:25     Re: Problem with ADV7183B and BF548 on EZ-KIT lite

Massimo Savina (ITALY)

Message: 82711   

 

Hi,

 

The release is 2.6.31.3-ADI-2010R1-pre

 

Tnx.

 

Massimo.

TranslateQuoteReplyEditDelete

 

 

2009-11-24 12:00:23     Re: Problem with ADV7183B and BF548 on EZ-KIT lite

Mike Frysinger (UNITED STATES)

Message: 82713   

 

use the 2009R1 branch then.  the V4L camera framework probably needs work in trunk.

QuoteReplyEditDelete

 

 

2009-11-26 16:44:10     Re: Problem with ADV7183B and BF548 on EZ-KIT lite

Massimo Savina (ITALY)

Message: 82791   

 

Hi,

 

Now system is running with the in trunk 2009R1, but video still not working.

I had check again with the scope, theese signals near the BF548:

 

    PPI0D0..PPI0D7, data are present.

    PPI0_CLK: 27MHz clock is ok.

    PPI0FS1: pulses are present.

    PPI0FS1: pulses are present.

 

A screen shot follow, with:

 

...loading modules:

 

root:/> modprobe i2c-bfin-twi

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

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

 

root:/> modprobe blackfin-cam

Linux video capture interface: v2.00

driver for ADV7183B get_camops

driver for ADV7183B get_camops

ADV7183B: detecting client on address 0x40

driver for ADV7183B init

ADV7183B: V4L driver Blackfin CMOS Camera now ready

ADV7183B: i2c driver ready

 

 

...running ffmpeg that hung up

 

root:/>  ffmpeg -f video4linux -r 10.0 -s 720x288 -i /dev/video0 -qscale 6 -f mjpeg foo &

401

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

  configuration: --prefix=/usr --source-path=/home/massimo/blackfin/uClinux-dist/lib/ffmpeg/build/../ffmpeg-svn-11114 --target-os=Linux --cpu=bfin --arch=bfin --extra-ldflags=    -mcpu=bf548-0.2 --enable-static --enable-shared --enable-gpl --enable-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 Nov 26 2009 19:30:55, gcc: 4.1.2 (ADI svn)

 

...PPI_DMA == 0 ??? maybe a problem?

 

root:/> cat /proc/interrupts

  6:      22982      CORE  Blackfin CoreTimer

10:          0      INTN  SPORT err

14:          1      INTN  rtc-bfin

16:          0      INTN  SPORT RX Data

17:          0      INTN  SPORT TX Data

37:          1      INTN  BFIN_UART_MODEM_STATUS

44:          0      INTN  PPI_DMA

48:          0      INTN  BFIN_UART_RX

49:         42      INTN  BFIN_UART_TX

52:         61      INTN  i2c-bfin-twi

53:          6      INTN  i2c-bfin-twi

61:          0      INTN  PPI ERROR

68:          3      INTN  pata-bf54x

74:          0      INTN  BF5XX NFC driver

82:          1      INTN  musb_hdrc.0

85:          0      INTN  musb_hdrc.0

175:         13      GPIO  smsc911x

NMI:          0      CORE  Non Maskable Interrupt

Err:          0

 

 

if I run ffmpeg with strace, the process hung up after "ioctl(3, VIDIOCSYNC" as you can see below.

In another thread (  blackfin.uclinux.org/gf/project/uclinux-dist/forum/?_forum_action=ForumMessageBrowse&thread_id=33753&action=ForumBrowse&forum_id=39) Michael says that I don't receive PPI/DMA interrupts, but on by board, signals phisically arrive to bfin. Maybe it's a software mistake.

 

......

mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_SHARED|MAP_ANONYMOUS|0x4000000, 0, 0) = 0x3bc8000

mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_SHARED|MAP_ANONYMOUS|0x4000000, 0, 0) = 0xc72000

open("/dev/video0", O_RDWR|O_LARGEFILE) = 3

ioctl(3, FS_IOC32_GETVERSION or FS_IOC_GETVERSION or VIDIOCGCAP, 0x3b8dbb8) = 0

ioctl(3, VIDIOCGAUDIO, 0x229e898)       = -1 EINVAL (Invalid argument)

ioctl(3, VIDIOCSAUDIO, 0x229e898)       = 0

ioctl(3, VIDIOCGPICT, 0x229e8e0)        = 0

ioctl(3, SONYPI_IOCGBATFLAGS or VIDIOCSPICT, 0x229e8e0) = -1 EINVAL (Invalid argument)

ioctl(3, SONYPI_IOCGBATFLAGS or VIDIOCSPICT, 0x229e8e0) = -1 EINVAL (Invalid argument)

ioctl(3, SONYPI_IOCGBATFLAGS or VIDIOCSPICT, 0x229e8e0) = 0

ioctl(3, VIDIOCGMBUF, 0x3b8dc20)        = 0

mmap2(NULL, 829440, PROT_READ|PROT_WRITE, MAP_SHARED, 3, 0) = -1 ENODEV (No such device)

mmap2(NULL, 829440, PROT_READ|PROT_WRITE, MAP_PRIVATE, 3, 0) = 0x1000

gettimeofday({2018570742, 684000}, NULL) = 0

ioctl(3, VIDIOCMCAPTURE, 0x3b8dca8)     = 0

ioctl(3, VIDIOCMCAPTURE, 0x3b8dca8)     = 0

mmap2(NULL, 118784, PROT_READ|PROT_WRITE, MAP_SHARED|MAP_ANONYMOUS|0x4000000, 0, 0) = 0x22e0000

gettimeofday({2018570742, 688000}, NULL) = 0

nanosleep({0, 96000000}, NULL)          = 0

gettimeofday({2018570742, 788000}, NULL) = 0

mmap2(NULL, 417792, PROT_READ|PROT_WRITE, MAP_SHARED|MAP_ANONYMOUS|0x4000000, 0, 0) = 0x600000

ioctl(3, VIDIOCSYNC

 

Hang up!

 

 

 

What can I check now?

 

Tnx

Massimo

TranslateQuoteReplyEditDelete

 

 

2009-11-26 17:00:23     Re: Problem with ADV7183B and BF548 on EZ-KIT lite

Michael Hennerich (GERMANY)

Message: 82792    The driver by default doesn't talk to BF548 EPPI0.

IIRC it's EPPI1, since EPPI0 on the BF548-EZKIT is connected to the TFT-LCD.

You need to adjust some defines in one of the header files that maps PPI to EPPI defines.

 

-Michael

QuoteReplyEditDelete

 

 

2009-11-26 18:57:23     Re: Problem with ADV7183B and BF548 on EZ-KIT lite

Massimo Savina (ITALY)

Message: 82793   

 

Hi Michael,

 

thanks for replying so fast!

 

in my final application, it is not mandatory to use PPI0 port. With the right circuit modifications I can use PPI1 to acquire video from ADV7183. (keeping free EPPI0 for LCD).

 

In that case (attaching the video decoder to EPPI1 on BF548) the blackfin_cam driver is ready to use? Does it needs some adjustments?

 

Regards, Massimo

TranslateQuoteReplyEditDelete

 

 

2009-11-27 04:37:06     Re: Problem with ADV7183B and BF548 on EZ-KIT lite

Michael Hennerich (GERMANY)

Message: 82807    >In that case (attaching the video decoder to EPPI1 on BF548) the

>blackfin_cam driver is ready to use? Does it needs some adjustments?

 

Well - you may need to make some adjustments in order to support your sensor in question.

 

-Michael

QuoteReplyEditDelete

 

 

2009-11-30 11:58:35     Re: Problem with ADV7183B and BF548 on EZ-KIT lite

Massimo Savina (ITALY)

Message: 82893   

 

Now I attached ADV7183B on the EPPI1 of the BF548, routing signals properly (via AV-Extender), providing 8 data bits plus the 27MHz clock.

 

ffmpeg runs, and capture frames, but they are corrupted. (see attacched bitmap).

 

ffmpeg -f video4linux -r 15.0 -s 720x288 -i /dev/video0 -qscale 6 -f mjpeg /mnt/PAL.mjpeg

 

 

The clock signal seems to be clean (also data bits) watching them with the scope.

Now maybe a software problem.

 

Michael, in your previous reply, you told me...

 

>Well - you may need to make some adjustments in order to support your sensor in question

 

What changes are you talking about? Can you help me to find the starting point?

 

regards.

 

Massimo

 

PAL.jpg

TranslateQuoteReplyEditDelete

 

 

2009-11-30 12:53:17     Re: Problem with ADV7183B and BF548 on EZ-KIT lite

Jean-Christian de Rivaz (SWITZERLAND)

Message: 82896   

 

Hello Massimo,

 

The PPI clock input is very very sensible to overoscillations on the transistion. I have see boards where making a contact between the PPI clock and my hand on the processor side have improved the situation. The ADV7183B have a register that let set the drive power of the clock. Loading the signal with a resistor or a small capacitor also reduce the radio emission.

 

Best regards,

 

Jean-Christian

QuoteReplyEditDelete

 

 

2009-12-07 14:15:44     Re: Problem with ADV7183B and BF548 on EZ-KIT lite

Massimo Savina (ITALY)

Message: 83176   

 

Thanks Jean-Christian,

 

looking around the clock signal, I turned on the define "ADV7183B_STRONG" to enhance signals strength and and finally the decoder capture something meaningful.

 

Now I have two problems, one for colors and one for resolution.

 

As you can see from the first immgine, using the 720x288 resolution (command below) I catch 4 times the same image

 

ffmpeg -f video4linux -r 10.0 -s 720x288 -i devvideo0 -qscale 5 -f mjpeg udp192.168.1.2011234

 

But in the second image using a quarter of a resolution does not capture the complete image

 

ffmpeg -f video4linux -s 360x270 -i /dev/video0 -f mpegts udp:192.168.1.201:1234

 

Furthermore, the colors are wrong compared to the original (see original.png)

 

any suggestions?

 

Thanks in advance

 

Massimo.

 

original.png

image_720x288.png

image_360x270.png

TranslateQuoteReplyEditDelete

 

 

2010-05-30 09:55:52     Re: Problem with ADV7183B and BF548 on EZ-KIT lite

Dusko Cencan (GERMANY)

Message: 90003   

 

Hi Massimo,

 

Did you manage to solve your problem with 4 images in a frame and odd colours? I have a bf548 with OV9655 sensor I now I got the same results as you. I have no idea what this could be. The EPPI_STATUS register reports 0x4 errors (line track overflows). I would really appreciate any help.

 

Thank in advance.

 

image_30.05.jpg

Attachments

Outcomes