2009-03-13 09:46:20     V4L problems with higher resolution (12bit) video sensors

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

2009-03-13 09:46:20     V4L problems with higher resolution (12bit) video sensors

Marco Rohleder (GERMANY)

Message: 70953   

 

Hi !

 

I've connected a 12 bit resolution video image sensor to PPI of BF537-STAMP.

 

Connections are :

 

SENSOR D11  <>  PG7

SENSOR D10  <>  PG6

SENSOR D9    <>  PG5

SENSOR D8    <>  PG4

SENSOR D7    <>  PG3

SENSOR D6    <>  PG2

SENSOR D5    <>  PG1

SENSOR D4    <>  PG0

SENSOR D3    <>  PG11

SENSOR D2    <>  PG10

SENSOR D1    <>  PG9

SENSOR D0    <>  PG8

 

So it is still possible to use it in "low resolution" 8-bit mode while doing 8bit PPI transfers via PG0..7 and only read in the upper 8 bits as usual. This works.

 

Then i tried to change the settings like follows to configure the PPI for 16bit transfers:

 

# define POL_C                  0x0000

# define POL_S                  0x0000

# define PIXEL_PER_LINE         640

# define LINES_PER_FRAME        480

# define CFG_GP_Input_3Syncs    0x0020

# define GP_Input_Mode          0x000C

# define PPI_DATA_LEN           DLEN_16    // org:DLEN_8

# define PPI_PACKING            0     // org:PACK_EN

# define DMA_FLOW_MODE          0x0000    /* STOPMODE */

# define DMA_WDSIZE_16          WDSIZE_16 // org:WDSIZE_16

 

but this seems not to work.

 

When i print out the first pixels of a line it looks like this:

 

8bit-mode :  10 20 30 40 50 60 70 80 90   ( increasing greyscale bar )

 

16bit-mode :  10 00 20 00 30 00 40 00 50 00 60 00 70 00 80 00 90 00

 

In the places where the 00's are, should be the 4 LSBs of the sensor

 

I although hardwired some logic levels to PG8..PG15 but i always read 00's instead of PG8..PG15.

 

I although played with DMA_WDSIZE,  PACK_EN  etc, but no changes.

 

What do i wrong ?

 

-  Marco

 

 

 

QuoteReplyEditDelete

 

 

2009-03-13 09:59:36     V4L problems with higher resolution (12bit) video sensors

Michael Hennerich (GERMANY)

Message: 70954    For PPI 8-bit mode this looks ok.

You connected the Sensor MSBs to the lower 8-bit of the PPI.

However this needs to be shifted in 12-bit mode to align PPI0 with SENSOR0.

 

>I although played with DMA_WDSIZE,  PACK_EN  etc, but no changes.

 

>What do i wrong ?

 

I don't think the driver is generic enough to magically work in 16-bit mode by just changing these two defines.

 

-Michael

 

 

QuoteReplyEditDelete

 

 

2009-03-13 10:12:16     Re: V4L problems with higher resolution (12bit) video sensors

Marco Rohleder (GERMANY)

Message: 70955   

 

Michael !

 

You are right. I have to shift.

 

But connecting it in this way gives me the following advantages:

 

- I can use the "normal" 8bit PPI transfers and ignore the lower 4 LSBs of sensor data just as noise. This is let it call fast mode

 

- On the other hand, when capturing 12bits i do some kind of exposure control. That means after each frame there runs a alogorithm to decide whether the picture is under or overexposed and to decide which 8 of the 12 bits should be used. In environments with good light conditions this could be D2..D10, while at direct sunlight D12..D4 and at darkness D7..D0.

 

Also some registers within the sensor are upgraded after every frame e.g. white balance.

 

I although printed out, what is written to the PPI control and DMA control registers.

 

Looks all okay to me.

 

Any further idea where to continue my debugging activities ?

 

Marco

 

 

 

 

 

 

QuoteReplyEditDelete

 

 

2009-03-13 10:24:05     Re: V4L problems with higher resolution (12bit) video sensors

Michael Hennerich (GERMANY)

Message: 70956    Check PPI_COUNT, and DMA X Count

 

-Michael

 

QuoteReplyEditDelete

 

 

2009-03-14 02:55:13     Re: V4L problems with higher resolution (12bit) video sensors

Marco Rohleder (GERMANY)

Message: 70973    I spent the whole night, but no success. Do we have ANY other driver within the dist, which uses 16bit PPI DMA ? There must be anything wrong in the SPI oder DMA setup but i didnt find anything. The documentation about the PPi loocks quite easy but not that for the DMA. These count registers speicfy how much data to write to memory for the whole frame and for each line. ,My problem is still, that input data on the lower 8 bits of PPI (PG0..7) is writtem correctly to memory but not the upper 8 bits (PG8..15). At the place in memory where the data should be are just 0x00s. So the DMA is not writing enough data, but it ignores the upper 8 bitd and writes 00 bytes instead.

QuoteReplyEditDelete

 

 

2009-03-15 08:53:35     Re: V4L problems with higher resolution (12bit) video sensors

Michael Hennerich (GERMANY)

Message: 71001    Marco,

 

I wonder if you programmed peripheral_request_list() with arguments to

request all 16 PPI data strobes?

 

Have a look at function setup_pin_mux(int action)()

 

-Michael

 

QuoteReplyEditDelete

 

 

2009-03-16 12:51:35     Re: V4L problems with higher resolution (12bit) video sensors

Marco Rohleder (GERMANY)

Message: 71044   

 

Michael !

 

You are the greatest one, after me of course :=)

 

That fixed the problem.

I looked everywhere but not there.

 

Should i add some changed to automatically change that wenn PPI bus width >8 bit is selected.

 

There is also another thin missing in:

 

 

 

static int bcap_reset_wsize(u32 height, u32 width)

...    if (bcap_dev->ppidev->bpp > 8)

        set_dma_x_count(CH_PPI, bcap_dev->ppidev->pixel_per_line);

    else

        set_dma_x_count(CH_PPI, bcap_dev->ppidev->pixel_per_line /*/ 2*/); //MRO

    /* Div 2 because of 16-bit packing */

...

 

Dividing by 2 is not correct in this case because with bus widhts >8 bit we have no packing.

 

Should i add some fixes ?

 

One again ... thank you very much for your assistance.

 

Are you one from that ADI-guys from Munich ?

 

Michael Mayer-Punzack visited me a few months ago.

 

The next time, when i'm in your neighbourhood i will invite you to a beer.

 

- Marco

 

 

 

 

QuoteReplyEditDelete

 

 

2009-03-16 13:01:41     Re: V4L problems with higher resolution (12bit) video sensors

Michael Hennerich (GERMANY)

Message: 71045    Marco,

 

>Should i add some fixes ?

Please submit your backfin_cam PPI16 patch.

 

>Are you one from that ADI-guys from Munich ?

 

Yes - Feel free to stop by in case you're in the office anyway.

 

-Michael

Attachments

    Outcomes