2008-04-14 04:32:57     adv7183b frame capture program

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

2008-04-14 04:32:57     adv7183b frame capture program

Bastien Briec (FRANCE)

Message: 54192    hello, I work on a cm-bf537e with an ext-bf5xx-video, I use the ppifcd framecapture driver and I try the following test program in order to get a picture :

 

    #define IMG_WIDTH 640

    #define IMG_HEIGHT 480

 

    #include <stdio.h>

    #include <stdlib.h>

    #include <fcntl.h>

    #include <unistd.h>

    #include <sys/ioctl.h>

 

    #include "bfin_ppi.h"

    #include "pflags.h"

 

    void getImage();

 

    char rawImgBuff[IMG_WIDTH*IMG_HEIGHT*1]; //buffer to store frame from PPI port

 

    int main( int argc, char** argv )

    {

      int fd_oe;

      fd_oe = open("/dev/pg13", O_RDWR, 0);

      if (fd_oe < 0) {

        printf("open error pg13 \t\n");

        return -1;

      }

    

      ioctl(fd_oe, SET_FIO_DIR, OUTPUT);

      ioctl(fd_oe, SET_FIO_INEN, INPUT_DISABLE);

    

      write(fd_oe, "0", sizeof("0"));

    

      int fileDes; //file descriptor variable

    

      getImage();// call getImage to capture frame from PPI port

      fileDes=creat("capturedImg.raw",O_WRONLY); //create file "capturedImg.raw"

      write(fileDes,rawImgBuff,IMG_WIDTH*IMG_HEIGHT*1);// write image to that file

      close(fileDes);//close image file

    

      return 0;

    }

 

    void getImage(void)

    {

        int fd;

        fd = open("/dev/ppi0", O_RDWR,0);

        if (fd==-1)

        {

            printf(" error opening device. fd=-1\n");

            exit(1);

        }

 

        ioctl(fd, CMD_PPI_LINELEN, IMG_WIDTH);

        ioctl(fd, CMD_PPI_NUMLINES, IMG_HEIGHT);

        ioctl(fd, CMD_PPI_PORT_DIRECTION, CFG_PPI_PORT_DIR_RX);

        ioctl(fd, CMD_PPI_XFR_TYPE, CFG_PPI_XFR_TYPE_646_AF);

        ioctl(fd, CMD_PPI_FIELD_SELECT, CFG_PPI_FIELD_SELECT_1);

        ioctl(fd, CMD_PPI_PACKING, CFG_PPI_PACK_ENABLE);

 

        ioctl(fd, CMD_PPI_SKIPPING, CFG_PPI_SKIP_ENABLE);//set skipping to get greyscale image from ADV7183

        //otherwise remove this line

 

        ioctl(fd, CMD_PPI_DATALEN, CFG_PPI_DATALEN_8);

        ioctl(fd, CMD_PPI_SET_DIMS, CFG_PPI_DIMS_2D);

        ioctl(fd, CMD_PPI_SETGPIO, 1);

 

        read(fd,rawImgBuff,IMG_WIDTH*IMG_HEIGHT*1);

        close(fd);

    };

 

The first problem is I get a file which size is 294912(1024*288?) instead of 307200(640*480) and i don't know why, and the other is about the ioctl command, here is any documentation about the meaning of the CMD_PPI_* for the configuration of the ppi.

Bests regards,

    Bastien

TranslateQuoteReplyEditDelete

 

 

2008-04-15 05:46:55     Re: adv7183b frame capture program

Yi Li (CHINA)

Message: 54250    did you read:

http://docs.blackfin.uclinux.org/doku.php?id=sample_ppi_driver

QuoteReplyEditDelete

 

 

2008-04-15 10:49:35     Re: adv7183b frame capture program

Bastien Briec (FRANCE)

Message: 54282    yes I read it but I don't want to do my own driver, i just want to use the ppifcd one, I already configure the adv7183 with i2c and am able to see the video using the direct loop throught the adv7171 but I can't capture a frame, do I need to synchronize with the dma or is it done in the driver, cause there is no fsc pin

