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.

store the video in DDR2 and playback using DM6446EVM

Other Parts Discussed in Thread: TVP5146, PCF8574A

Hi..

i am using the dm6446 evaluation module. Presently i am working with video storage part. The video loopback is working properly. The vpfe is looped back to the vpbe, the video which i am feeding in, i can see that in the output display end.

Now i want  to store the video in ddr2 , which is coming to the vpfe. after some times i have to play back the same. please help out on this problem. what are the steps to store the captured video in DDR & play back from DDR. can any one give the sample code.  i am working with CCS 5.0. 

i am new to the video processor, right now i dont want to use dvsdk.

The video loop back code which we are using is

--------------------------------------------------------------------------------------------------------------------------------------------------------------------


#include "davincievm_i2c.h"

#define TVP5146_I2C_ADDR 0x5D

Uint16 temp,temp2;

/* ------------------------------------------------------------------------ *
* *
* tvp5146_rset *
* *
* Set codec register regnum to value regval *
* *
* ------------------------------------------------------------------------ */
void tvp5146_rset( Uint8 regnum, Uint8 regval )
{
Uint8 cmd[2];
cmd[0] = regnum; // 8-bit Register Address
cmd[1] = regval; // 8-bit Register Data

DAVINCIEVM_I2C_write( TVP5146_I2C_ADDR, cmd, 2 );
}

/* ------------------------------------------------------------------------ *
* *
* tvp5146_rget *
* *
* Return value of codec register regnum *
* *
* ------------------------------------------------------------------------ */
Uint8 tvp5146_rget( Uint8 regnum )
{
Uint8 cmd[2];

cmd[0] = regnum; // 8-bit Register Address
cmd[1] = 0; // 8-bit Register Data

DAVINCIEVM_I2C_write( TVP5146_I2C_ADDR, cmd, 1 );
DAVINCIEVM_I2C_read ( TVP5146_I2C_ADDR, cmd, 1 );

return cmd[0];
}

/* ------------------------------------------------------------------------ *
* *
* tvp5146_init( ) *
* *
* Initialize the TVP5146 *
* *
* ------------------------------------------------------------------------ */
void tvp5146_init( )
{

DAVINCIEVM_waitusec( 1000 ); // wait 1 msec

tvp5146_rset( 0xE8, 0x02 ); // Initalize TVP5146, must do after power on
tvp5146_rset( 0xE9, 0x00 );
tvp5146_rset( 0xEA, 0x80 );
tvp5146_rset( 0xE0, 0x01 );
tvp5146_rset( 0xE8, 0x60 );
tvp5146_rset( 0xE9, 0x00 );
tvp5146_rset( 0xEA, 0xB0 );
tvp5146_rset( 0xE0, 0x01 );
tvp5146_rset( 0xE0, 0x00 );

DAVINCIEVM_waitusec( 1000 ); // wait 1 msec

tvp5146_rset( 0x00, 0x05 ); // Input Video: CVBS : VI_2_B// composite video
// tvp5146_rset( 0x00, 0x46 ); // Input Video: S-video: VI_2_C(Y) VI_1_C(C)
// tvp5146_rset( 0x02, 0x2 ); // NTSC
// tvp5146_rset( 0x05, 0x60 );
tvp5146_rset( 0x34, 0x11 ); // Enabling clock & Y/CB/CR input format
tvp5146_rset( 0x16, 0x58 );
tvp5146_rset( 0x17, 0x0 );
tvp5146_rset( 0x18, 0x28 );
tvp5146_rset( 0x19, 0x3 );
tvp5146_rset( 0x1a, 0x0 );
tvp5146_rset( 0x1b, 0x0 );
tvp5146_rset( 0x1c, 0x40 );
tvp5146_rset( 0x1d, 0x0 );
tvp5146_rset( 0x1e, 0x1 );
tvp5146_rset( 0x1f, 0x0 );
tvp5146_rset( 0x20, 0x4 );
tvp5146_rset( 0x21, 0x0 );
tvp5146_rset( 0x22, 0x6f );
tvp5146_rset( 0x23, 0x2 );
tvp5146_rset( 0x24, 0x17 );
tvp5146_rset( 0x25, 0x0 );

temp = tvp5146_rget(0x3f);

DAVINCIEVM_waitusec( 1000 ); // wait 1 msec
}

#define PAL 1

#if NTSC
#define BASEP_X 0x7A // 122
#define BASEP_Y 0x12 // 18
#elif PAL
#define BASEP_X 0x84 // 132
#define BASEP_Y 0x16 // 22
#endif

