Forum Discussion

Altera_Forum's avatar
Altera_Forum
Icon for Honored Contributor rankHonored Contributor
17 years ago

DMA controller loop/circular transfer, how to?

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

6 Replies

  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    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.

  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    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
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    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
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    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