Forum Discussion

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

DMA and PCIe

Hi,

I have SOPC system with PCIe, DDR2 and DMA. BAR0 is connected to CRA of PCIe at base 0x1000_0000. BAR1 is connected to DMA control port slave at offset 0x100. DMA's read-master is linked to DDR2 at base 0x2000_0000. The write-master is connected to PCIe's Tx_Interface slave at base 0x0.

The idea is to move on-board DDR2 (256MB) data to host (Win32) via PCIe.

I prep DMA's registers for read/write addresses(0x104, 0x108), length (0x10c) and control (0x118) - per Altera's DMA manual. However, the readaddress and lenght registers of DMA core always read back 0.

Has anyone seen this kind of issue? Any pointers would be very helpful. thanks.

6 Replies

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

    In the SOPC system ,I don not know whether the DMA counld be contolled by PCIe 。 in pci user guid ,there is a exsample as your design ,but they are pci,

    onchipmen and dma .
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    Hi,

    Thanks for the reply. I finally got it to work when I changed my offsets to

    64-bits instead of regular 32-bit. So I incremented the control reg offsets by 8, instead of 4. I have a heterogeneous system, with 64-bit data width for DDR2 and 32-bit for the PCIe. Altera's DMA manual talks about different data widths, although it doesn't directly mention how it (different data widths) affects the control registers' offsets.

    I can now prime the read/write addresses, length and initiate a transfer. I can see the DDR2 being read (SignalTap-II) and the status returned as 0x11 - meaning 'done' and 'length is zero'.

    However, my now PCIe destination doesn't seem to be getting the data. I think my avalon-to-PCIe address translation may be incorrect.

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

    Hi SWguy,

    Even i am trying the same, to move data from host to ddr. Can you post your code. Did you implement using DMA APIs or by accessing registers?

    Thanks,

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

    Hi,

    We're not using Nios for DMA at the moment, so no DMA API (if that's what you're asking) and DMA registers are directly accessed by the host. The host talks to PCIe BARs (and thru BARs to DMA) by invoking a custom driver for RTX - a real-time extension of windows.

    The writeaddress for DMA in SOPC must be actual physical addr on the RTX driver (not virtual addr) and must be contiguous. Usually there are APIs at driver-level to do this and you may not have to do it yourself. Depending on the non-paged pool size of your windows host, you may not be able to get 1:1 mapping of the entire DDR2 on you PCIe endpoint (on SOPC) and the host's memory. So multiple DMA xfers may be necessary between DDR2 and host.

    Look for "Avalon-MM-to-PCI Express Address Translation" in PCI Express Compiler User Guide to understand how xlation process works.

    Hope this helps,

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

    Thanks for the explaination.

    But i need to use NIOS in my design. I was able to do the data transfer between host and ddr (like small data - 2k, 4k) but without using DMA.

    Now I am trying to use DMA to transfer data between host and ddr. I am stuck here from a while. Can you help me?
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    Hi,

    Since we're not using Nios API (for DMA) in our design, there is little I can help you with in that area. Check Nios forum or wiki.

    best,

    -swguy