/* ------------------------------------------------------------------------ *
* *
* vpfe_init( ) *
* *
* NTSC: *
* Width: 720 *
* Height: 480 *
* *
* *
* ------------------------------------------------------------------------ */
void vpfe_init( Uint32 buffer, Uint32 width, Uint32 height )
{
VPFE_SYN_MODE = 0x00032F84; // interlaced, with VD pority as negative
VPFE_HD_VD_WID = 0;
VPFE_PIX_LINES = 0x02CF0271;

/*
* sph = 1, nph = 1440, according to page 32-33 of the CCDC spec
* for BT.656 mode, this setting captures only the 720x480 of the
* active NTSV video window
*/
VPFE_HORZ_INFO = width << 1; // Horizontal lines
VPFE_HSIZE_OFF = width << 1; // Horizontal line offset
VPFE_VERT_START = 0; // Vertical start line
VPFE_VERT_LINES = height >> 1; // Vertical lines
VPFE_CULLING = 0xFFFF00FF; // Disable cullng

/*
* Interleave the two fields
*/
VPFE_SDOFST = 0x00000249;
VPFE_SDR_ADDR = buffer;
VPFE_CLAMP = 0;
VPFE_DCSUB = 0;
VPFE_COLPTN = 0xEE44EE44;
VPFE_BLKCMP = 0;
VPFE_FPC_ADDR = 0x86800000;
VPFE_FPC = 0;
VPFE_VDINT = 0;
VPFE_ALAW = 0;
VPFE_REC656IF = 0x00000003;

/*
* Input format is Cb:Y:Cr:Y, w/ Y in odd-pixel position
*/
VPFE_CCDCFG = 0x00000800;
VPFE_FMTCFG = 0;
VPFE_FMT_HORZ = 0x000002D0;
VPFE_FMT_VERT = 0x00000272;
VPFE_FMT_ADDR0 = 0;
VPFE_FMT_ADDR1 = 0;
VPFE_FMT_ADDR2 = 0;
VPFE_FMT_ADDR3 = 0;
VPFE_FMT_ADDR4 = 0;
VPFE_FMT_ADDR5 = 0;
VPFE_FMT_ADDR6 = 0;
VPFE_FMT_ADDR7 = 0;
VPFE_PRGEVEN_0 = 0;
VPFE_PRGEVEN_1 = 0;
VPFE_PRGODD_0 = 0;
VPFE_PRGODD_1 = 0;
VPFE_VP_OUT = 0x04e22D00;
VPFE_PCR = 0x00000001; // Enable CCDC
}

/* ------------------------------------------------------------------------ *
* *
* vpbe_init( ) *
* *
* NTSC: *
* Width: 720 *
* Height: 480 *
* *
* *
* ------------------------------------------------------------------------ */
void vpbe_init( Uint32 buffer, Uint32 width, Uint32 height, Uint32 cb_enable )
{
/*
* Setup VPBE
*/
VPSS_CLK_CTRL = 0x00000018; // Enable DAC and VENC clock, both at 27 MHz
VPBE_PCR = 0; // No clock div, clock enable

/*
* Setup OSD
*/
OSD_MODE = 0x0000007f; // 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 = width >> 4;
OSD_VIDWIN0ADR = buffer;
OSD_BASEPX = BASEP_X;
OSD_BASEPY = BASEP_Y;
OSD_VIDWIN0XP = 0;
OSD_VIDWIN0YP = 0;
OSD_VIDWIN0XL = width;
OSD_VIDWIN0YL = height >> 1;
OSD_MISCCTL = 0;

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

/*
* Setup VENC
*/
VENC_VMOD = 0x00000043; // Standard NTSC interlaced output
VENC_VDPRO = cb_enable << 8;
VENC_DACTST = 0;
VENC_DACSEL = 0x003210;
}


/* ------------------------------------------------------------------------ *
* *
* video_loopback_test( ) *
* *
* *
* *
* ------------------------------------------------------------------------ */
Int16 video_loopback_test( )
{

tvp5146_init( );
vpfe_init( 0x81000000, 720, 576 ); // Setup Front-End
vpbe_init( 0x81000000, 720, 576, 0 ); // Setup Back-End

return 0;
}

 --------------------------------------------------------------------------------------------------------------------------------------------------------------------

