Frequency counter on NRF52805

Hi, I want to use an NRF52805 with a voltage to frequency detector. If I understand the datasheet, there is one timer/counter and RTC on that chip. Is it possible to set the RTC as the timing gate, and  use the T/C as an input pulse counter through the event system? I'm planning to use a single clock source (prob. 32MHz) and synthesize the LF clock required for the RTC from it.

I will be happy to know if this is a good way to go before fully adopting the hardware.

Cheers,

Parents Reply Children
  • OK, a few days with an NRF52-DK at hand I have a few more questions:

    1. I see that there is a guy who did implement a counter similarly to what I want, using 2xtimers, events, tasks, and ppi here. I'm not 100% OK with the solution since: (a) the tasks of the counter and timer are both started from main. This does not guarantee a consistent timing for the counter and gate functions. (b) Likewise counter is read from a timer interrupt.

    2. What i'd like to do is as follows: (a) Clear Timer0 -> (b) on Timer0 start generate event to start Counter1 -> (c) On Timer0 CC generate event to stop counter -> (d) on stop Counter1 generate event to stop Timer0

    3. Can this be done? i.e. can I generate an event on Timer0 start and link it to Counter1 start? Also, can (d) be done? I have nothing against generating events (c) and (d) together from Timer0 CC with FORK if its easier.

    4. I noticed that the ppi example that I attached above can't locate the required ENUMs, unless I add #include<hal/nrf_gpiote.h>. Should I use this piece of code? I am using VS code on NRF connect and had problems utilyzing the ADC when I inclused <hal/nrf_saadc.h>. If not, is there a good PPI/EVENT example for nrf connect?

    Any help will be appreciated!

    Matan

Related