nrf52833 + PPI + PWM Pulse Counter

Hi Team,

We are developing an application where we have PWM like pulses coming from our sensor. Max frequency of this would be around ~8k. We want to poll the number of pulses we have received in X amount of time (let's say this X amount of time is triggered by timer).

Currently we have configured an interrupt on the PWM HI->LO and have counter in the ISR. This counter is just a global variable and we reset after reading it from timer handler, so we can know how may pulses are received since we last read the counter.

This approach works however because of ISR, we have context switch every time there is an interrupt. We would like to do other stuff like BLE data transfer when this is happening in parallel. So, basically we would like to avoid CPU interruption every time there is an event. We are thinking of having HW counter and polling it every time we want.

However, I was reading through the PPI on nrf52833 and I was wondering:

  1. Is it possible to do such counting, without interrupt and CPU cycles?
  2. Since ours is a battery operated device, does using PPI affect sleep current? Currently we have measured sleep current as 2.7uA with our custom HW.

Environment: nrf52833 and ncs v1.8.0

TIA!

Related