Forum Discussion

Altera_Forum's avatar
Altera_Forum
Icon for Honored Contributor rankHonored Contributor
20 years ago

NIOS II Problem with Interrupt Timer

I'm using the Cyclone II Development Kit. Using SOPC builder I added a timer to the NIOS2 in "standard" project. I configured the timer to be an Interrupt timer with a period of 500 microseconds. I assigned the it an IRQ of 7 and a slave address immediately following the periphal address of the previous element (0x022208C0). I generated a new processor and then compiled it in Quartus II. In the software I wrote and interrupt function, installed it, and enabled it. I read the status and control registers of the timer and confirmed that the timer is running, it times out, and the interrupt enable bit is high; but alas the interrupt code never gets called. What am I doing wrong?? Any hints or comments would be greatly appreciated.

3 Replies

  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    I used something like

      /* set to free running mode */
      IOWR_ALTERA_AVALON_TIMER_CONTROL (HIGH_RES_TIMER_BASE, 
                ALTERA_AVALON_TIMER_CONTROL_ITO_MSK  |
                ALTERA_AVALON_TIMER_CONTROL_CONT_MSK |
                ALTERA_AVALON_TIMER_CONTROL_START_MSK);
      /* register the interrupt handler, and enable the interrupt */
        
      alt_irq_register (HIGH_RES_TIMER_IRQ, NULL, handle_timer_interrupt);    

    to program the highres timer in the standard example... It worked for me.

    Paolo
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    --- Quote Start ---

    originally posted by paolo.gai@Mar 20 2006, 11:47 AM

    i used something like

      /* set to free running mode */
      iowr_altera_avalon_timer_control (high_res_timer_base, 
                altera_avalon_timer_control_ito_msk  |
                altera_avalon_timer_control_cont_msk |
                altera_avalon_timer_control_start_msk);
      /* register the interrupt handler, and enable the interrupt */
        
      alt_irq_register (high_res_timer_irq, null, handle_timer_interrupt);    

    to program the highres timer in the standard example... it worked for me.

    paolo

    <div align='right'><{post_snapback}> (index.php?act=findpost&pid=13611)</div>

    --- Quote End ---

  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    --- Quote Start ---

    originally posted by dough1a+mar 20 2006, 01:38 pm--><div class='quotetop'>quote (dough1a @ mar 20 2006, 01:38 pm)</div>

    --- quote start ---

    <!--quotebegin-paolo.gai@Mar 20 2006, 11:47 AM

    i used something like

      /* set to free running mode */
      iowr_altera_avalon_timer_control (high_res_timer_base, 
                altera_avalon_timer_control_ito_msk  |
                altera_avalon_timer_control_cont_msk |
                altera_avalon_timer_control_start_msk);
      /* register the interrupt handler, and enable the interrupt */
        
      alt_irq_register (high_res_timer_irq, null, handle_timer_interrupt);    

    to program the highres timer in the standard example... it worked for me.

    paolo

    <div align='right'><{post_snapback}> (index.php?act=findpost&pid=13611)</div>

    --- Quote End ---

    <div align='right'><{post_snapback}> (index.php?act=findpost&pid=13614)</div>

    [/b]

    --- Quote End ---

    Thanks. I used the same code for the highres timer and it worked fine; but when I add an additional timer with the same attributes as the highres timer I can&#39;t seem to get the interrupt to be generated.

    Doug