jacobfeder / axisfifo

Zynq SoC Linux kernel driver for Xilinx AXI-Stream FIFO IP
GNU General Public License v3.0
49 stars 26 forks source link

axis fifo giving resource unavailable error #25

Open tomrae-eaton opened 1 year ago

tomrae-eaton commented 1 year ago

I have the axis_stream_fifo setup.

I attempt to read the data and display it in ascii. I can read some data which should be a counter that I am clocking in, but all I get are zeros and then I get Failed to read from FIFO: Resource temporarily unavailable

root@platform:/apps# poke 0x41200000 1 && ./readfifo Read 8 bytes from FIFO: 00 00 00 00 00 00 00 00 root@platform:/apps# poke 0x41200000 1 && ./readfifo Read 8 bytes from FIFO: 00 00 00 00 00 00 00 00 root@platform:/apps# poke 0x41200000 1 && ./readfifo Read 8 bytes from FIFO: 00 00 00 00 00 00 00 00 root@platform:/apps# poke 0x41200000 1 && ./readfifo Read 8 bytes from FIFO: 00 00 00 00 00 00 00 00 root@platform:/apps# poke 0x41200000 1 && ./readfifo Read 8 bytes from FIFO: 00 00 00 00 00 00 00 00 root@platform:/apps# poke 0x41200000 1 && ./readfifo Failed to read from FIFO: Resource temporarily unavailable

I cannot read again unless I reboot.

jacobfeder commented 1 year ago

Not sure what you're doing with the poke command. Have you tried setting up 2 AXIS FIFOs in loopback and running the example in the apps dir?

tomrae-eaton commented 1 year ago

Jacob,

The poke command or any other command the can write to memory, sets the resetn of the data counter to 1 letting data to be clocked into the stream. The leds should light when data is being clocked into the fifo.

Have not tried 2 in loop mode.

Tom

From: Jacob Feder @.> Sent: Monday, July 10, 2023 11:10 AM To: jacobfeder/axisfifo @.> Cc: Rae, Tom C @.>; Author @.> Subject: [EXTERNAL] Re: [jacobfeder/axisfifo] axis fifo giving resource unavailable error (Issue #25)

Not sure what you're doing with the poke command. Have you tried setting up 2 AXIS FIFOs in loopback and running the example in the apps dir?

— Reply to this email directly, view it on GitHubhttps://github.com/jacobfeder/axisfifo/issues/25#issuecomment-1629164639, or unsubscribehttps://github.com/notifications/unsubscribe-auth/A6VEOMTVH5KAO5ET5UF4JA3XPQLN7ANCNFSM6AAAAAA2ERSMRE. You are receiving this because you authored the thread.Message ID: @.**@.>>

jacobfeder commented 1 year ago

so poke is doing something to trigger your IP? Not sure I'm following.

tomrae-eaton commented 1 year ago

Jacob,

Yes, it is setting a gpio output to take my data counter out of reset. I clocked a 16 bit counter(to emulate my ADCs) into four axis_data_fifos. The into an axis_stream_combiner. The four 16 bit values were spread over 512 bits. The axis_stream_subset_converter shifts the 4 16bit values to the lower 64bits.

I then monitor the axis_data_fifos tready signal, And when ready, clock in 64 bit values at 10mhz rate using the tvalid signal. Tready is tied high. Simulation looks good. I added ila cores and see data flowing into the fifo. On the read end I get some zeros and then the resource unavailable. I can see the read from petalinux on the axi bus in chipscope although the data does not look right.

I am just trying to set up a continuous stream into a virtual fifo of a certain size and then capture the fifo data on a trigger.

I changed the axi interconnect to 64 bits and have axi4 full enabled.

I suspect bit width and data type errors. Possibly platform setup, although vivado said it was happy.

I removed the counter and added another fifo. Each output routed to the others input.

I run a loopback test and get the following.

Thanks for your help.

./loopback Failed to read from FIFO2: Resource temporarily unavailable @.:~/hsvm_apps# cat /dev/axis_fifo_0x43c00000 cat: read error: Resource temporarily unavailable @.:~/hsvm_apps# cat /dev/axis_fifo_0x43c20000 cat: read error: Resource temporarily unavailable @.***:~/hsvm_apps#

include

include

include

include

include <sys/mman.h>

define FIFO1_PATH "/dev/axis_fifo_0x43c00000"

define FIFO2_PATH "/dev/axis_fifo_0x43c20000"

define DATA_SIZE 4 // Number of data elements to write/read

int main() { int fifo1_fd, fifo2_fd; int i; unsigned int write_data[DATA_SIZE] = {0x12345678, 0xAABBCCDD, 0xEEFF0011, 0x44556677}; unsigned int read_data[DATA_SIZE] = {0};

// Open FIFO1 for writing
fifo1_fd = open(FIFO1_PATH, O_WRONLY);
if (fifo1_fd < 0) {
    perror("Failed to open FIFO1");
    return -1;
}

// Open FIFO2 for reading
fifo2_fd = open(FIFO2_PATH, O_RDONLY);
if (fifo2_fd < 0) {
    perror("Failed to open FIFO2");
    close(fifo1_fd);
    return -1;
}

// Write data to FIFO1
if (write(fifo1_fd, write_data, DATA_SIZE * sizeof(unsigned int)) != DATA_SIZE * sizeof(unsigned int)) {
    perror("Failed to write to FIFO1");
    close(fifo1_fd);
    close(fifo2_fd);
    return -1;
}

// Read data from FIFO2
if (read(fifo2_fd, read_data, DATA_SIZE * sizeof(unsigned int)) != DATA_SIZE * sizeof(unsigned int)) {
    perror("Failed to read from FIFO2");
    close(fifo1_fd);
    close(fifo2_fd);
    return -1;
}

// Close FIFO file descriptors
close(fifo1_fd);
close(fifo2_fd);

// Print the read data
for (i = 0; i < DATA_SIZE; i++) {
    printf("Read Data[%d]: 0x%08X\n", i, read_data[i]);
}

return 0;

}

Tom From: Jacob Feder @.> Sent: Monday, July 10, 2023 3:50 PM To: jacobfeder/axisfifo @.> Cc: Rae, Tom C @.>; Author @.> Subject: [EXTERNAL] Re: [jacobfeder/axisfifo] axis fifo giving resource unavailable error (Issue #25)

so poke is doing something to trigger your IP? Not sure I'm following.

— Reply to this email directly, view it on GitHubhttps://github.com/jacobfeder/axisfifo/issues/25#issuecomment-1629628690, or unsubscribehttps://github.com/notifications/unsubscribe-auth/A6VEOMXQIRZFU2MP3E5ZYGDXPRMEVANCNFSM6AAAAAA2ERSMRE. You are receiving this because you authored the thread.Message ID: @.**@.>>

jacobfeder commented 1 year ago

You can only use AXI lite interface. I would recommend something very simple for starters - configure them in a "loopback" mode so you can write data to 1 and read from the other. If that works then you can try adding back in your more complex firmware system.