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++
Announcements
The Intel sign-in experience has changed to support enhanced security controls. If you sign in, click here for more information.
12517 Discussions

Programming NIOSII interfaced with custom component, using Avalon MM Interface

Altera_Forum
Honored Contributor II
2,845 Views

Hello Everyone, 

 

I am trying to interface NIOS II with a custom component using Avalon MM Inferface where NIOS acts as Master. 

During the C coding, how do i get access to the function to send/receive data through the Avalon MM interface ? 

Can i get direct access to the ports dedicated for the interface ? and Do i need to follow some particular protocol while C coding for the interface ?
0 Kudos
23 Replies
Altera_Forum
Honored Contributor II
67 Views

I implemented 16 Bit 128 Tap FIR Filter with two approach: 

 

First with implementing the FIR on NIOS II core using C language (Software FIR Design). 

Second with implementing FIR as Hardware Accelerator on FPGA which get i/p values & coeff from NIOS II core and returns the the result to NIOS II core (Hardware FIR Design). 

 

Below are the links to project. Hope it helps. 

 

Software FIR Design: 

https://www.youtube.com/watch?v=sjjbu-lhzpc 

 

Hardware FIR Design: 

https://www.youtube.com/watch?v=-egwtmwg0ku
Altera_Forum
Honored Contributor II
67 Views

Hello everyone 

 

I need to sent 5 different 16 bits data in 5 five clock cycles to my costum component. 

My Altera board is driven by a 50MHz oscillator (a period of 0.02 µs). 

 

so should I write  

 

IOWR_16DIRECT(BASE , OFFSET, DATA_1); 

usleep(0.02); 

IOWR_16DIRECT(BASE , OFFSET, DATA_2); 

usleep(0.02); 

IOWR_16DIRECT(BASE , OFFSET, DATA_5);
Altera_Forum
Honored Contributor II
67 Views

 

--- Quote Start ---  

Hi,  

I succeeded in implementing the system on board. My custom component is a 128 tap FIR filter which is to be started by NIOS and stimuli is also provided by nios. I made the custom component in Qsys and implemented the system. 

Now i am able to write the c code successfully on the NIOS without any tool errors. 

 

But, i am not able to communicate properly. Below is my code: 

 

int var =1234; 

IOWR(20496,0,11); 

 

printf("%d\n",var); //prints 1234 

 

var = IORD(20496,0); 

 

printf("%d\n",var); // prints 0 

 

When I am reading the same address and offset, it gives 0. 

--- Quote End ---  

 

 

HI, 

 

I'm currently facing the issues as mentioned in the quote above. 

May I know the way you resolve it? 

 

Thanks  

HY
Reply