Beware that this post is related to an SDK in maintenance mode
More Info: Consider nRF Connect SDK for new designs
This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

Priming periodic PPI tasks (Force timer event)

Hi, 

I'm trying to utilize PPI system to generate repetitive sequence of tasks (lets call them Task A, B, C, D, E, F) at 0,10,20,40,60,80 ms every second.
i.e. I need to have timing on 0,10,20,40,60,80, 1000,1010,1020,1040,1060,1080, 2000, 2010,2020...  ms boundaries

I'm using Timer4 6*compare registers the following way:

  • PPI0 - Event from T4CCR0 = 10ms, Task B (some task)
  • PPI1 - Event from T4CCR1 = 20ms, Task C (some other task)
  • ...
  • PPI4 - Event from T4CCR4 = 80ms, Task F
  • and PPI5 - Event from T4CCR5 = 1000ms, Task A.
    Also, T4CCR5 uses SHORTS register for T4_CLEAR task

This way I can get the following timing: 10(B)-20(c)-40(D)-60(E)-80(F) - 1000(A)-1010(B)-1020(c)-1040(D)-1060(E)-1080(F) - 2000(B) which is as desired EXCLUDING the very first task at t=0

Is there a way to 'prime' this synchronous machine  by 'forcing' T4CCR5 event upon startup?

Is there a way to set T4 initial value to specific value , i.e. start at 1000ms value that will immediately activate PPI5 and clear itself  ?

Thanks in advance for any advice

Related