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++
12600 Discussions

how to use external signal on nios2 in software

Altera_Forum
Honored Contributor II
1,082 Views

I have add a pin namely “enb” on nios processor as display in attached print-screen, every time this pin got high pulse. my IORD_..function read this pulse and start doing my further job. 

 

 

i have seen through oscilloscope that enb pulse is keep coming but my software routine could not read this pin ...it always says “enb = 0” 

Rate of change of this enb pin is (1/8)mhz. 

 

 

how do i use this external pin to my software....? 

 

 

 

p { margin-bottom: 0.21cm; }  

//this is the system.h contents with respect to the added enb input pin 

/* 

* pio_in_enb configuration 

*/ 

 

 

#define ALT_MODULE_CLASS_pio_in_enb altera_avalon_pio 

#define PIO_IN_ENB_BASE 0x10001560 

#define PIO_IN_ENB_BIT_CLEARING_EDGE_REGISTER 0 

#define PIO_IN_ENB_BIT_MODIFYING_OUTPUT_REGISTER 0 

#define PIO_IN_ENB_CAPTURE 0 

#define PIO_IN_ENB_DATA_WIDTH 1 

#define PIO_IN_ENB_DO_TEST_BENCH_WIRING 0 

#define PIO_IN_ENB_DRIVEN_SIM_VALUE 0x0 

#define PIO_IN_ENB_EDGE_TYPE "NONE" 

#define PIO_IN_ENB_FREQ 82500000u 

#define PIO_IN_ENB_HAS_IN 1 

#define PIO_IN_ENB_HAS_OUT 0 

#define PIO_IN_ENB_HAS_TRI 0 

#define PIO_IN_ENB_IRQ -1 

#define PIO_IN_ENB_IRQ_INTERRUPT_CONTROLLER_ID -1 

#define PIO_IN_ENB_IRQ_TYPE "NONE" 

#define PIO_IN_ENB_NAME "/dev/pio_in_enb" 

#define PIO_IN_ENB_RESET_VALUE 0x0 

#define PIO_IN_ENB_SPAN 16 

#define PIO_IN_ENB_TYPE "altera_avalon_pio" 

 

 

 

 

//this is my software routine which tried to read incoming enb pulse..... 

do 

enb = IORD_ALTERA_AVALON_PIO_DATA(PIO_IN_ENB_BASE); //Check For Rx Interrupt  

if (enb

//doing my job 

printf(“\nenb = %d”,enb); 

} while (my condition)); 

 

 

kaushal 

0 Kudos
2 Replies
Altera_Forum
Honored Contributor II
386 Views

What's driving the pin? Did you assign enb to any pins?  

 

If the signal is coming from an external interface (eg a GPIO) you need to assign enb as an "input" and assign it to the corresponding pin in assignment editor.
0 Kudos
Altera_Forum
Honored Contributor II
386 Views

i am able to get signal on external pin... 

 

Software routine make STRT signal high when i see this signal on SIGNAL TAB,sometime it show LOW..even though i haven't made it low... 

 

plz see the attached printscreen
0 Kudos
Reply