1 Reply Latest reply on Nov 9, 2015 8:30 AM by userc_7511

    Increment timer on the BCM20737s (to time how long something took)

      Hello,

       

      I would like to know is there a function that can be called to start a timer, leave some part of the software run away and when it is finished print the value of the timer showing how long it too to execute some part of the software?

       

      I am used to calling them timers from my experience with stm32. Could someone help me?


      Thanks,

      Luke. 

        • 1. Re: Increment timer on the BCM20737s (to time how long something took)

          There is probably a better way to do this, but this might work:

          use rtc clock to grab the time before and after your function call and subtract the results.

          the output of the clock is a 48 bit counter that runs at 128KHz.

           

              #include "rtc.h"

              rtc_init();

             tRTC_REAL_TIME_CLOCK raw_clock;

             // rtc clock rate is 128KHz so divide by 128 if you want milliseconds.

              rtc_getRTCRawClock(&raw_clock);

              raw_clock.rtc64 = raw_clock.rtc64 >> 7;