Intel® FPGA University Program
University Program Material, Education Boards, and Laboratory Exercises
1174 Discussions

Help using SDRAM with SDR_SDRAM controller

Altera_Forum
Honored Contributor II
1,106 Views

Hello, 

I use DE2 SDRAM with SDR_SDRAM ALTERA controller(vhdl files). 

I try to write 640*480 *16 bits data to SDRAM. 

Wich commands have I to write to controller and in wich order? 

Thank you.
0 Kudos
4 Replies
Altera_Forum
Honored Contributor II
408 Views

you can try to make a pointer that points to the start address you want to write to (somewhere in the address span of the SDRAM). 

 

Then issue memcpy with source and destination pointers. See documentation of memcpy. 

 

Or, you can do a loop manually : 

 

short* psrc = xxxx //location of the source data 

short* pdst= yyyy //some address in the SDRAM address space you need to write to 

 

for (int k=0; k < 640*480; k++) 

*pdst++ = *pscr++ 

 

If you don't understand this, please try to get some experience on C/C++ first. 

 

 

Stefaan
0 Kudos
Altera_Forum
Honored Contributor II
408 Views

It's unclear, if you want to access the SDRAM from NIOS II C code or VHDL.

0 Kudos
Altera_Forum
Honored Contributor II
408 Views

Indeed Frank, I made the (maybe wrong) assumption that rprag used the NIOS processor to transfer the data.  

 

Stefaan
0 Kudos
Altera_Forum
Honored Contributor II
408 Views

Hello,thank you for replying. 

I make a project ,using vhdl code.I found an ALTERA code for SDR SDRAM controller, and I try to write into DE2 SDRAM, data from camera of 640*480 resolution, each pixel is 16 bits. 

My question is in vich order and vich commands to use , in order to write data to SDRAM.I don't know, if I should give the adresses,or they promote automaticly. 

I'l apreciate if YOU could send me an example of the orders for writung this data length and/or some explanation. 

Thank YOU, 

Roman.
0 Kudos
Reply