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: 
Visitor jinn
Visitor
11,106 Views
Registered: ‎05-24-2010

How can I read/write data to SDRAM by MPMC ?

Jump to solution

Hi,

I'm using MPMC for SDRAM (MT47H16M16-37E) . I succeeded to generate Hardware Bitstream. But I don't know how to make application for MPMC.

I want to read/write some binary data by MPMC. Which register should I read/write data ?

 

============

MHS

============

BEGIN mpmc_0

 PARAMETER INSTANCE = mpmc_ddr2

 PARAMETER HW_VER = 2.01.a

 PARAMETER C_MEM_PARTNO = MT47H16M16-37E

 PARAMETER C_MPMC_CLK0_PERIOD_PS = 5714

 PARAMETER C_MPMC_BASEADDR = 0x00000000

 PARAMETER C_MPMC_HIGHADDR = 0x03FFFFFF

 PARAMETER C_MEM_DATA_WIDTH = 32

 PARAMETER C_DDR2_DQSN_ENABLE = 1

 PARAMETER C_MEM_CLK_WIDTH = 2

 BUS_INTERFACE SPLB0 = plb_memory

 PORT MPMC_Clk90 = DDR_SDRAM_64Mx32_mpmc_clk_90_s

 PORT MPMC_Clk0 = DDR_SDRAM_64Mx32_mpmc_clk_0_s

 PORT MPMC_Clk_200MHz = clk_200mhz_s

 PORT DDR2_DQS_n = DDR_DQSn

 PORT DDR2_DQS = DDR_DQS

 PORT DDR2_DM = DDR_DM

 PORT DDR2_DQ = DDR_DQ

 PORT DDR2_Addr = DDR_Addr

 PORT DDR2_BankAddr = DDR_BankAddr

 PORT DDR2_WE_n = DDR_WEn

 PORT DDR2_CAS_n = DDR_CASn

 PORT DDR2_RAS_n = DDR_RASn

 PORT DDR2_ODT = DDR_ODT

 PORT DDR2_CS_n = DDR_CSn

 PORT DDR2_CE = DDR_CKE

 PORT DDR2_Addr_2 = DDR_Addr_2

 PORT DDR2_BankAddr_2 = DDR_BankAddr_2

 PORT DDR2_WE_n_2 = DDR_WEn_2

 PORT DDR2_CAS_n_2 = DDR_CASn_2

 PORT DDR2_RAS_n_2 = DDR_RASn_2

 PORT DDR2_ODT_2 = DDR_ODT_2

 PORT DDR2_CS_n_2 = DDR_CSn_2

 PORT DDR2_CE_2 = DDR_CKE_2

 PORT DDR2_Clk_n = DDR_CLK_OUTn

 PORT DDR2_Clk = DDR_CLK_OUT

 PORT MPMC_Rst = sys_bus_reset

END

==============================

 

Thanks.

Tags (2)
0 Kudos
1 Solution

Accepted Solutions
14,236 Views
Registered: ‎07-06-2008

Re: How can I read/write data to SDRAM by MPMC ?

Jump to solution

You don't have to write to any specific registers for MPMC. Have you read its datasheet?

 

You can use something like this:

 

#include "xparameters.h"

 

#include "stdio.h"

 

#include "xutil.h"

 

#include "xio.h"

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

 

int main (void) 

 

