Altera_Forum
Honored Contributor
8 years agoLightweight HPS to FPGA Bridge register accessses not working
Hi,
I created a System in Qsys with a slave-template from Altera and offset it to base 0x10000 relative to lightweight H2F bridge. (image1) In Quartus I connected the SoC-System outputs of the slave-template. (image2) I got 2 r/w registers configured in the slave-template wizard in qsys. Since the slave-template gives me the std_logic_vectors for in and outbound data, i just inserted a loopback and made reg0 output what was input into reg0. the same for the second register. Now as I understood, the lightweight AXI is 32bit width. Is the addressing byte- or wordaddressing? In my baremetal program I do the following first: # define LWHPS2FPGA_BRIDGE_BASE 0xFF200000 //lightweight h2f bridge base# define test_out_base 0x10000 //offset of the qsys avalon slave component (slave-template) volatile unsigned int *reg0 = (volatile unsigned int *)LWHPS2FPGA_BRIDGE_BASE + test_out_base; //first register volatile unsigned int *reg1 = (volatile unsigned int *)LWHPS2FPGA_BRIDGE_BASE + test_out_base+2; //second register when word-addressing volatile unsigned int *reg2 = (volatile unsigned int *)LWHPS2FPGA_BRIDGE_BASE + test_out_base+4; //second register when byte-addressing I always read 32bit as I am using unsigned int*, do I have to read 8bit instead by using char*? I tried it, but it did not work, too. Then I'm writing/reading regs like: getc(); //wait for button *reg0 = 0x12345678; puts("put 0x12345678 to reg0 ... read now?\n"); getc(); printf("reg0: %x\n",*reg0); I did the same for *reg1 and *reg2. but no matter what I write into the registers, whenever I read them, they are 0. What am I missing/messing up here? Thanks for every hint!