Results 1 to 2 of 2

Thread: Interval timer not counting up

  1. #1
    Join Date
    Apr 2013
    Rep Power

    Default Interval timer not counting up

    I am new to the Nios II stuff, I have a design with the simple interval timer peripheral. It is not counting. Basically I expected to be able to read the counter value by reading the snapshot registers by using IORD_ALTERA_AVALON_TIMER_SNAPL & IORD_ALTERA_AVALON_TIMER_SNAPH. But I always get 0.

    I tried to start the counter from control register and also tried fidling with the options in Qsys for the timer. However, whatever I do in life, I still can't measure the counter counting up at all.

    Here is the code I tried last time:

    #include "sys/alt_stdio.h"
    #include "system.h"
    #include "altera_avalon_timer_regs.h"
    #include "alt_types.h"
    #include "stdio.h"
    int main()
      alt_putstr("Hello from Nios II!\n");
      alt_u16 x=0;
      /* Event loop never exits. */
      while (1)
          printf("p: %u\n",x);
          printf("p: %u\n\n",x);
          printf("s: %u\n",x);
          printf("s: %u\n",x);
      return 0;
    If possible could you compile a simple project with timer peripheral. I am feeling lost completely.

  2. #2
    Join Date
    Apr 2013
    Rep Power

    Default Re: Interval timer not counting up

    Yes I figured out what things were wrong and know how to do this stuff now, the most elusive problem was that I was calling IORD_ALTERA_AVALON_TIMER_SNAPL when I had infact changed to using 64 bit timer that needs IORD_ALTERA_AVALON_TIMER_SNAP_0 instead. However, the program compiled just fine but did not work as expected.

Similar Threads

  1. Interval timer problem
    By Dazdranagorn in forum MicroC/OS-II Forum
    Replies: 11
    Last Post: September 2nd, 2013, 04:15 AM
  2. Interval Timer Problem
    By siedler2011 in forum General Discussion Forum
    Replies: 13
    Last Post: March 20th, 2012, 11:00 PM
  3. Interval timer
    By normad in forum MicroC/OS-II Forum
    Replies: 5
    Last Post: May 24th, 2011, 09:54 PM
  4. interval timer
    By bereteleo in forum General Altera Discussion
    Replies: 3
    Last Post: December 17th, 2010, 10:23 AM
  5. timer for counting the number of http get request
    By Edmon in forum FPGA, Hardcopy, and CPLD Discussion
    Replies: 1
    Last Post: May 25th, 2010, 11:55 PM


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts