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

Input timer capture function development using PPI

Hi,

I want to measure the pulse length of sqauare wave (accuracy in ms) using PPI.

I have counted the number of pulses occurring in particular time period using PPI successfully. For that I used one timer as in count mode, and another timer as timer mode to capture the counts.

But I couldn’t measure pulse length duration. I was using GPIOTE peripheral driver, but I cannot use both LoToHi and HiToLo event on single pin. Further I used NRF_GPIOTE_POLARITY_TOGGLE, but in this case I didn’t get which transition triggered the interrupt. So I can not start and stop timer based on the edge triggered.

I was trying to access registers directly rather than GPIOTE peripheral drivers…..but I didn’t get useful result.

Can you please help me out in this case.

Thanks in advance.

Regards,

Pooja Uchagaonkar

Parents
  • I had the same need. I have a sensor attached to a GPIO pin and periodically it goes from hi to low, remains low for a short time period (200-500ms), then returns to hi. On HiToLo, I want to start a timer, then on LoToHi, stop the timer, all using GPIOTE and PPI. The solution is to directly access the GPIOTE peripheral rather than using the driver. See this post.

  • Hi Tim, 

    Thanks a lot for solution.

    I accessed GPIOTE peripheral directly as per you referred and the issue is resolved. Now I can measure the any input pulse width using PPI timer capture development. But one another thing is, I also want to use GPIOTE peripheral driver file nrfx_gpiote in my application for simply handling another GPIO's interfaces. 

    Is there any another alternative solution for this? OR I have to use it directly for all. 

    Regards,

    Pooja Uchagaonkar

Reply
  • Hi Tim, 

    Thanks a lot for solution.

    I accessed GPIOTE peripheral directly as per you referred and the issue is resolved. Now I can measure the any input pulse width using PPI timer capture development. But one another thing is, I also want to use GPIOTE peripheral driver file nrfx_gpiote in my application for simply handling another GPIO's interfaces. 

    Is there any another alternative solution for this? OR I have to use it directly for all. 

    Regards,

    Pooja Uchagaonkar

Children
Related