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

Create timer in microseconds without nrf_delay_us and __nop() / __NOP()

Hey guys,

I have a timer like this:

While this first timer (nrf_drv_timer) is running,  I need a second timer whose interval I have to be able to change constantly.

E.g.

      //Do this

      time_us (10)

      //Do that

      time_us(60)

But the second timer must not influence the first. In this thread I created a timer with Håkon that uses __NOP()s. Unfortunately, these affect the first timer ...

To sum up: The second timer should be a single shot timer, whose interval I can change and which can not influence the first timer. And I know that RTC has a less resolution (~30us) but I need a resolution up to 1us. I think I can not use a timer like the first timer because of I can't changed the interval, right?

I hope, you can help me.

Thanks in advance,

Christoph

Parents
  • Hi,

    If you want to do this properly you need an additional  timer, and start the second timer from the first timer. So I suggest to check out the nRF52840 which have 5 high frequency timers. Then you can also control the priority of the two timers, and for instance if one should be able to pre-empt the other.

    Best regards,
    Kenneth

  • Hey Kenneth,

    firstly excuse me for writing back after 9 days. I will come back later to your answer. Another issue has come up.

    Best regards,

    Christoph

Reply
  • Hey Kenneth,

    firstly excuse me for writing back after 9 days. I will come back later to your answer. Another issue has come up.

    Best regards,

    Christoph

Children
No Data