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: 
Participant ansarkp
Participant
5,244 Views
Registered: ‎03-31-2009

How to write into DDR2 memory in ML506 board

Jump to solution

I have an ML506 board. i want to use DDR2 memory to write and read from it. I created an EDK project with DDR2 and UART as peripherals. to write and read from the DDR2 memory i

 

used the functions " XMpmc_SetStaticPhyReg" and "XMpmc_GetStaticPhyReg" respectively as given in the API documentation for the DDR2 peripheral. the compiler is not showing

 

any error but when the bitfile is loaded the execution stops at the write function( XMpmc_SetStaticPhyReg) as seen from the hyper terminal.

 

 

Please help if any one knows where the problem is. the reddish part of the code is what i added in addition to generated code.

/*
*
* Xilinx, Inc.
* XILINX IS PROVIDING THIS DESIGN, CODE, OR INFORMATION "AS IS" AS A
* COURTESY TO YOU. BY PROVIDING THIS DESIGN, CODE, OR INFORMATION AS
* ONE POSSIBLE IMPLEMENTATION OF THIS FEATURE, APPLICATION OR
* STANDARD, XILINX IS MAKING NO REPRESENTATION THAT THIS IMPLEMENTATION
* IS FREE FROM ANY CLAIMS OF INFRINGEMENT, AND YOU ARE RESPONSIBLE
* FOR OBTAINING ANY RIGHTS YOU MAY REQUIRE FOR YOUR IMPLEMENTATION
* XILINX EXPRESSLY DISCLAIMS ANY WARRANTY WHATSOEVER WITH RESPECT TO
* THE ADEQUACY OF THE IMPLEMENTATION, INCLUDING BUT NOT LIMITED TO
* ANY WARRANTIES OR REPRESENTATIONS THAT THIS IMPLEMENTATION IS FREE
* FROM CLAIMS OF INFRINGEMENT, IMPLIED WARRANTIES OF MERCHANTABILITY
* AND FITNESS FOR A PARTICULAR PURPOSE.
*/

/*
* Xilinx EDK 10.1.03 EDK_K_SP3.6
*
* This file is a sample test application
*
* This application is intended to test and/or illustrate some
* functionality of your system. The contents of this file may
* vary depending on the IP in your system and may use existing
* IP driver functions. These drivers will be generated in your
* XPS project when you run the "Generate Libraries" menu item
* in XPS.
*
* Your XPS project directory is at:
* E:\EDK_projects\DDR2\
*/


// Located in: microblaze_0/include/xparameters.h
#include "xparameters.h"

#include "stdio.h"

#include "xutil.h"
#include "xmpmc.h"


//====================================================

int main (void) {


/*
* Enable and initialize cache
*/
#if XPAR_MICROBLAZE_0_USE_ICACHE
microblaze_init_icache_range(0, XPAR_MICROBLAZE_0_CACHE_BYTE_SIZE);
microblaze_enable_icache();
#endif

#if XPAR_MICROBLAZE_0_USE_DCACHE
microblaze_init_dcache_range(0, XPAR_MICROBLAZE_0_DCACHE_BYTE_SIZE);
microblaze_enable_dcache();
#endif

print("-- Entering main() --\r\n");

/* Testing MPMC Memory (DDR2_SDRAM)*/
{
XStatus status;

print("Starting MemoryTest for DDR2_SDRAM:\r\n");
print(" Running 32-bit test...");
status = XUtil_MemoryTest32((Xuint32*)XPAR_DDR2_SDRAM_MPMC_BASEADDR, 1024, 0xAAAA5555, XUT_ALLMEMTESTS);
if (status == XST_SUCCESS) {
print("PASSED!\r\n");
}
else {
print("FAILED!\r\n");
}
print(" Running 16-bit test...");
status = XUtil_MemoryTest16((Xuint16*)XPAR_DDR2_SDRAM_MPMC_BASEADDR, 2048, 0xAA55, XUT_ALLMEMTESTS);
if (status == XST_SUCCESS) {
print("PASSED!\r\n");
}
else {
print("FAILED!\r\n");
}
print(" Running 8-bit test...");
status = XUtil_MemoryTest8((Xuint8*)XPAR_DDR2_SDRAM_MPMC_BASEADDR, 4096, 0xA5, XUT_ALLMEMTESTS);
if (status == XST_SUCCESS) {
print("PASSED!\r\n");
}
else {
print("FAILED!\r\n");
}
}

{
Xuint32 registery;
Xuint32 write_value =0,read=0,read_value[10];

while(write_value<10)
{
xil_printf("%10d\n",write_value);
XMpmc_SetStaticPhyReg(registery,write_value);
read_value[write_value] = XMpmc_GetStaticPhyReg(registery);
xil_printf("registery[%0d] at address %0X contains value: %0d \r\n",write_value,&read_value[write_value],read_value[write_value]);
write_value++;
}

}




/**
* MpmcSelfTestExample() will not be run for the memory
* (DDR2_SDRAM) because ECC is not supported.
*/


/*
* MemoryTest routine will not be run for the memory at
* 0x00000000 (dlmb_cntlr)
* because it is being used to hold a part of this application program
*/

/*
* Disable cache and reinitialize it so that other
* applications can be run with no problems
*/
#if XPAR_MICROBLAZE_0_USE_DCACHE
microblaze_disable_dcache();
microblaze_init_dcache_range(0, XPAR_MICROBLAZE_0_DCACHE_BYTE_SIZE);
#endif

#if XPAR_MICROBLAZE_0_USE_ICACHE
microblaze_disable_icache();
microblaze_init_icache_range(0, XPAR_MICROBLAZE_0_CACHE_BYTE_SIZE);
#endif


print("-- Exiting main() --\r\n");
return 0;
}

 

thanks in advance,

srikanth.

 

 

 

0 Kudos
1 Solution

Accepted Solutions
Xilinx Employee
Xilinx Employee
6,500 Views
Registered: ‎08-07-2007

Re: How to write into DDR2 memory in ML506 board

Jump to solution

Hi Srikanth,

 

The function you are referring to is used to access the MPMC Static PHY registers, not for reading/writting the memory device. 

 

To read/write  the memory, you can simply use XIo_In32/XIo_Out32 fucntions, or use a C pointer.

 

-XF

3 Replies
Xilinx Employee
Xilinx Employee
6,501 Views
Registered: ‎08-07-2007

Re: How to write into DDR2 memory in ML506 board

Jump to solution

Hi Srikanth,

 

The function you are referring to is used to access the MPMC Static PHY registers, not for reading/writting the memory device. 

 

To read/write  the memory, you can simply use XIo_In32/XIo_Out32 fucntions, or use a C pointer.

 

-XF

Highlighted
Participant ansarkp
Participant
5,208 Views
Registered: ‎03-31-2009

Re: How to write into DDR2 memory in ML506 board

Jump to solution

I used the functions XIo_In32/XIo_Out32 for reading and writing the data from and into the registers. But  iam not sure that i am creating registers inside the DDR2 or not. when i tried to read the address of the register it is showing only 16bit value though i declared it as Xuint32.

 

I thought that 16bit value is the base address of the register(0x3f48) and added it to the base address(0x90000000) then it is displaying the sum of the base address and offset(i assumed) as 0x40003f48. this makes me feel like the actual address of that register as B0003f48.

 

do Know where is the problem.

 

Thanks

Srikanth

 

 

0 Kudos
Explorer
Explorer
3,505 Views
Registered: ‎08-13-2010

Re: How to write into DDR2 memory in ML506 board

Jump to solution
I think u used 16 bit width register.
Tags (1)
0 Kudos