Altera_Forum
Honored Contributor
11 years agonios address problem
hi everyone!
i am new to altra and nios II, recently i am trying to study altra fpga and nios II, i meet one serious problem and i need some help i add 3 my ip in the Qsys, seg7(to drive the LED Segment Displays), my_adc(to drive the ADC),my_dac(to drive the DAC) i build a project to test my_adc and my_dac in nios II.(the .v files work correct, i have tested them in quartus) this is my code: # include "alt_types.h"# include "altera_avalon_pio_regs.h"# include "sys/alt_irq.h"# include "system.h"# include <stdio.h># include <unistd.h> void delay(alt_u32 cnt); //主函数 int main() { alt_u16 ad_dis; alt_u8 cnt = 0; while(1) { IOWR_8DIRECT(MY_DAC_BASE,0,cnt); printf("Write Analog Value = %d,",cnt); delay(60000); //延时 ad_dis = IORD_8DIRECT(MY_ADC_BASE,0); // printf("Read Analog Value = %d\n",ad_dis); cnt++; } return 0; } //延时函数(延时时间为(2+2*i)us) void delay(alt_u32 cnt) { alt_u32 i =0; while(i < cnt) { i++; } } then i download the sof and elf file to the pcb, then the LED Segment start shining! then i check the address map https://www.alteraforum.com/forum/attachment.php?attachmentid=9349 and i found that the address of the seg7 is 0x11050~0x11051 the address of the my_adc is 0x11053~0x11053 the address of the my_dac is 0x11052~0x11052 so the reason of the LED Segment shining maybe i write to my_dac (0x11052) but the nios II write to seg7 (0x11050~0x11051) why this happen?