How to read an on-chip fifo using PCIE_DmaRead() - How to read an on-chip fifo using PCIE_DmaRead() I am trying to transfer data between a PC and an FPGA. I am using C++ for the computer program and the FPGA is a Stratix V. On the FPGA, I need to use FIFOs to buffer recieved data and data about to be sent.On the FPGA I am using a PCIE example design from the user CD of the DE5-net kit. I have managed to write to- and read from- an on chip fifo using PCIE_Write32() and PCIE_Read32(). The user Manual states, however, that these functions are not appropriate for continuous, large data transfers and that PCIE_DmaRead()/PCIE_DmaWrite() should be used instead. I tried Writing data to the FIFO using PCIE_DmaWrite() and it worked, as I verified by reading the written values with PCIE_Read32(). My problem is that I cannot get PCIE_DmaRead() to work. Whenever I call it it returns a random(but fixed) value, and does not pop anything from the FIFO(doesn't reduce the fill level). am I doing something wrong or is it only possible to write to, but not read from, FIFOs by using the DMA functions? here are my code and my design: --------------------- #include "stdafx.h" #include <stdio.h> #include <stdlib.h> #include <memory.h> #include "PCIE.h" #define DEMO_PCIE_USER_BAR PCIE_BAR4 #define DEMO_PCIE_IO_LED_ADDR 0x4000010 #define DEMO_PCIE_IO_BUTTON_ADDR 0x4000020 #define DEMO_PCIE_ONCHIP_MEM_ADDR 0x00000000 #define DEMO_PCIE_DDR3A_MEM_ADDR 0x100000000 #define DEMO_PCIE_DDR3B_MEM_ADDR 0x200000000 #define FIFO_WRITE_MEM_ADDR 0x90000 #define FIFO_READ_MEM_ADDR 0x90004 #define ONCHIP_MEM_TEST_SIZE (512*1024) //512KB #define DDR3A_MEM_TEST_SIZE (2*1024*1024*1024) //2GB #define DDR3B_MEM_TEST_SIZE (2*1024*1024*1024) //2GB ... BOOL TEST_DMA_WRITE(PCIE_HANDLE hPCIe) { BOOL bPass; int push[10]; int number; do { printf("Please input number of integers to write:"); scanf("%d", &number); } while (number < 0 || number > 10); for (int i = 0; i < number; i++) { printf("Please input fifo data:"); scanf("%d", push + i); } bPass = PCIE_DmaWrite(hPCIe, FIFO_WRITE_MEM_ADDR, push, number*sizeof(int)); if (bPass) printf("write success, data=%d\r\n", push[0]); else printf("write failed\r\n"); return bPass; } BOOL TEST_DMA_READ(PCIE_HANDLE hPCIe) { //doesn't work !!! BOOL bPass = TRUE; int Status[10]; int number; do { printf("Please input number of integers to read:"); scanf("%d", &number); } while (number < 0 || number > 10); bPass = PCIE_DmaRead(hPCIe, FIFO_READ_MEM_ADDR, Status, number * sizeof(int)); if (bPass) { for (int i = 0; i < number; i++) { printf("data read:=%d\r\n", Status[i]); } } else { printf("Failed to read data\r\n"); } return bPass; } ----------------------------------------------- Replies: Re: How to read an on-chip fifo using PCIE_DmaRead() Hi Sir, Theoretically, DMA function is not work for FIFOs but it is only work for memory that have physical address. FIFO unlike a memory (DDR3) and no address associate with it. Thus, for FIFO, we usually used write/read32. - 2019-07-15

external_document