- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
hello,
i want to use two timers with my nios core. but with this code i can only use one timer. the second one wil not work. is there something wrong with my alt_irq_register(,,). declaration. does anyone now the solution of this problem? do i need to use the interrupt vector controller? thanks! #include <stdio.h> #include "system.h" #include "altera_avalon_timer_regs.h" #include "altera_avalon_pio_regs.h" #include "sys/alt_irq.h" #include"terasic_includes.h" void waypoint() { IOWR_ALTERA_AVALON_PIO_DATA(TEST_BASE, 0x1); IOWR_ALTERA_AVALON_TIMER_STATUS(WAYPOINT_BASE, 0); } void alpha() { IOWR_ALTERA_AVALON_PIO_DATA(ENA_BASE, 0x1); IOWR_ALTERA_AVALON_TIMER_STATUS(ALPHA_BASE, 0); } int main() { alt_irq_register( ALPHA_IRQ, null , alpha ); alt_irq_register( WAYPOINT_IRQ, null , waypoint ); return 0; }- Tags:
- Include
Link Copied
1 Reply
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Is the timer running?
Probably you need to initialize and start it. Try this in main: IOWR_ALTERA_AVALON_TIMER_CONTROL(ALPHA_BASE, 0); IOWR_ALTERA_AVALON_TIMER_PERIODL(ALPHA_BASE, (TPERIOD-1) & ALTERA_AVALON_TIMER_PERIODL_MSK); IOWR_ALTERA_AVALON_TIMER_PERIODH(ALPHA_BASE, ((TPERIOD-1)>>16) & ALTERA_AVALON_TIMER_PERIODL_MSK); alt_irq_register(ALPHA_IRQ, NULL, alpha); IOWR_ALTERA_AVALON_TIMER_CONTROL(ALPHA_BASE, ALTERA_AVALON_TIMER_CONTROL_CONT_MSK | ALTERA_AVALON_TIMER_CONTROL_START_MSK | ALTERA_AVALON_TIMER_CONTROL_ITO_MSK); Same for WAYPOINT timer.![](/skins/images/0B743BCD37FD8EED134343C203D4D429/responsive_peak/images/icon_anonymous_message.png)
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