Forum Discussion
Altera_Forum
Honored Contributor
10 years ago --- Quote Start --- Learn about the Avalon bus that QSYS uses. You will write code to implement an Avalon master to talk to the f2h_sdram bridge that is implemented by the HPS. To connect it together, you will need to create a custom QSYS component to contain your code. Your component will need to implement an Avalon master and whatever other I/O it needs. There are several tutorials on how to do this on altera.com. It is also covered in the QSYS documentation which I would recommend reading. --- Quote End --- Hi! Yeah, I eventually learned how to do that and I'm sending data to the sdram through the f2h_sdram, I'm just not sure how to read it using the C program. First I set the avalon write address as 0x0000_0000 and tried to read the data at 0x0010_0000 which is where the SDRAM starts. This didn't work. I then tried setting the write address as 0x0010_0000 and reading at 0x0010_0000 but this didn't work either. Maybe I'm using the wrong read functions? I am reading it in the following way: int fd; unsigned char *mem; fd = open("/dev/mem", O_RDWR|O_SYNC); if (fd < 0) { perror("open"); exit(EXIT_FAILURE); } bridge_map = mmap(0, 4096, PROT_READ|PROT_WRITE, MAP_SHARED, fd, FPGA2SDRAM_BRIDGE_BASE); if (bridge_map == MAP_FAILED) { perror("mmap"); goto cleanup; } mem = (unsigned char *) (bridge_map); value=*mem; Any help is appreciated. Thank you very much.