Page 1 of 1

Adjust HDMI-Test for Video Output

Posted: Thu Aug 24, 2017 3:59 pm
by Boitumelo_Ruf
Hi all,

I am preparing for a demo in which I want to visualize the results at the frame rate at which they are produced. I have adjusted the HDMI Test project as Emilie suggested in viewtopic.php?f=8&t=87.

Unfortunately due to the restart of the VDMA Module the whole screen turn black and delays the output between consecutive frames.

In order to change this I had a look at the Sobel Demo and saw that with "XAxiVdma_StartParking" I can tell the VDMA to read a new frame from a different address. This is what I have implemented so far:

Code: Select all


XAxiVdma Vdma;
XAxiVdma_DmaSetup ReadCfg;

int vdma_start() {
      int Status;

      // MM2S Startup
      Status = XAxiVdma_DmaStart(&Vdma, XAXIVDMA_READ);
      if (Status != XST_SUCCESS)
      {
         xil_printf("Start read transfer failed %d\n\r", Status);
         return XST_FAILURE;
      }

      return XST_SUCCESS;
}


int vdma_stop() {
      XAxiVdma_DmaStop(&Vdma, XAXIVDMA_READ);
      return XST_SUCCESS;
}

XAxiVdma_Config *Config;

   int Status;
   int i;
   
   Config = XAxiVdma_LookupConfig(DeviceID);
   if (NULL == Config) {
      xil_printf("XAxiVdma_LookupConfig failure\r\n");
      return XST_FAILURE;
   }

   Config->MaxFrameStoreNum = 3;
   Config->FlushonFsync = 1;

   Status = XAxiVdma_CfgInitialize(&Vdma, Config, Config->BaseAddress);
   if (Status != XST_SUCCESS) {
      xil_printf("XAxiVdma_CfgInitialize failure\r\n");
      return XST_FAILURE;
   }

   ReadCfg.EnableCircularBuf = 1;

   ReadCfg.EnableFrameCounter = 0;
   ReadCfg.FixedFrameStoreAddr = 0;

   ReadCfg.EnableSync = 1;
   ReadCfg.PointNum = 1;

   ReadCfg.FrameDelay = 0;

   ReadCfg.VertSizeInput = IMG_HEIGHT;
   ReadCfg.HoriSizeInput = IMG_WIDTH << 2;
   ReadCfg.Stride = ReadCfg.HoriSizeInput;

   ReadCfg.FrameStoreStartAddr[0] = IMG_ADDR_1;
   ReadCfg.FrameStoreStartAddr[1] = IMG_ADDR_2;

   Status = XAxiVdma_DmaConfig(&Vdma, XAXIVDMA_READ, &ReadCfg);
   if (Status != XST_SUCCESS) {
         xdbg_printf(XDBG_DEBUG_ERROR,
            "Read channel config failed %d\r\n", Status);

         return XST_FAILURE;
   }

   Status = XAxiVdma_DmaSetBufferAddr(&Vdma, XAXIVDMA_READ, ReadCfg.FrameStoreStartAddr);
   Status = vdma_start();
   if (Status != XST_SUCCESS) {
         xil_printf("error starting VDMA..!");
         return Status;
   }

   while(1)
   {
      int retVal = 0;
      if ((retVal = XAxiVdma_StartParking(&Vdma, 0,XAXIVDMA_READ))) {
         xil_printf("ERROR; parking reading frame failed: %d\r\n", retVal);
      }
      xil_printf("Start Parking Status: %d\r\n", retVal);   
      while (0 != XAxiVdma_CurrFrameStore(&Vdma, XAXIVDMA_READ)){};
   
      // DO PROCESSING AND WRITE RESULT INTO IMG_ADDR_2

      if ((retVal = XAxiVdma_StartParking(&Vdma, 1,XAXIVDMA_READ))) {
         xil_printf("ERROR; parking reading frame failed: %d\r\n", retVal);
      }
      xil_printf("Start Parking Status: %d\r\n", retVal);
      while (1 != XAxiVdma_CurrFrameStore(&Vdma, XAXIVDMA_READ)){};
      
      // DO PROCESSING AND WRITE RESULT INTO IMG_ADDR_1
   }


Furthermore I have increased the FrameBuffer of the VDMA IP to 3 in the Block Diagram and exported the new HW Design.

Even though the code runs through the loop and does the processing and parking successfully, the screen still shows the first image. It doesn't refresh. What am I doing wrong? Is the Test Pattern Generator between the VDMA and the HDMI Out causing the problem?

Thanks for your help.

\Boitumelo

Re: Adjust HDMI-Test for Video Output

Posted: Fri Aug 25, 2017 7:52 pm
by Domenico_Argenziano
Did you configure ALL three frame buffer addresses, and not just the first one, and for BOTH read and write channels?

Re: Adjust HDMI-Test for Video Output

Posted: Mon Aug 28, 2017 8:50 am
by Boitumelo_Ruf
Hi,

you mean to set XAxiVdma_DmaSetBufferAddr? I only set two. Need to check if it helps. Why would I need to also configure write channel, if I only need the read channel?

\Thanks.

Re: Adjust HDMI-Test for Video Output

Posted: Tue Aug 29, 2017 10:51 am
by Domenico_Argenziano
I thought you had some camera input. OK, then you need only to configure the read channel. By the way, if you are using parking mode, you have to manually increase frame pointer, otherwise you will always display the same frame.