- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hey everyone,
I've been trying to register an ISR for an interval timer in my platform designer system but with no success. Every time I call the function alt_ic_isr_register, the Nios II seems to hang indefinitely. This problem also occurs when using the legacy interrupt API.
My system is supposed to increment a global variable every time the timer rollsover.
Here is my code:
alt_u32 timer;
static void handle_timer_interrupt(void* context) {
timer++;
}
bool init_timer() {
int ret_val;
timer = 0;
ret_val = alt_ic_isr_register(TIMER_0_IRQ_INTERRUPT_CONTROLLER_ID, TIMER_0_IRQ, handle_timer_interrupt, NULL, 0x0);
// ISR registration failed
if(ret_val < 0)
return false;
IOWR_ALTERA_AVALON_TIMER_CONTROL(TIMER_0_BASE, ALTERA_AVALON_TIMER_CONTROL_CONT_MSK | ALTERA_AVALON_TIMER_CONTROL_START_MSK | ALTERA_AVALON_TIMER_CONTROL_ITO_MSK);
return true;
}
After tracing the problem down using printf, I found that the program hangs when alt_iic_isr_register gets called. More specifically, in the file "alt_iic_isr_register.c", the program does not progress past the line "alt_irq_enable_all(status);" (line 98). I found this by modifying the file as such:
printf("Enabling IRQs\n");
alt_irq_enable_all(status);
printf("IRQs enabled\n");
Which resulted in the console only printing "Enabling IRQs"
I've tried this with other interrupt sources such as the PIO core but it fails in the same manner.
Does anyone have any hints as to what could be wrong here? Any feedback is greatly appreciated.
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Please check this thread (similar issue resolved)
https://forums.intel.com/s/question/0D50P00003yyK1ESAU/altalarmstart-doesnt-work?wapkw=alt_u32+timer
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page