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: 
Explorer
Explorer
343 Views
Registered: ‎03-29-2017

ZCU102 Board:Read from PL and write into PS through BRAM

I have tried with example design, how to read the data from PL and write into PS, but i am not able to read the data sequence to maximum. I am not sure whether the XSDK code which i wrote is right or wrong. Please guide me how to initiate the BRAM.

I wrote C code for Number series in XSDK, and trying to read those data in PS through BRAM. 

BRAM1.png

BRAMdesign.png

XSDK code

int main()
{
    init_platform();

    static unsigned int seed =81924592;
    int result=2;
    uint32_t* ptrA = (uint32_t*) 0xA0000000;
    uint32_t* ptrB = (uint32_t*) 0xA0001000;
    xil_printf("START\n");
    while (1)
    {
    if (result<seed)
    result *= 2;
    ptrB[result]=result;
    xil_printf("%d %d %d  ", result, ptrA[result], ptrB[result] );
    sleep(1);
    }
    cleanup_platform();
    return 0;
}
0 Kudos
1 Reply
Explorer
Explorer
285 Views
Registered: ‎03-29-2017

Re: ZCU102 Board:Read from PL and write into PS through BRAM

I am not proper result in XSDK

Updated code

#include <stdio.h>
#include "platform.h"
#include "xil_printf.h"
#include "xparameters.h"
#include "xbram.h"
#include <xil_io.h>

void Numberseries(unsigned int *reg)
{
	static unsigned int seed =819242;
    int k;
    int result=2;
	//if(*reg<seed)
		//*reg+=1;
	for(k=0; k < 10;k++)
	if (result<seed)
	{
	result *= 2;
	reg[k]=result;
	}
}
int main()
{
    init_platform();
    int i=0;
    unsigned int count;
    static unsigned int reg=0;
    uint32_t response;

    xil_printf("Writing from BRAM ... ");
    for (i = 0; i < 10 ; i++)
    {
     Numberseries(&reg);
    Xil_Out32(XPAR_AXI_BRAM_CTRL_0_S_AXI_BASEADDR + i*4, (reg+i));
    }

    xil_printf("Reading from BRAM ... ");
    for (i = 0; i < 10 ; i++)
    {
   xil_printf("The value at address %x is %x\n\r ",XPAR_AXI_BRAM_CTRL_1_S_AXI_BASEADDR + i*4, Xil_In32(XPAR_AXI_BRAM_CTRL_1_S_AXI_BASEADDR + i*4));
    //response = Xil_In32(XPAR_AXI_BRAM_CTRL_0_S_AXI_BASEADDR+i*4);
    //xil_printf("value:%d\n\r", response);
    }
        cleanup_platform();
        return 0;
}

BRAMxSDK.png

Actual result should be like that 4,8,16,32...

0 Kudos