2258432
Occasional Contributor
2 years agoHow to correctly read data from FIFO on HPS and send it out through HPS Ethernet
I am a novice. I have two clone V soc boards, and I generated some video data on the FPGA side of one of them and sent it to the HPS side through the H2F AXI bus. I want to send it to the second board through Ethernet. Before doing so, I used signalTap simulation to observe whether the HPS side can correctly read the data in the FIFO, but it seems to differ significantly from the written data. Can someone help me? Any help will be greatly appreciated.
Thank you in advance.qsyssignalTap
/* Code for reading data on the HPS side */ #include <stdio.h> #include <fcntl.h> #include <sys/mman.h> #include <stdint.h> #include <unistd.h> #define HW_REGS_BASE (0xC0000000) #define HW_REGS_SPAN (0x04000000) #define ALT_H2F_OFST (0xFF500000) #define HW_REGS_MASK (HW_REGS_SPAN - 1) #define LED_PIO_OFFSET (0x00000408) int main() { int fd; void *h2f_axi_base; void *led_pio_addr; fd = open("/dev/mem", O_RDWR | O_SYNC); if (fd == -1) { perror("could not open /dev/mem\n"); return 1; } h2f_axi_base = mmap(NULL, HW_REGS_SPAN, PROT_READ | PROT_WRITE, MAP_SHARED, fd, HW_REGS_BASE); if (h2f_axi_base == MAP_FAILED) { perror("could not mirror the H2F AXI address\n"); close(fd); return 1; } led_pio_addr = h2f_axi_base + ( ( unsigned long ) (ALT_H2F_OFST + LED_PIO_OFFSET) & (unsigned long ) (HW_REGS_MASK) ); while (1) { // read data uint32_t data = *((volatile uint32_t *)led_pio_addr); } munmap(h2f_axi_base, HW_REGS_SPAN); close(fd); return 0; }
Hi,
We only have two examples, but on old version so you can use them as references, unfortunately we do not have the latest version for this:
https://www.rocketboards.org/foswiki/Projects/CycloneVRGMIIExampleDesign