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!

AR# 51948

14.2 EDK/Zynq - Add CIP pcore on PL and use the software driver codes provided out-of-box, it does not work when setting Source buffer and Destination buffer to ddr

Description

I create a custom IP for Zynq and add it on PL. I use the CIP generated driver software codes to run the test. When setting the source buffer and destination buffer in ddr, it does not work. Why?

Solution

This is because the cache is enabled by default in standalone BSP.

There are a few ways to achieve the desired outcome.

1) Disable the cache in main.c code; and it should work fine.

#include "xil_cache.h"
Xil_DCacheDisable();

2) In the selftest example, flush the cache after writing to the DDR and before continuing to the next step.

for ( Index = 0; Index < CIP_AXI4_MASTER_SELFTEST_BUFSIZE; Index++ )
{
SrcBuffer[Index] = Index;
DstBuffer[Index] = 0;
}

xil_printf(" ******* flushing data cache!!! \n\r");
Xil_DCacheFlushRange((unsigned int)SrcBuffer, CIP_AXI4_MASTER_SELFTEST_BUFSIZE);
Xil_DCacheFlushRange((unsigned int)DstBuffer, CIP_AXI4_MASTER_SELFTEST_BUFSIZE);

xil_printf(" - start user logic master module to receive word from the source\n\r");

3) "Only" flush the src buffer, then start the cip and finally invalidate the destination buffer just before doing the compare to force reading from the main DDR (rather than the cache).

for ( Index = 0; Index < CIP_AXI4_MASTER_SELFTEST_BUFSIZE; Index++ )
{
SrcBuffer[Index] = Index;
DstBuffer[Index] = 0;
}

xil_printf(" ******* flushing data cache for source only!!! \n\r");
Xil_DCacheFlushRange((unsigned int)SrcBuffer, CIP_AXI4_MASTER_SELFTEST_BUFSIZE);
xil_printf(" - start user logic master module to receive word from the source\n\r");
/**** more code from selftest ****/

xil_printf(" ******* invalidate destination data cache to force correct read!!! \n\r");
Xil_DCacheInvalidateRange((unsigned int)DstBuffer, CIP_AXI4_MASTER_SELFTEST_BUFSIZE);
/*** do the memory compare as in the original code ***/

AR# 51948
Date Created 11/20/2012
Last Updated 11/20/2012
Status Active
Type General Article
Devices
  • Zynq-7000
Tools
  • EDK - 14.2
  • EDK - 14