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.

VPFE and VPBE settings for loop back test

Other Parts Discussed in Thread: TVP7002

Hi,

I am trying to interface a camera module to the DM365 based custom hardware. I am trying to run the loopback test that comes with DM365 test projects.

Information about my camera module:

Output: YCbCr-BT.601 16 bit , progressive

Cam Clock: 36MHz

I modified the VPFE and VPBE register settings as below.

/*VPFE setings*/

         width   = 1280;  

        height  =720;    
   
        ISIF_SYNCEN =  0x0000;  // Disable VPFE during setup

    ISIF_MODESET = 0x1004;  // Progressive, NOT Interlaced
                                             //  VD polarity as negative
                                             //  HD polarity as positive - this avoids clock offset value
                                             //  HD and VD are inputs to ISIF
    ISIF_HDW     = 0x0000;    //  not needed if HD is input
    ISIF_VDW     = 0x0000;    //  not needed if VD is input

    ISIF_PPLN    = 0x0500;  // 1280

    ISIF_LPFR    = 0x02D0;  // 720
 
     ISIF_SPH     = 0x0000;        //  start pixel horizontal, this can be zero if HD polarity is positive
    ISIF_LNH     =  width;             // * Horizontal lines
   
    ISIF_HSIZE   = width >> 4;                // Horizontal line offset - test 2/23/10
    ISIF_SLV0    = 0x0000;                     // Vertical start line - field 0 - n/a
    ISIF_SLV1    = 0x0000;                     // Vertical start line - field 1 - n/a
 
   ISIF_LNV     = height;                // Vertical lines

    ISIF_CULH    = 0xffff;                         // Disable horizontal culling
    ISIF_CULV    = 0x00ff;                       //  Disable vertical culling
 
    /*
     *  Interleave the two fields
     */
    ISIF_SDOFST      = 0x0249;               // Line offset - test ? - applies for interlaced fields - n/a
    ISIF_CADU          = 0x0400;               // Frame buffer address high
    ISIF_CADL          = 0x0000;               // Frame buffer address low

    
     ISIF_REC656IF    = 0x0000;               // REC656 disabled
 
    /*
     *  Input format is Cb:Y:Cr:Y, w/ Y in odd-pixel position
     */
     ISIF_CCDCFG      = 0x0800;                 // CCD configuration

    ISIF_FMTCFG      = 0x0000;                 // Disable formatter
    ISIF_FMTSPH      = 0x0000;

    ISIF_FMTLNH      =  0x0500;  //  test - ? - spec states that this is a reserved register

    ISIF_FMTSLV      = 0x0000;
    ISIF_FMTLNV      = 0x0000;
    ISIF_SYNCEN      = 0x0003;                 // Enable CCDC
}

/*VPBE settings*/

 basep_x = 122;
 basep_y = 18;
 width   = 1280;//720;
height  = 720;//480;

  /*
     * Setup clocking / DACs
     */
    VDAC_CONFIG         = 0x081141CC;//0x081141CF;   // Take DACs out of power down mode
    VPSS_CLKCTL         = 0x00000018;   // Enable DAC and VENC clock, both at 27 MHz
    VPSS_VPBE_CLK_CTRL  = 0x00000011;   // Select enc_clk*1, turn on VPBE clk
 VENC_CLKCTL         = 0x00000001;   // Enable venc & digital LCD clock

    /*
     * Setup OSD
     */
    OSD_MODE       = 0x000000fc;   // Blackground color blue using clut in ROM0
    OSD_OSDWIN0MD  = 0;            // Disable both osd windows and cursor window
    OSD_OSDWIN1MD  = 0;
    OSD_RECTCUR    = 0;

    OSD_VIDWIN0OFST = 0x1000 | width >> 4;
    OSD_VIDWINADH  = 0x0000;
    OSD_OSDWIN0ADL = 0x0000;
    OSD_BASEPX     = basep_x;
    OSD_BASEPY     = basep_y;
    OSD_VIDWIN0XP  = 0;
    OSD_VIDWIN0YP  = 0;
    OSD_VIDWIN0XL  = width;
    OSD_VIDWIN0YL  =  height;//height >> 1;

    OSD_VIDWINMD   = 0x00000003;   // Disable vwindow 1 and enable vwindow 0
                                        // Frame mode with no up-scaling

    /*
     *  Setup VENC
     */
    if ( ntsc_pal_mode == NTSC )
        VENC_VMOD  = 0x000000403; //0x00000003;   // Standard NTSC interlaced output
    else
        VENC_VMOD  = 0x00000043;   // Standard PAL interlaced output

    VENC_VDPRO     = colorbar_loopback_mode << 8;
   // VENC_VDPRO    |= 0x200;  // 100% Color bars
    VENC_DACTST    = 0;

    /*
     *  Choose Output mode
     */
    if ( output_mode == COMPOSITE_OUT )
        VENC_DACSEL = 0x00000000;
    else if ( output_mode == SVIDEO_OUT )
        VENC_DACSEL = 0x00004210;

Please suggest if I am missing anything in the seetings above.Let me know if you need any details from me. Thank you very much.

