This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Help to modify vpifmodeconfig function in vpif.c for LCDKC6748 to receive 480i sd PAL video on vpif

Other Parts Discussed in Thread: TVP5147

I am trying to run the facedetect demo on the LCDKC6748 board. I figured that it only works for NTSC input. What should I change in vpif.c 's function VPIF mode config so that the parameters work for PAL

this is the function with parameters to be modified

void VPIFCaptureModeConfig(unsigned int baseAddr, unsigned int mode, unsigned int sdChannel, unsigned int rawWidth, VPIFVbufParam* buf)
{    /*
    typedef struct vbufParam
    {
    unsigned int sav2eav;
    unsigned int eav2sav;
    unsigned int vsize;
    unsigned int l1;
    unsigned int l3;
    unsigned int l5;
    unsigned int l7;
    unsigned int l9;
    unsigned int l11;
    } VPIFVbufParam;
    */
    if(mode==VPIF_480I)
    {
        if(sdChannel==VPIF_CHANNEL_0)
        {
            HWREG(baseAddr + C0HCFG) = (268 << VPIF_C0HCFG_EAV2SAV_SHIFT) | (1440 << VPIF_C0HCFG_SAV2EAV_SHIFT);
            HWREG(baseAddr + C0VCFG0) = (4 << VPIF_C0VCFG0_L1_SHIFT) | (20 << VPIF_C0VCFG0_L3_SHIFT);
            HWREG(baseAddr + C0VCFG1) = (264 << VPIF_C0VCFG1_L5_SHIFT) | (266 << VPIF_C0VCFG1_L7_SHIFT);
            HWREG(baseAddr + C0VCFG2) = (283 << VPIF_C0VCFG2_L9_SHIFT) | (1 << VPIF_C0VCFG2_L11_SHIFT);
            HWREG(baseAddr + C0VSIZE) = 525 << VPIF_C0VSIZE_VSIZE_SHIFT;
        }
        if(sdChannel==VPIF_CHANNEL_1)
        {
            HWREG(baseAddr + C1HCFG) = (268 << VPIF_C1HCFG_EAV2SAV_SHIFT) | (1440 << VPIF_C1HCFG_SAV2EAV_SHIFT);
            HWREG(baseAddr + C1VCFG0) = (4 << VPIF_C1VCFG0_L1_SHIFT) | (20 << VPIF_C1VCFG0_L3_SHIFT);
            HWREG(baseAddr + C1VCFG1) = (264 << VPIF_C1VCFG1_L5_SHIFT) | (266 << VPIF_C1VCFG1_L7_SHIFT);
            HWREG(baseAddr + C1VCFG2) = (283 << VPIF_C1VCFG2_L9_SHIFT) | (1 << VPIF_C1VCFG2_L11_SHIFT);
            HWREG(baseAddr + C1VSIZE) = 525 << VPIF_C1VSIZE_VSIZE_SHIFT;
        }
    }
    if(mode==VPIF_CAPTURE_RAW)
    {
        /* TBD */
    }
    if(mode==VPIF_NONSTANDARD)
    {
        /* TBD */
        if(sdChannel==VPIF_CHANNEL_0);
        if(sdChannel==VPIF_CHANNEL_1);
    }
    
    /* TBD */
}

  • Hi Vivek

    I have just made my C6748 LCDK board to run the face detect demo using a PAL camera.

    I had to do the flowing steps to acheave this:

    1. in the TVP5147 I have changed line47 with "CodecRegWrite(baseAddr, 0x02, 0x02);"

    2 in the same files I have commented out lines: 48, 49, 50 (the "while" thing caused me issues )

    3. in the vpif.h at line 105 you add: "#define VPIF_PAL                                3"

    4. in the vpif.c file (from were you got the code) add above "if(mode==VPIF_CAPTURE_RAW)" the next lines:

    if(mode==VPIF_PAL)
            {
                if(sdChannel==VPIF_CHANNEL_0)
                {
                    HWREG(baseAddr + C0HCFG) = (280 << VPIF_C0HCFG_EAV2SAV_SHIFT) | (1440 << VPIF_C0HCFG_SAV2EAV_SHIFT);
                    HWREG(baseAddr + C0VCFG0) = (1 << VPIF_C0VCFG0_L1_SHIFT) | (23 << VPIF_C0VCFG0_L3_SHIFT);
                    HWREG(baseAddr + C0VCFG1) = (311 << VPIF_C0VCFG1_L5_SHIFT) | (313 << VPIF_C0VCFG1_L7_SHIFT);
                    HWREG(baseAddr + C0VCFG2) = (336 << VPIF_C0VCFG2_L9_SHIFT) | (624 << VPIF_C0VCFG2_L11_SHIFT);
                    HWREG(baseAddr + C0VSIZE) = 625 << VPIF_C0VSIZE_VSIZE_SHIFT;
                }
                if(sdChannel==VPIF_CHANNEL_1)
                {
                    HWREG(baseAddr + C1HCFG) = (280 << VPIF_C1HCFG_EAV2SAV_SHIFT) | (1440 << VPIF_C1HCFG_SAV2EAV_SHIFT);
                    HWREG(baseAddr + C1VCFG0) = (1 << VPIF_C1VCFG0_L1_SHIFT) | (23 << VPIF_C1VCFG0_L3_SHIFT);
                    HWREG(baseAddr + C1VCFG1) = (311 << VPIF_C1VCFG1_L5_SHIFT) | (313 << VPIF_C1VCFG1_L7_SHIFT);
                    HWREG(baseAddr + C1VCFG2) = (336 << VPIF_C1VCFG2_L9_SHIFT) | (624 << VPIF_C1VCFG2_L11_SHIFT);
                    HWREG(baseAddr + C1VSIZE) = 625 << VPIF_C1VSIZE_VSIZE_SHIFT;
                }
            }

    5 recompile the driver project which will generate a new driver.lib file (you would better save the old one with a different extension, just in case)

    6 in the "facedetect_lcdk.c" change line 88 to: #define CAPTURE_IMAGE_HEIGHT                     (576)

    7 in the same file on line 456 add "VPIFCaptureModeConfig(SOC_VPIF_0_REGS, VPIF_PAL, VPIF_CHANNEL_0, 0, (struct vbufParam *) 0);" and coment the line above

    Good Luck

    Iaroslav

  • Thanks a lot for your help. I will test the code and let you know.

  • Hi,

    I am using CP-GAC-DC65L2H1 PAL camera with 650 TVL (720 X 480)resolution to run facedetect demo on LCDK6748 Board..

    I have modified my code as described by Iaroslav.Still I am not able to display captured image on VGA monitor.

    I only get blank screen. Are there any other changes required in the code?

    Please Help me to solve this problem.



  • Hi Thaker,

    I have just retested my own solutions and realized is easy to get mixed-up.

    To help I have attached the drivers.lib for debug and release.

    You must place them in:

    C:\Texas Instruments\pdk_C6748_2_0_0_0\C6748_StarterWare_1_20_03_03\binary\c674x\cgt_ccs\c6748\drivers

    Double check that your facedetect project looks there for the driver.lib

    I hope it helps.

    I0211.drivers_debug.lib1273.drivers_release.libaroslav

    P.S. Erase _debug and _release from the files name.

  • Thanks Andrei, its working.

  • Thank you very much Laroslav for your kind help.

    It is working......

    Now I will have to check,how to recompile VPIF driver library ?

  • The driver library is common for all peripherals of 6748 and available as a project which you have to import from the pdk_C6748 folder. After editing all necessary files just built the project, to generate a new .lib at its default location normally on compiling. If you want your original project to use any other lib file then go Project Properties->Linker options and change the lib address from there.

  • Thanks Vivek Parmar.

    I got it.

  • Hello !!

    I have the some issue i follow the steps and i have no error but when i load the program I get no things in the screen.

    Could please attch the project that work

    Think you very much

    Think you !!

  • I am getting the same problem. Did you figure out how to solve this? Let me know.

    vivek