cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Highlighted
Visitor
Visitor
649 Views
Registered: ‎08-09-2017

AXI4 stream data FIFO: correct usage of datacount

Hello everyone, I am using a AXI4 Stream Data FIFO on a Zynq7000 (7z020) to store data incoming on a stream from a custom module before reading it with an AXI DMA.

I wanted to use the datacount port (see figure) polled using a GPIO all-input to know how many elements are occupying the FIFO. However, the value seems to be inconsistent and always near the maximum size of the FIFO (8192) even if I am reading data from the DMA or data is not incoming as input on the FIFO.
Schermata a 2019-07-15 16-31-36.png
Am I using it right, shoud I use wr_data_count or rd_data_count? I couldn't find the meaning of axis_data_count on the datasheet.

Thank you for your help

0 Kudos
2 Replies
Visitor
Visitor
611 Views
Registered: ‎08-09-2017

Update on the problem, also reading axis_rd_data_count and axis_wr_data_count provide the same value at 8192.

Is it something dependent from the FIFO mode (e.g. pass-through versus packet mode)?
Is it something disabled or not available on the Zynq7000 series?

Should I enable the counting using some sort of API of the FIFO (I guess not)?

Other precisation, I access the value of the GPIO using mmap on the GPIO instance, this is the code:

// Function to read from GPIO
u32 read_mmap(XGpio *InstancePtr, u32 offset)
{
    // Open /dev/mem
    int fd = open("/dev/mem", O_RDWR | O_SYNC);

    void *ptr = mmap(NULL, 0x00010000, PROT_READ | PROT_WRITE, MAP_SHARED, fd, (__off_t)InstancePtr->BaseAddress);
    //printf("pointer %x\n", ptr);
    // Sync mmap
    msync(ptr, 0x00010000, MS_SYNC);

    // Read value
    u32 value = *(unsigned *)(ptr + offset);
    int rc = munmap(ptr, 0x00010000);
    close(fd);
    return value;
}



Thank you for your help.

0 Kudos
Highlighted
Moderator
Moderator
559 Views
Registered: ‎01-09-2019

Hello @exeless 

Are you sure you are not just filling up the FIFO?  At a certain point of transferring data, the FIFO would be full/mostly full and then the DMA would take a chunck of data from the FO (First Output) part of the FIFO.  Then the FIFO would add more input with the FI (First Input) part of the FIFO.  axis_data_count would be the appropriate signal to see how much data is in the FIFO.

Thanks,
Caleb
-------------------------------------------------------------------------
Don’t forget to reply, kudo, and accept as solution.
-------------------------------------------------------------------------
0 Kudos