Nios® II Embedded Design Suite (EDS)
Support for Embedded Development Tools, Processors (SoCs and Nios® II processor), Embedded Development Suites (EDSs), Boot and Configuration, Operating Systems, C and C++
Announcements
Intel Support hours are Monday-Fridays, 8am-5pm PST, except Holidays. Thanks to our community members who provide support during our down time or before we get to your questions. We appreciate you!

Need Forum Guidance? Click here
Search our FPGA Knowledge Articles here.
12455 Discussions

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

Altera_Forum
Honored Contributor II
842 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
123 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 II
123 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 II
123 Views

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

Altera_Forum
Honored Contributor II
123 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 II
123 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