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

Can we use multiple channels on hw timers?

We plan on using 4 to 5 timers on our project. Each timer has different timer intervals (Example 1 minute, 50 ms, 300 ms etc)

We are trying to use 2 Timer instances and multiple channels on each timer instance. So we should be able to use 6 * 2 = 12 different timers. Is that right?

We are not able to use different channels on the same timer instance.

Parents
  • Hi,

    Each timer have 5-6 compare registers, meaning you can create multiple timer intervals using the same timer instance. If this ca be used in your application, depends on if you want the timers to be one-shot or repeating timers, and if all timers start at the same time or if you start/stop timers at different points. If you start timers at different points, you will need to calculate the compare value from the current count value, and also make sure the timers does not overflow before your compare value.

    Your timer intervals seems quite long, have you considered using the application timer library? If you intend to use the timers for generating interrupts, and are not planning to control other peripherals directlty from the timer through PPI, this library should provide the functionality you are looking for. The application timer runs on the RTC peripheral, which use the 32.768 kHz low-frequency clock source. This gives lower power consumption and lower resolution for your timers, but unless you will be creating timers in the µs range, this should not be a problem. The library handles all overflow and compare value calculations for your, allowing you to create/start/stop/pause timers with an easy-to-use API.

    Please have a look at the application timer tutorial, to learn how to use this library.

    Best regards,

    Jørgen

  • Thanks a lot for the response. Does the application timer library help me in creating multiple repeating timers?

Reply Children
No Data
Related