3 Replies Latest reply on Dec 22, 2014 7:14 PM by user_14586677

    Repeated reads to Timer Count giving inconsistent results

    matt.anderson

      I have a timer running on a 1MHz clock, and repeated calls to Timer_ReadCounter() occassionally give inconsistent results. I will see the second call to Timer_ReadCounter() return a larger value than the previous call (not a rollover). I assume this is because I am polling at a higher rate than the 1MHz Timer clock? If so, why wouldn't the timer simply report the same count as the previous query?

         

      Stepping through each line in the debugger provides the desired result, but when I let it run, I will hit my failure test case in my main code. A test project is attached.

        • 1. Re: Repeated reads to Timer Count giving inconsistent results
          user_14586677

          I am running this on a -030 DVK with an AXI-040 part in it. You hae a -039.

             

           

             

          I hit the test case, looks like right after a rollover. Note Timer runs even when

             

          you are halted, so your manual "run" command to the debugger is randomly

             

          sampling the timer.

             

           

             

          I notice on compile you are running an older version of Creator, updates

             

          fix error and add capability, thats also could be an issue.

             

           

             

          Regards, Dana.

          • 2. Re: Repeated reads to Timer Count giving inconsistent results
            matt.anderson

            As long as the devices remain within the family, they shouldn't have significant behavioural differences for IP blocks (at least, in theory), but it certainly is a point to investigate.

               

             

               

            I suppose I should update the dev environment, but I would think that this basic case would have been tested long ago. I will update the environment and try again.

               

             

               

            Also, the timer has a max 32 bit timeout at 1MHz, which should give it a rollover of just over an hour. It certainly takes less time than that to start the debugger and hit run. :)

               

             

               

            I just wanted to make sure that it was valid to read from the Timer_ReadCount() multiple times during the Timer's clock period as I couldn't find any documentation to say otherwise. If updating the environment doesn't work, I will file a case. Thanks.

            • 3. Re: Repeated reads to Timer Count giving inconsistent results
              user_14586677

              Actually the ReadCounter( ) is performing a capture into the FIFOs, I wonder

                 

              if thats an issue.

                 

               

                 

              Note you would not want counter reset on capture checked off in config.

                 

               

                 

              Regards, Dana.