Forum Discussion
Altera_Forum
Honored Contributor
13 years agoThanks a lot for the help! There's some communication going on now! You pointed out some major flaws in my wrapper. The chipselect could actually just be skipped, as it suggested in the avalon specification? But I don't understand the addressing
.wb_adr_i({2'b0, av_address}) My thoughts where: avalon fabric is addressing the slave on a 32bit wide words basis, while the CAN Controller has a set of byte registers where each address maps to one register. As the data is expanded to 32bits I would have expected a one to one mapping of the addresses. Probabaly you could give me a jumpstart here. The read/write accesses are not blocking the system anymore but I'm not sure if the result does make sense. If I use the following code to read/write registers
printf("Goint to reset mode \n");
IOWR_32DIRECT(OC_CAN_VERILOG_WRAP_0_BASE,0,1);
for(i = 4; i < 120; i += 4) {
temp = IORD_32DIRECT(OC_CAN_VERILOG_WRAP_0_BASE,i);
printf("%u: R %u ",i/4,temp);
IOWR_32DIRECT(OC_CAN_VERILOG_WRAP_0_BASE,i,255);
temp = IORD_32DIRECT(OC_CAN_VERILOG_WRAP_0_BASE,i);
printf("W+R255 %u ", temp);
printf("\n");
}
it outputs the following: --- Quote Start --- Goint to reset mode 0: R 1 W+R255 0 1: R 0 W+R255 0 2: R 0 W+R255 0 3: R 0 W+R255 0 4: R 0 W+R255 0 5: R 0 W+R255 0 6: R 0 W+R255 0 7: R 0 W+R255 0 8: R 4 W+R255 4 9: R 4 W+R255 4 10: R 4 W+R255 4 11: R 4 W+R255 4 12: R 0 W+R255 0 13: R 0 W+R255 0 14: R 0 W+R255 0 15: R 0 W+R255 0 16: R 255 W+R255 0 17: R 0 W+R255 0 18: R 0 W+R255 0 19: R 0 W+R255 0 20: R 0 W+R255 0 21: R 0 W+R255 0 22: R 0 W+R255 0 23: R 0 W+R255 0 24: R 255 W+R255 255 25: R 255 W+R255 255 26: R 255 W+R255 255 27: R 255 W+R255 255 28: R 255 W+R255 255 29: R 255 W+R255 255 --- Quote End --- The avalon clock is of course connected to the nios clock (100MHz), the external clock to a 10MHz clock, reset to the global reset and the other exports to pins of the IO header of the de0-nano - no CAN Transceiver yet. But the reading/writing of the registers should work. Something is going wrong somewhere... What were your experiences with the controller in general. Is it working reliably and thus usable? Thanks again!