Programmable Devices
CPLDs, FPGAs, SoC FPGAs, Configuration, and Transceivers
20707 Discussions

DMA controller loop/circular transfer, how to?

Altera_Forum
Honored Contributor II
2,051 Views

Hello all, 

 

I would like to use a DMA controller to fill a SDRAM memory in a "circular" way (as a circular buffer).  

 

I currently use the DMA controller (provided by Altera) to fill the memory from a constant address (my custom peripheral). I start the DMA transfer from software and the DMA stops when the length reaches 0. It works fine. 

 

But my new requirement is: 

when the transfer length reaches 0 I need the DMA controller reloads the start address and begin a new transfer (as a loop or rollover). 

 

I read in the Altera datasheet that if the bit "LEEN" is set the DMA controller stops the transfer when the length reaches 0 but what's happen if LEEN = 0? Is the controller begin a new transfer from the start address? 

 

Any help would be very appreciated. 

 

Regards, 

 

-Pierre
0 Kudos
6 Replies
Altera_Forum
Honored Contributor II
430 Views

try SGDMA,it is more flexible,you can arrange bundles of DMA transfer very easy!search SGDMA in altera website,you can find example code.

0 Kudos
Altera_Forum
Honored Contributor II
430 Views

Hi Sunnywang, 

 

Thank you for your answer, I will have a look on the SGDMA. Actually I already use SGDMA with the TSE (triple speed ethernet) MAC IP from Altera but I didn't deep into details on this DMA. 

 

Anyway, I solved my problem by programming my own simple "rollover" or "circular buffer" DMA and it works fine. 

 

Thanks again 

 

Regards, 

-Pierre
0 Kudos
Altera_Forum
Honored Contributor II
430 Views

pierre, how did you get the dma controller running? i'm trying to write a linux driver and must have some wrong settings. 

 

(i get an interrupt, which looks very nice; but my data is not copied (memory to memory)) 

 

have you got any examples of code...? 

 

thx
0 Kudos
Altera_Forum
Honored Contributor II
430 Views

Did you use NIOS or pure Verilog??????

0 Kudos
Altera_Forum
Honored Contributor II
430 Views

Hi, 

 

I really want to set my DMA to work in loop/circular also. How did you do it? I used to write an infinite loop to loop the receive request (from stream to memory) but I need CPU to initialize the request.  

 

How about your method? Do you need any interaction from the CPU? 

 

Thanks very much, 

 

Pat
0 Kudos
Altera_Forum
Honored Contributor II
430 Views

woo~~How deep you are....I am a Novice....

0 Kudos
Reply