This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

Global Clock on nRF51822?

Seems like the timer API uses low priority interrupts. Now, I dont need the timer triggers to be exactly delivered so that is fine ... however, i do need to know the exact time between current and last timer trigger. Is there a way to query a clock tick counter or some kind of global counter which i can use to calculate the time elapsed between timer events?

Thanks!

Parents
  • Hi,

    Are you going to use a timer to track time? Like having a variable that shows minutes/seconds/ms/etc?

    If you use the app_timer library, you can setup functions that are called every x millisecond. Using this you can setup a global variable that is incremented (in the app_timer callback function) each time it's called.

    Best regards Håkon

  • You can use TIMER1 or TIMER2 for this. It's sourced by the 16M, so it should give you a good enough resolution.

    One thing I'm a bit concerned about is the real-time requirements that you have. As you are already aware of it seems, the stack will block the main application for a given time based on how often and how much data you are sending.

    How often is the gyro-sampling-routine called? I know you sample x samples each ms, but I assume it's not sampling every 10 us for eternity?

Reply
  • You can use TIMER1 or TIMER2 for this. It's sourced by the 16M, so it should give you a good enough resolution.

    One thing I'm a bit concerned about is the real-time requirements that you have. As you are already aware of it seems, the stack will block the main application for a given time based on how often and how much data you are sending.

    How often is the gyro-sampling-routine called? I know you sample x samples each ms, but I assume it's not sampling every 10 us for eternity?

Children
No Data
Related