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

Measuring elapsed microseconds between 12 successive rising edges on 12 GPIOS on NRF52832 DK

Hi everyone,

I'm new with nrf52832, and I need to measure elapsed time in microsecond between rising edges of 12 different Gpios. I have 12 piezoelectric sensors filtered, amplified, getting a 0V-3.3V Logic level in input. Once one of these senors rises up, I need to start counting microseconds and store corresponding elapsed microsecond until I have 11 different values (assuming the first sensor's timing is 0). And then posting it over ble.

I red some documentations, and I heard about Timeslot API, timers and sys_tick, but I don't know which one would be better for my application.

Would you have any idea about how should I take this ?

Thanks for your help, and have a good day !

  • Thanks for your answer. I was referring to PPI page 165 table 30 (6 groups isn't it ?), Does it mean I can only program 6 gpios over PPI to start timer or capture timer value? Or is this done as 1 group of 6 PPI channels, and another group of 6 others PPI channels (using at total 2 groups of 6 channels each) mixed with 6 GPIOTE as mentionned in your previous comment ?

    I may have missed something, In case I'm using PPI, do I have to use GPIOTE to get peripheral event?

    Thanks for your time :)

  • I'm not sure I understand why you would need PPI groups? Is it so that each of the 12 sensors are completely independent from each other and may trigger at random times? I.e. iat is not so that all of them rises at the same time, on a common start signal?

    If it is all random I can't think of any way of using PPI channels. I don't think the Timeslot API would be of any use either as it is used to schedule events at deterministic points in time. The systick option would also require the use interrupts at the mercy of the Softdevice.

    I was actually wrong about the number of GPIOTE channels, by the way. nRF52832 has 8 GPIOTE channels and 6 PPI groups as you say.

  • Thank you for this comment. I was asking about PPI Groups, because I don't understand yet how they work. My 12 sensors are independent indeed. They are listening to the same signal, and I need to measure propagation timings between the first sensor to the 12'st. As I don't know which sensor will raised first to trigger Timer, I need whole configuration to adapt depending on which of the 12 input will raise first, and all of this in micro-second timing. Thanks again for your help, I think I should now try to find a chip with 12 GPIOTE channels ? Have a good day !

  • Yes, I'm afraid you need a different solution. I don't think this is doable with the timing constraints enforced by the Softdevice and the PPI and GPIOTE resources available on the nRF5 series alone.

  • What is PIN_TIMER? There is no definition for it in your code.

Related