Nios® V/II Embedded Design Suite (EDS)
Support for Embedded Development Tools, Processors (SoCs and Nios® V/II processor), Embedded Development Suites (EDSs), Boot and Configuration, Operating Systems, C and C++
12590 Discussions

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

Altera_Forum
Honored Contributor II
1,013 Views

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 II
294 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.
0 Kudos
Altera_Forum
Honored Contributor II
294 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.
0 Kudos
Altera_Forum
Honored Contributor II
294 Views

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

0 Kudos
Altera_Forum
Honored Contributor II
294 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

0 Kudos
Altera_Forum
Honored Contributor II
294 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
0 Kudos
Reply