any one help me..

  • As far as I know, we don't have a example for your requirement but you can develop your own.
    Else, we have a encoder and decoder examples on DVSDK package (Linux) so you can use and modify that code for your requirement.
  • Hi,

    Thank you. Yes I will try with DVSDK. But I am bit confused about the process of video data storing in DDR and reading it from the memory. Can you breif this process? Should I need to use processors DMA? will SDR_ADDR (SDRAM address register) saves the data? is it an incremental buffer? where and how this data is saved and how it is read in VPBE? the exact process?

    Regards,

    Azhagiri
  • Hi Azhagiri,
    Apologize, I don't have a experience on this.
    I'm not sure that we can keep video data on DDR and able to process since it is very fast (video frames).
    But I hope it is possible in DVSDK since it wont use DDR to store data instead we can use flash to store as a video file (H264 etc.,)
  • Hi
    First we tried to store the data in flash. we accessed compact flash. For 16 bit data access we should get the device id 84 8A. instead of 848A there we read only 84. remaining LSB 8 bits are not read.

    When board boots from NAND flash we are getting some warning, is mentioned below.

    WARNING: both IDE and NOR flash are enabled, but share pins.
    Disable IDE for NOR support.

    We are accessing only CF interface. the PINMUX0 & Programmable Registers also configured for Compact flash card only as per the ATA/CF Application notes SPRUE21.
    The chip select jumper j2 is connected for FLASH. But the CS2 we are not using. How to resolve this problem?

    Please guide us to store the video using compact flash card..

    regards,
    azhagiri

  • When board boots from NAND flash we are getting some warning, is mentioned below.
    WARNING: both IDE and NOR flash are enabled, but share pins.
    Disable IDE for NOR support.

    It is irrevelant, because this log is coming from linux booting.

    This task some what tedious, you have to detect the CF flash and need filesystem support etc.,
    Else you can write data as raw into CF flahs or NAND but not sure how can we read the data back.

    Have you referred the DM6446 EVM schematics to know about how the CF flash connected to processor.
    I think, you need to configure the IC U35 (PCF8574A) to select the CF flash interface.
    You can't use EMIFA interface (NAND and NOR) when you use CF flah.
  • Titus says said:

    I think, you need to configure the IC U35 (PCF8574A) to select the CF flash interface.

    "cf_test.c"

       DAVINCIEVM_MSP430_setOutput( 0, 0x09 );                 // Disable SM

                                                               // Turn on CF power

       DAVINCIEVM_GPIO_EXP_setOutput( GPIO_EXP_GROUP2, 7, 0 ); // Enable CF

       DAVINCIEVM_GPIO_EXP_setOutput( GPIO_EXP_GROUP2, 6, 1 ); // Disable ATA

       /*

        *  Toggle Compact Flash Reset.  From Reset to Ready

        */

       DAVINCIEVM_GPIO_EXP_setOutput( GPIO_EXP_GROUP2, 3, 0 ); // CF Reset

       DAVINCIEVM_waitusec( 10000 );                           // Wait 10 msec

       DAVINCIEVM_GPIO_EXP_setOutput( GPIO_EXP_GROUP2, 3, 1 ); // CF Ready

       DAVINCIEVM_waitusec( 10000 );                           // Wait 10 msec

    This code is enabling the CF flash media.

    We need to set the pin no P7 to select the U35 I/O expander.

  • Hi Azhagiri,

    First we tried to store the data in flash. we accessed compact flash. For 16 bit data access we should get the device id 84 8A. instead of 848A there we read only 84. remaining LSB 8 bits are not read.

    Try to debug the code "ATA_readId" function and check the data through CCS window.
  • Sir,

    Have you referred the DM6446EVM schematics to know about how the CF flash connected to processor?

    Yes, we have referred schematics. it is connected to the processor in PIO Mode.

    ---------------------------------------------------------------------------------------------------------------------------------------------------------------

    you have to detect the CF flash and need filesystem support?

    we are getting the message compact flash card is detected for the program mentioned below.

    /* ------------------------------------------------------------------------ *

    *                                                                          *

    *  cf_card_detect( )                                                       *

    *                                                                          *

    * ------------------------------------------------------------------------ */

    Int16 cf_card_detect( )

    {

       Uint8 port2, port3;

       /*

        *  Check to see if the Compact Flash card is inserted. There are 2

        *  Card Detect pins ( .CD ) located at opposite ends of the CF connector.

        */

       DAVINCIEVM_MSP430_getInput( &port2, &port3 );

       if ( ( port2 & 0x08 ) == 0 )

           printf( "    CF.CD1 Found\n" );

    else

       printf( "    CF.CD1 Not Found\n" );

       if ( ( port2 & 0x10 ) == 0 )

           printf( "    CF.CD2 Found\n" );

       else

           printf( "    CF.CD2 Not Found\n" );

       if ( ( port2 & 0x18 ) != 0 )

    return 1;

       else

           return 0;

    }

    Detection log on CCS Window:

      [ARM9_0]     CF.CD1 Found

       CF.CD2 Found

       CF Identifier:   0x84

       Invalid CF identifier found

       Model number:    [                                        ]

       Serial number:   [AS           0 0"9$5]

       Capacity:        [3962416] KBytes

       Capacity:        [3869] MBytes

    -----------------------------------------------------------------------------------------------------------------------------------------------------------

    Try to debug the code "ATA_readId" function and check the data through CCS window?

    we have tried to read the id through CCS Window we got the same data 84 only.

    ------------------------------------------------------------------------------------------------------------------------------------------------------------

    This code is enabling the CF, need to set the pin no P7 to select the U35 I/O expander?

    After enabling the CF We need to set this P7 in i/o expander?  

    Because presently it is detecting the card.  If we have to set means how to select the P7 in I/O expander.