- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
I tried some example programs in Nios 2 using interrupt handling, i made all the configurations required to generate the interrupt,including whether it is a level or edge and all those stuffs.I used an GPIO to generate an interrupt but whenever i change the state of the input the interrupt is not getting generated i have attached by code below # include "sys/alt_irq.h"# include "altera_avalon_pio_regs.h"# include "alt_types.h"# include "nios2.h"# define BUTTON_PIO_IRQ 0# define BUTTON_PIO_BASE 0x00000000 volatile int edge_capture; static void handle_button_interrupts(void* context, alt_u32 id); void main() { void* edge_capture_ptr = (void*) &edge_capture; NIOS2_WRITE_IENABLE(0xf); IOWR_ALTERA_AVALON_PIO_IRQ_MASK(BUTTON_PIO_BASE, 0xf); IOWR_ALTERA_AVALON_PIO_EDGE_CAP(BUTTON_PIO_BASE, 0x0); alt_irq_register( BUTTON_PIO_IRQ,edge_capture_ptr,handle_button_interrupts); while(1) { } } static void handle_button_interrupts(void* context, alt_u32 id) { volatile int* edge_capture_ptr = (volatile int*) context; *edge_capture_ptr = IORD_ALTERA_AVALON_PIO_EDGE_CAP(BUTTON_PIO_BASE); IOWR_ALTERA_AVALON_PIO_EDGE_CAP(BUTTON_PIO_BASE, 0); IOWR_ALTERA_AVALON_PIO_IRQ_MASK(BUTTON_PIO_BASE, 0xf); } Thanks in advance GowthamLink Copied
1 Reply
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
May want to try the Nios forum.
Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page