PPI trace
The PPI trace module enables tracing of hardware peripheral events on pins. Tracing is performed without CPU intervention, because PPI is used to connect events with tasks in GPIOTE.
PPI trace can be used to debug a single event or a pair of complementary events.
When tracing a single event, every occurrence of the event toggles the state of the pin (see ppi_trace_config()
).
When tracing a pair of complementary events (for example, the start and end of a transfer), the pin is set when one of the events occurs and cleared when the other event occurs (see ppi_trace_pair_config()
).
The PPI trace module is used in the PPI trace sample.
API documentation
include/debug/ppi_trace.h
subsys/debug/ppi_trace/
- group ppi_trace
Module for tracing hardware events on GPIO.
Functions
-
void *ppi_trace_config(uint32_t pin, uint32_t evt)
Configure a PPI trace pin for tracing a single event.
Note
If a hardware event is used by DPPI in the application, the PPI trace configuration must occur after the DPPI connection for the given event. The order is important because DPPI allows assigning events to only one channel. Therefore, PPI trace subscribes to the same channel.
- Parameters:
pin – Pin to use for tracing.
evt – Hardware event to be traced on the pin.
- Returns:
Handle, or NULL if the configuration failed.
-
void *ppi_trace_pair_config(uint32_t pin, uint32_t start_evt, uint32_t stop_evt)
Configure a PPI trace pin for tracing complementary events.
Note
Not supported on nRF51 Series. Requires presence of GPIOTE SET and CLR tasks.
- Parameters:
pin – Pin to use for tracing.
start_evt – Hardware event that sets the pin.
stop_evt – Hardware event that clears the pin.
- Returns:
Handle, or NULL if the configuration failed.
-
int ppi_trace_dppi_ch_trace(uint32_t pin, uint32_t dppi_ch)
Configure and enable a PPI trace pin for tracing a DPPI channel.
This function allows to trace DPPI triggers without knowing any events being the source of the trigger. Configuration of events so that they publish to the given DPPI and enabling the DPPI is out of scope of this function and must be done externally. This function allows also to trace DPPI channels which are triggered by multiple events or the set of events publishing to the DPPI channel changes in run-time.
Note
Supported only on platforms equipped with DPPI.
- Parameters:
pin – Pin to use for tracing.
dppi_ch – DPPI channel number to be traced on the pin.
- Return values:
0 – The configuration succeeded.
-ENOMEM – The configuration failed, due to lack of necessary resources.
-ENOTSUP – The function is not supported on current hardware platform.
-
void ppi_trace_enable(void *handle)
Enable PPI trace pin.
- Parameters:
handle – Handle.
-
void ppi_trace_disable(void *handle)
Disable PPI trace pin.
- Parameters:
handle – Handle.
-
void *ppi_trace_config(uint32_t pin, uint32_t evt)