The PPI trace sample shows how to trace hardware events on GPIO pins. It uses the PPI trace module.
The sample initializes trace pins to observe the following hardware events:
RTC Compare event (
RTC Tick event (
Low frequency clock (LFCLK) Started event (
Radio activity during Bluetooth advertising (available only for Bluetooth capable devices)
The sample sets up a Counter to generate an
NRF_RTC_EVENT_COMPARE_0 event every 50 ms.
Initially, RTC runs on RC low frequency (lower precision) as clock source.
When the crystal is ready, it switches seamlessly to crystal (precise) as clock source.
When the low-frequency crystal is ready, an
NRF_CLOCK_EVENT_LFCLKSTARTED event is generated.
Building and running¶
This sample can be found under
samples/debug/ppi_trace in the nRF Connect SDK folder structure.
See Building and programming a sample application for information about how to build and program the application.
After programming the sample to your board, test it by performing the following steps:
Connect a logic analyzer to the pins that are used for tracing. Check the sample configuration for information about which pins are used. To do so in SEGGER Embedded Studio, select Project > Configure nRF Connect SDK Project and navigate to PPI trace pins configuration.
The pin that is tracing the RTC Tick event is toggling with a frequency of approximately 32 kHz.
The pin that is tracing the RTC Compare event is toggling approximately every 50 ms.
The pin that is tracing the LFCLK Started event is set at some point.
Measure the typical time between two consecutive toggles of the pin that is tracing the RTC Compare event, before and after the LFCLK Started event is generated. Observe that the precision increases when the low-frequency crystal is started.
Observe periodical radio activity during Bluetooth advertising.