UPGRADE YOUR BROWSER

We have detected your current browser version is not the latest one. Xilinx.com uses the latest web technologies to bring you the best online experience possible. Please upgrade to a Xilinx.com supported browser:Chrome, Firefox, Internet Explorer 11, Safari. Thank you!

cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Visitor eshea
Visitor
661 Views
Registered: ‎10-19-2017

Initializing TPG

Hello,

I am a beginner and I am trying to initialize the Test Pattern Generator but have not been able to successfully do so. My code keeps hanging when I call the function XV_tpg_IsReady(XV_tpg *InstancePtr) and I'm not sure why. Here is my code:

 

/***************************** Include Files *********************************/
#include "xparameters.h"
#include "xdebug.h"
#include <stdio.h>
#include "platform.h"
#include "xil_printf.h"
#include "xv_tpg.h"


/******************** Constant Definitions **********************************/

#ifndef TESTAPP_GEN
#define TPG_DEVICE_ID     XPAR_V_TPG_0_DEVICE_ID
#endif

 

/************************** Function Prototypes ******************************/

int tpg_selftest(u16 DeviceId_tpg);
void tpg_init(void);

 

/************************** Variable Definitions *****************************/

XV_tpg tpg;

 

#ifndef TESTAPP_GEN
int main()
{

       int Status_tpg;

       init_platform();

 

       /* Configure TPG */
      Status_tpg = tpg_selftest(TPG_DEVICE_ID);
      if (Status_tpg != XST_SUCCESS)
      {
              xil_printf("TPG config failed: Failed\r\n");
              return XST_FAILURE;
      }

      xil_printf("TPG initialized\r\n");

 

      tpg_init();

      xil_printf("--- Exiting main() --- \r\n");

      return XST_SUCCESS;

 

      cleanup_platform();
      return 0;
}
#endif

 

int tpg_selftest(u16 DeviceId_tpg)
{
      XV_tpg_Config *Config;
      int Status = XST_SUCCESS;
      Config = XV_tpg_LookupConfig(DeviceId_tpg);

      if (!Config)
      {
              return XST_FAILURE;
      }

 

      /* Initialize TPG */
     Status = XV_tpg_CfgInitialize(&tpg, Config, Config->BaseAddress);
     if (Status != XST_SUCCESS)

     {
              return XST_FAILURE;
     }
     return Status;
}


void tpg_init(void)
{
     int status_tpg_init = XST_SUCCESS;
     uint32_t height;
     uint32_t width;
     
     status_tpg_init = XV_tpg_IsReady(&tpg);
     xil_printf("Status %u\r\n",(unsigned int)status_tpg_init);
     status_tpg_init = XV_tpg_IsIdle(&tpg);
     xil_printf("Status %u\r\n",(unsigned int)status_tpg_init);
     XV_tpg_Set_height(&tpg, (u32)600);
     XV_tpg_Set_width(&tpg, (u32)800);
     height = XV_tpg_Get_height(&tpg);
     xil_printf("Height = %u\r\n",height);
     width = XV_tpg_Get_width(&tpg);
     xil_printf("Height = %u\r\n",width);
}

0 Kudos
1 Reply
Moderator
Moderator
611 Views
Registered: ‎11-09-2015

Re: Initializing TPG

Hi @eshea,

 

Could you share a screenshot of your BD?

 

Also you might need to start the TPG by writing to register AP CTRL (reg 0x0)

XV_tpg_WriteReg(tpg.Config.BaseAddress, XV_TPG_CTRL_ADDR_AP_CTRL, 0x81);

 

Or you might want to use the example design as a reference to start.

 

Hope that helps,

 

Regards,

 

Florent


Florent
Product Application Engineer - Xilinx Technical Support EMEA
**~ Don't forget to reply, give kudos, and accept as solution.~**
0 Kudos