Community
cancel
Showing results for 
Search instead for 
Did you mean: 
Altera_Forum
Honored Contributor I
800 Views

need help in c code for communication between Nios ii processor and custom component.

hi ,  

i am done with my qsys design . now i want to move to the next steps. i wan to send data from my nios II processor to the custom Component ( encoder) , i created. can any one suggest me any example codes. i need to send a 32 bit data to the custom component from nios II processor. please do suggest me ...
0 Kudos
5 Replies
Altera_Forum
Honored Contributor I
81 Views

add 32 bit PIO from u r qsys (i haven't much idia about qsys, i am using SOPC builder) , and write u r data on this bus using u r c- code,  

don't forget to add this 32 bus to u r nios-ii symbol.
Altera_Forum
Honored Contributor I
81 Views

http://www.akiron.com/fpga/customipinstruction.pdf 

 

this is my note. 

it is written for SOPC builder. 

Qsys changed a lot of appearance. 

but the idea is basically same. 

 

should work.
Altera_Forum
Honored Contributor I
81 Views

Maybe you can memory map to address and r/w from that or use pio

Altera_Forum
Honored Contributor I
81 Views

i am asking can anyone give me a C code for communication from nios II processor to some custom block i created. i am done with qsys. it is compiled. no issues. please do help with the c code

Altera_Forum
Honored Contributor I
81 Views

ho about 

 

///////////////////////// c code (^v^ )///////////////////////////////////////// 

# include <io.h> 

# include <system.h> 

 

..... 

 

short pio_button; 

pio_button = IORD_16DIRECT(PIO_BUTTON_BASE,0); 

 

IOWR_16DIRECT(PIO_LED_BASE,0,pio_button); 

 

/////////////////////////////////////////////////////////////////////////////////// 

 

IORD_16DIRECT is reading register from address of PIO_BUTTON_BASE 

IOWR_16DIRECT is writing data to PIO_LED_BASE 

 

those base addresses are written in <system.h> 

serch IOWR_*DIRECT functions
Reply