UPGRADE YOUR BROWSER

We have detected your current browser version is not the latest one. Xilinx.com uses the latest web technologies to bring you the best online experience possible. Please upgrade to a Xilinx.com supported browser:Chrome, Firefox, Internet Explorer 11, Safari. Thank you!

cancel
Showing results for 
Search instead for 
Did you mean: 
Visitor asuarez
Visitor
633 Views
Registered: ‎02-14-2018

Petalinux 2017.4 AXI4-Lite FIFO Question

 

Hello everyone,

 

I am working with the zynq zc702 board and wanted to use the AXI4-Lite FIFO to communicate between the PL-PS as you can see in the image below. 

 

 

Screenshot from 2018-03-06 13-00-25.png

 

In a C++ application, I am using /dev/mem and mmap to access the FIFO with two functions to read and write to specific register spaces. 

 

 

 

// C++ CLASS FOR FIFO

uin32_t page_size = 0x10000;
int AxiFifo::initialize(void) { /* Open /dev/mem file */ fifo_fd = open ("/dev/mem", O_RDWR); if (fifo_fd < 0){ return -1; } /* mmap the device into memory */ page_addr = ( reg_addr & (~(page_size-1))); page_offset = reg_addr - page_addr; fifo_ptr = mmap(NULL, page_size, PROT_READ|PROT_WRITE, MAP_SHARED, fifo_fd, page_addr); if (fifo_ptr == nullptr){ return -1; } return 0; } uint32_t AxiFifo::readWord(int reg_space) {
return *((volatile unsigned long *)(fifo_ptr + page_offset + reg_space)); } void AxiFifo::writeWord(int reg_space, uint32_t data) {
*((volatile unsigned long *)(fifo_ptr + page_offset + reg_space)) = data; }

 

 

// IN MAIN()

AxiFifo rawFifo(0x43c00000);
    int ret = rawFifo.initialize();
    if(ret < 0){
        LOG(ERROR) << "raw fifo init failed";
        return -1;
    }

rawFifo.writeWord(ISR, 0xFFFFFFFF);
rawFifo.readWord(ISR)
rawFifo.writeWord(IER, 0x0C000000);
rawFifo.writeWord(TDR, 0x00000002);
...etc

 

My issue is that the values I am reading don't seem to make any sense. The FIFO's receive occupancy never seems to increase even if I push values to it. Does anyone know what I am doing wrong?

 

Thank you,

 

0 Kudos
1 Reply
Highlighted
Explorer
Explorer
615 Views
Registered: ‎03-22-2016

Re: Petalinux 2017.4 AXI4-Lite FIFO Question

By "push values to it" do you mean send a packet to it via the AXI Stream interface, ending with TLAST?

0 Kudos