Forum Discussion

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

Nios DMA (Not NiosII)

Hi, I have a DMA question.

I designed an user_logic. There are two registers in it.

The fisrt register is used to store the two 14-bit operands for calculation later.

The second register is used to control the circuit after the fisrt register.

That means when the second register is set to 1, the two operands in the first register can be read by the circuit after it.

And the source address of the user_logic is 0x500, that means the address of the fisrt register is 0x500.

And the address of the second register is 0x504, the two register are all 32-bit.

I want to send two continuous data to the two register separately.

Therefore, I use the nr_dma_copy_range_to_range to send the data between memory and my user_logic. But it does not work.

So, does anybody have a SIMPLE DMA example for Nios processor??

Or somebody can tell me how to use the DMA ?? http://forum.niosforum.com/work2/style_emoticons/<#EMO_DIR#>/sad.gif

Thanks in advance.

PS: I use the Nios3.1, QuartusII 4.0, and APEX20K.

3 Replies

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

    pipiwau,

    I am a bit confused by your approach to this problem. The way you describe your peripheral dseign and register map sounds fine, but in this arrangement it sounds like the circuit operates as follows:

    - operands loaded (first reg)

    - peripheral start (second reg)

    - operatnds loaded (first reg)

    - peripheral start (second reg)

    Is this how it works?? The DMA is really designed to move a block of data, one word at a time, from place to place in memory. If you need to start the peripheral with the control register after each set of operands is loaded, the DMA is probably not the way to control this.

    On the other hand, if you need to only enable the peripheral once:

    - operands loaded (first reg)

    - peripheral started (second reg)

    - operands loaded

    - operands loaded

    ...

    ...

    ...

    Then in that case the DMA can be used, but you should use either the range_to_1 or 1_to_1 routines. The range_to_range routine will increment the address the DMA writes to after each transfer, and will thus run past your peripheral registers after the first operation.

    Hope this helps.