{

   u32 *Stuff = (u32 *) XPAR_DDR_SDRAM_MPMC_BASEADDR;

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

   Stuff[10] = 0xFF24805A;

   u32 data;

   data=Stuff[10];

   xil_printf("This is the data %x ",data);

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

   return 0;

0 Kudos
10 Replies
11,096 Views
Registered: ‎07-06-2008

Re: How can I read/write data to SDRAM by MPMC ?

Jump to solution

Its not clear from your post if you understand what MPMC is and how it is supposed to work. How is it connected to other components (processors, user IPs) of your design?

0 Kudos
Highlighted
Visitor jinn
Visitor
11,088 Views
Registered: ‎05-24-2010

Re: How can I read/write data to SDRAM by MPMC ?

Jump to solution

Thank you for your comment.

I write down IP core I used. And attache MHS files.

 

------------------------------------

spi_cntlr
ocm_temac_cntlr
ppc405_system
jtagppc
intc_system
bram
gpio_system
gpio_led
uart_console
plb_peripheral

reset_system
dcm_ddr_fx
dcm_ddr_clk
util_bus_split
mpmc_ddr2
plb_memory
bram_cntlr
dcr

 

-------------------

 

Thanks.

Tags (2)
0 Kudos
11,066 Views
Registered: ‎07-06-2008

Re: How can I read/write data to SDRAM by MPMC ?

Jump to solution

Your version of MPMC is different from the one I used, so I cannot say if you have made the connections to PowerPC over PLB correctly (they are written in an un-familiar way to me in the MHS). Assuming that you have made these connections correctly, you should be able to read and write to different addresses of the DDR memory device by writing to and reading from specific memory locations in your software application. You will need to use pointers if you use C for programming. Thats the only way I know.

0 Kudos
Visitor jinn
Visitor
11,059 Views
Registered: ‎05-24-2010

Re: How can I read/write data to SDRAM by MPMC ?

Jump to solution

Thank you for your advice.

 

I can understand your saying "You will need to use pointers if you use C for programming",

because I have used GPIO.

 

But I don't know which register I should read & write.

I  have read MPMC datasheets for 3 weeks. But I can't find and understand MPMC's register, enough.

 

Would you show me which MPMC's register you read and write ?

If you show me some data, it's my help though our MPMC's versions are different.

 

Thanks.

 

0 Kudos
11,041 Views
Registered: ‎05-26-2010

Re: How can I read/write data to SDRAM by MPMC ?

Jump to solution

Hi! I join the Jinn questions, I have the same problem.

0 Kudos
Visitor jinn
Visitor
11,038 Views
Registered: ‎05-24-2010

Re: How can I read/write data to SDRAM by MPMC ?

Jump to solution

Hi gryftechnologia !

 

MPMC is very difficult IP core, isn't it ? I can use GPIO and UART by myself. But I can' understand how to use MPMC. And I can't get some clue, though searching at Google or this community. Please tell me answer or some clues if you get.

 

Thanks

Tags (1)
0 Kudos
14,237 Views
Registered: ‎07-06-2008

Re: How can I read/write data to SDRAM by MPMC ?

Jump to solution

You don't have to write to any specific registers for MPMC. Have you read its datasheet?

 

You can use something like this:

 

#include "xparameters.h"

 

#include "stdio.h"

 

#include "xutil.h"

 

#include "xio.h"

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

 

int main (void) 

 

{

   u32 *Stuff = (u32 *) XPAR_DDR_SDRAM_MPMC_BASEADDR;

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

   Stuff[10] = 0xFF24805A;

   u32 data;

   data=Stuff[10];

   xil_printf("This is the data %x ",data);

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

   return 0;

0 Kudos
Visitor jinn
Visitor
11,006 Views
Registered: ‎05-24-2010

Re: How can I read/write data to SDRAM by MPMC ?

Jump to solution

Dear ninjamafiakhan3,

 

thank you for your kindness. I understand and succeed to write & read SDRAM.

 

Of cause, I read datasheets. But MPMC is a lot of paramater and some PIM. So I confused...

Now, I can understand how to use MPMC by your message.

 

Thank you!

Tags (1)
0 Kudos
10,991 Views
Registered: ‎05-26-2010

Re: How can I read/write data to SDRAM by MPMC ?

Jump to solution

 

Hi ninjamafiakhan3, whether your function writes and reads data from the physical SDRAM? I found also has other functions to save and then read the data from memory and it looks like this:

int test (void)


{
 u32 *Stuff = (u32 *) XPAR_MPMC_0_MPMC_BASEADDR;
u32 i;
i=0x00000000;
 u32 data;
do {
   
   print("-- Entering main() --\r\n");
        
   Stuff = i;
    
   data= *Stuff;

   xil_printf("This is the data= %x ",data);

   print("-- Exiting main() --\r\n");
i=i+1;
}
while (i<0x01000000);

   return 0;

}

 

And to me, this function returns all zeroes, because I have incorrectly configured mpmc. Your function returns the 0xFF24805A me, although I know that I MPMC controller incorrectly configured.
And by the way if anyone knows how to properly configure the MPMC to operate the SDR SDRAM (EM63A165t)?

 

0 Kudos
2,631 Views
Registered: ‎05-26-2010

Re: How can I read/write data to SDRAM by MPMC ?

Jump to solution

sory, not the code be pasted was this:

int tst(void)
{
    void * base = (void *) XPAR_MPMC_0_MPMC_BASEADDR;
    volatile int * p32 = base;
    volatile char * p8 = base;
     volatile int * p16 = base;
    
    p32[0] = 0x87654321;
    print ( "val=" );
    putnum ( *p32 );
     xil_printf( "\r\n data= %d \r\n",*p32);
    print ( "\r\n" );
    
      p16[0] = 0xffff;
    print ( "val=" );
    putnum ( *p32 );
    print ( "\r\n" );
    
   
    
    p32[0] = 0x60685400;
    print ( "val=" );
    putnum ( *p32 );
    print ( "\r\n" );
    
}

0 Kudos