This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts
This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

How to measure elapsed time between GPIOTE events?

I am using GPIOTE to response to transitions in some GPIO pins. This code is added to the BLE UART example code (ble_app_uart_c with S120) from SDK 10. The code is already working.

The next thing I want to do is measuring the elapsed time between the GPIOTE events. I found a related thread but there was no immediate solution.

I could not find any example code that uses a timer in capture mode in BLE app.

The resolution of the elapsed time needs to be about 0.1 ms.

Thanks in advance for the help!

Parents
  • Hi,

    Have a look at the application timer tutorial. You can configure a timer to start on the GPIOTE event, then you read the timer at the next GPIOTE event. If you want this to happen repeatedly you can take the difference between two consecutive events. The application timer should provide sufficient accuracy, if you find that it is too low you can use the HFCLK for timing, at the cost of higher current consumption.

    Best regards,

    Øyvind

Reply
  • Hi,

    Have a look at the application timer tutorial. You can configure a timer to start on the GPIOTE event, then you read the timer at the next GPIOTE event. If you want this to happen repeatedly you can take the difference between two consecutive events. The application timer should provide sufficient accuracy, if you find that it is too low you can use the HFCLK for timing, at the cost of higher current consumption.

    Best regards,

    Øyvind

Children
No Data
Related