title: Zynq7 / Zedboard: Xil_in32 alters data when reading from DRAM
body: <p>I have a Zedboard with the following setup in the PL (FPGA):</p>
  
  <p>Custom AXI (full) master -> Interconnect -> Zynq_PS (HP0 slave port)</p>
  
  <ul>
  <li>The custom AXI master produces data (simple counter, written to DRAM, starting at 0x00000000).</li>
  <li>The data are written to DRAM (according to XMD console -> mrd 0x00000000 10)</li>
  <li>When the PS wants to read the data (main.c -> calls "Xil_in32(0x00000000)") the <strong>data is altered</strong> !!!</li>
  </ul>
  
  <p>Question:
  Is calling the function Xil_in32 (for reading data from DRAM) altering the data itself in certain situations ? (when and why ?)</p>
  
  <p>The data are not altered unless Xil_in32 is called. This is proved by reading data from XMD console before calling Xil_in32 from main.c</p>
  
  <p>C-code:</p>
  
  <pre><code>#include &lt;stdio.h&gt;
  #include "platform.h"
  #include &lt;unistd.h&gt;
  
  #include "xparameters.h"
  #include "xil_io.h"
  #include "xstatus.h"
  #include "xscugic.h"
  #include "xil_exception.h"
  
  #include "ps7_init.h"
  
  #define PARAM_BASE_ADDRESS               0x00000000
  
  int main()
  {
      // initialization
      init_platform();
      //ps7_init();
      ps7_post_config();
  
      // variables
      u32 offset;
      u32 param;
      int i = 0;
      xil_printf(" PL WRITING &amp; PS READING DRAM MEMORY TEST ");
  
      // loop
      while ( 1 ) {
  
          getchar();
  
          offset = 0X00000000;
          for (i = 0; i &lt; 50 ; i++){
              offset = offset + 4;
              param = Xil_In32(PARAM_BASE_ADDRESS + offset);
              xil_printf("mem_read %d : %x \n\r",i , param);
          }
      }
  
      cleanup_platform();
      return 0;
  }
  </code></pre>
  
  <p>XMD reading data:
  This shows where I have stopped reading the memory, the counter then continues:</p>
  
  <pre><code>  C8:   7252E9D5
    CC:   D7387D6F
    D0:   1E998873
    D4:   5DD8305F
    D8:   C4FEC147
    DC:   347EBE2F &lt;------ last memory read by Xil_in32
    E0:   0000003F &lt;------ counter
    E4:   00000040 
    E8:   00000041
    EC:   00000042
    F0:   00000043
    F4:   00000044
    F8:   00000045
    FC:   00000046
   100:   00000047
   104:   00000048
   108:   00000049
   10C:   0000004A
  </code></pre>