TranslateQuoteReplyEditDelete

 

 

2008-04-15 22:33:35     Re: adv7183b frame capture program

Yi Li (CHINA)

Message: 54296    Hi,

 

Please refer to the test case: uclinux-dist/user/blkfin-test/ppifcd-test/. As the Readme.txt in the folder says:

 

"The test application defaults to a Micron MT9M001 1.3 Megapixel CMOS digital imagine sensor.

(1280 x 1024 pixels). In case you want to use this application with an different sensor,

you have to do some slight modifications to the source code in ppifcd_test.c."

QuoteReplyEditDelete

 

 

2008-04-16 02:56:59     Re: adv7183b frame capture program

Yi Li (CHINA)

Message: 54303    BTW, if you just want to get raw image from adv7171 framebuffer driver, you can refer to: http://docs.blackfin.uclinux.org/doku.php?id=framebuffer

QuoteReplyEditDelete

 

 

2008-04-16 08:58:18     Re: adv7183b frame capture program

Bastien Briec (FRANCE)

Message: 54333    I use the ppifcd_test program I modify for the adv7183b (the gpio pin oe) but I don't get a correct frame, I see in adsp-ppifcd.h that there where a configuration like :

 

    #ifdef MT9V022

    #define POL_C             0x0000

    #define POL_S             0x0000

    #define PIXEL_PER_LINE    720

    #define LINES_PER_FRAME    488

    #define CFG_GP_Input_3Syncs     0x0020

    #define GP_Input_Mode            0x000C

    #define PPI_DATA_LEN            DLEN_8

    #define PPI_PACKING                PACK_EN

    #define DMA_FLOW_MODE            0x0000 //STOPMODE

    #define DMA_WDSIZE_16            WDSIZE_16

    #endif

 

I think I have to do the same for the adv but where can i find the values to put in those define and does the driver work without hardware synchronization without hsynch and vsynch and fsynch and how to synchonize with the soft

TranslateQuoteReplyEditDelete

 

 

2008-04-17 04:09:35     Re: adv7183b frame capture program

Bastien Briec (FRANCE)

Message: 54388    I use the bfin_ppi.c driver instead of the bfin_ppifcd.c, but when running my frame capture program i get the following error :

 

    PPI Error: PPI Status = 0x100

    PPI Error: PPI Status = 0x100

    PPI Error: PPI Status = 0x100

    PPI Error: PPI Status = 0x100

    PPI Error: PPI Status = 0x100

    PPI Error: PPI Status = 0x100

    PPI Error: PPI Status = 0x100

    PPI Error: PPI Status = 0x500

    PPI Error: PPI Status = 0x500

    PPI Error: PPI Status = 0x500

    PPI Error: PPI Status = 0x500

    PPI Error: PPI Status = 0x500

    PPI Error: PPI Status = 0x500

    PPI Error: PPI Status = 0x500

    PPI Error: PPI Status = 0x100

    PPI Error: PPI Status = 0x100

    PPI Error: PPI Status = 0x100

    PPI Error: PPI Status = 0x100

    PPI Error: PPI Status = 0x100

    PPI Error: PPI Status = 0x100

    PPI Error: PPI Status = 0x100

    PPI Error: PPI Status = 0x500

    PPI Error: PPI Status = 0x500

    PPI Error: PPI Status = 0x500

    PPI Error: PPI Status = 0x500

    PPI Error: PPI Status = 0x500

    PPI Error: PPI Status = 0x500

    PPI Error: PPI Status = 0x500

    PPI Error: PPI Status = 0x100

    PPI Error: PPI Status = 0x100

    PPI Error: PPI Status = 0x100

    PPI Error: PPI Status = 0x100

    PPI Error: PPI Status = 0x1000

    PPI Error: PPI Status = 0x1000

    PPI Error: PPI Status = 0x1000

Attachments

    Outcomes