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

Not enough timers

My application uses the Softdevice, app_timer and app_pwm. So all timers are in use, but I have to measure two more pwm signals on two input pins. (Those come from HC-SR04 sonar sensors)

I have set up interrupt handlers on raising and falling edges but now I need a time source which is precise enough. When I just use the RTC1 counter which is used by app_timer I get wrong results most of the time. I guess app_timer resets the counter sometimes.

Maybe it would be possible to modify app_timer so I can get a free running timer?(app_timer would have to save the counter value to some variable before reset or something)

So all I need is another time source that just counts up and is at least as precise as the RTC.

Parents
  • With app_pwm you can have two pwm channels per timer. The reason you cannot have three per timer is that the library uses one CC channel to ensure that the pwm signal is not reversed. But enough about that.

    You have 3 timers with nRF51822 and 2 rtc timers. Since you have only used 2 timers you have one left that you can use. Using TIMER, GPIOTE and PPI you can get accurate measurements without worrying about being interrupted by for example the SoftDevice, so I would follow Tasketronds advice and read up on these peripherals.

Reply
  • With app_pwm you can have two pwm channels per timer. The reason you cannot have three per timer is that the library uses one CC channel to ensure that the pwm signal is not reversed. But enough about that.

    You have 3 timers with nRF51822 and 2 rtc timers. Since you have only used 2 timers you have one left that you can use. Using TIMER, GPIOTE and PPI you can get accurate measurements without worrying about being interrupted by for example the SoftDevice, so I would follow Tasketronds advice and read up on these peripherals.

Children
No Data
Related