Pulse width measurement
The Pulse width measurement sample demonstrates pulse width measurement using the pulse_meas driver.
Requirements
The sample supports the following development kits:
Hardware platforms |
PCA |
Board name |
|
|---|---|---|---|
PCA10156 |
|
||
PCA10175 |
|
It also requires a pulse source connected to the GPIO pins configured in the board overlay.
Overview
A GPIOTE instance detects pulse edges, a TIMER instance measures the elapsed time, and GPPI connects the peripherals without CPU intervention.
Each reported value represents the pulse width in microseconds.
Building and running
This sample can be found under samples/pulse_meas in the nRF Connect SDK folder structure.
To build the sample, follow the instructions in Building an application for your preferred building environment. See also Programming an application for programming steps and Testing and optimization for general information about testing and debugging in the nRF Connect SDK.
Note
When building repository applications in the SDK repositories, building with sysbuild is enabled by default.
If you work with out-of-tree freestanding applications, you need to manually pass the --sysbuild parameter to every build command or configure west to always use it.
Sample output
The following output is displayed in the console:
Pulse width measurement sample start
Stop requested, pending series: 0
series[0]: first=1000 us last=1000 us
Measurement finished, series read: 1, callbacks: 1
Dependencies
The module uses the following nrfx drivers:
nrfx_gpiotenrfx_timernrfx_gppi