PVK

 

 

  • Hi Padmini,

    The VPFE settings look ok. What exactly is the output you are getting? I mean can we divide the problem in two parts and check the VPFE captured data separately and play a pre-loaded YUV data on VPBE. For VPBE settings, i think there is something wrong as you are trying to read a 720P frame size and send out NTSC or PAL D1 signal.

    Also, have you made sure that the input device (say TVP7002 or similar) is configured correctly and feeding a BT601 signal to DM365? Similarly, for the output side, i assume you are trying to display a D1 data using either composite or SVideo output, then you should keep width and height as 720x480 and offset as 1280, instead of your current settings.

     

    As stated earlier, let us first isolate capture issue and then focus on display to get the loopback working, or vice-versa.

    Regards,

    Anshuman

  • Hi Anshuman,

    Thank you for your reply. We did get the video on the display to work correctly. We made the followin changes for VPBE as suggested by you.

    width   = 720;
    height  = 480;

    OSD_VIDWIN0OFST =0x1000 | 1280>>4;

    By doing these changes we were able to get the video to display on the monitor clearly but with a grey bar at the top of the video. Please see the attached picture for referrence. Also could you explain why do you use 0x1000 for OSD_VIDWIN0OFST.We understand V0L0 bit filed is 16 bits/pixel but we do not know why V0AH is set to 0x1000.

     

    To rectify the grey bar problem, we changed the VPFE  ISIF_MODESET  register to 0x1000 making HD polarity negative. (Which was positive before)

    This eliminated the grey bar and gave us proper video as seen below. We had HD polarity set to positive to avoid clock offset but looks like it had to be negative. Can explain why.

    We give 1280x720 input to the VPSS and set up the VPBE to display 720x480(NTSC D1). How does VENC module scale down the video image to 720x480? Is there a register setting for this?

     

     

    Regards,

    PVK

  • Hi Padmini,

    >>>OSD_VIDWIN0OFST =0x1000 | 1280>>4;

    I dont think it is needed to set 0x1000. Do you see that without setting 0x1000, you get bad output on display?

     

    >>>ISIF_MODESET  register to 0x1000 making HD polarity negative.

    For the other issue of ISIF_MODESET, you are setting it to polarity to positive. HDPOL bit (bit 3) shows 0. Can you tell me the value of this register when you see grey bar and when you dont see the grey bar?

     

    Can you share the register dump of OSD module and the VENC module in your test? There are some upsamplers in OSD module but there is no direct downsampling mode from 1280x720 to 720x480.

     

    Regards,

    Anshuman

  • Hi Anshuman,

    >>OSD_VIDWIN0OFST =0x1000 | 1280>>4;

    >> I dont think it is needed to set 0x1000. Do you see that without setting 0x1000, you get bad output on display?

    We see a bad display if we dont use 0x1000. Please see the attached video for the reference.

    >>>ISIF_MODESET  register to 0x1000 making HD polarity negative.

    >>For the other issue of ISIF_MODESET, you are setting it to polarity to positive. HDPOL bit (bit 3) shows 0. Can you tell me the value of this register when you see grey bar and when you dont see the grey bar

    The value of  ISIF_MODESET when we see the grey bar is 0x1004 and when we dont see the grey bar is 0x1000.

    >> Can you share the register dump of OSD module and the VENC module in your test? There are some upsamplers in OSD module but there is no direct downsampling mode from 1280x720 to 720x480.

    Below is the register dump for the OSD registers.

     Below is the dump for VENC registers.

     

     

     Thanking you,

    PVK

     

  • Hi Padmini,

    >>>>OSD_VIDWIN0OFST =0x1000 | 1280>>4;

    >>> I dont think it is needed to set 0x1000. Do you see that without setting 0x1000, you get bad output on display?

    >>We see a bad display if we dont use 0x1000. Please see the attached video for the reference.

    I checked and figured out that there is a documentation problem in the VPBE Programmers Guide. It mentions that address in OSD registers has to be set as offset from SDRAM base address. But actually, the case is that the address is the absolute physical address of SDRAM and not the offset. Ofcourse, the setting in register has to be in units of 32 bytes, which means the actual physical address right shifted by 5 need to be set in those registers.

    The address looks as below:

    32 bit address when shifted by 5 becomes 27 bit address.

    Bit 26:23 are in V0AH of VIDWIN0OFST

    Bit 22:16 are in V0AH in VIDWINADH

    Bit 15:0 are in VIDWIN0ADL

    Now assume you had your OSD input data at SDRAM start location, which is 0x80000000. When converted into units of 32 bytes, it becomes 0x80000000 >> 5 which is 0x04000000. this shows bit 26 is set to 1.

    For this reason we had to do an OR ( | ) with 0x1000 in VIDWIN0OFST register.

    >>> HD Polarity issue

    For the hD polarity issue, i am not sure if i can get the right reason. If it was VD polarity, i can explain that there can be a shift in the data downwards because, the data latching starts as soon as the VD signal or HD signal polarity is matched. But for hD polarity case, my explaination does not hold good. Also, you are not seeing a shift in data but a grey bar coming on top of your expected data. Can you explain where do you capture this YUV data? Is it after iSIF or after Resizer module?

    >>> Output of 720x480 and input of 1280x720 issue

    For this issue, i looked at your registers. I can see that your input data is 1280x720 but the actual frame size that you are using is 720x480 set in vIDWIN0XL and VIDWIN0YL. This means OSD hardware is reading the data such that the line offset is 1280x2 bytes and frame size is 720 lines, but it considers the active frame as 720x480 only. Are you sure you are getting the full field of view that you expect? I am thinking you are getting only 720x480 from your full frame size of 1280x720, from the top left corner. One way to check is changing the VIDWIN0XP and vIDWIN0YP registers.

    Regards,

    Anshuman