This repository contains a proof of concept demonstration of using STM hardware events to trace power domain transitions on nRF54H20.
Install the following dependencies before running:
pip install pylink-square plotly
nrfutil install traceThe sequence performed by the script is:
- (With --tdd-setup): Enables TDD and configures for STM HWEVENT -> ETB tracing.
- (With --record): Starts ETB recording and waits either for a given duration or until it is full. Events are decoded using 'nrfutil trace stm̈́'.
- (With --plot): Plots the decoded events in a basic diagram.
- (With --tdd-teardown): Disables the TDD.
By default the script enables all STM HW events, which can fill up the ETB quickly. The --pd/--power-domain argument can be used to limit the traced events based on power domain.
The --record-start-only or --record-stop-only can be used together with --record to either only start or stop the trace.
It is also possible to store either the raw ETB data or decoded events in a file using --out-bin or --out-csv respectively.
Record the application active domain for 30 seconds and plot the events:
python stm_hwevent_etb.py \
--tdd-setup \
--record \
--record-duration 30 \
--pd application-fast-active \
--tdd-teardown \
--plotRecord the application and radio domain events to a file:
python stm_hwevent_etb.py \
--tdd-setup \
--record \
--record-duration 30 \
--pd application-fast-active \
--pd radiocore-active \
--pd radiocore-fast-active \
--tdd-teardown \
--out-csv my_events.csvPlot the events read from a file:
python stm_hwevent_etb.py \
--in-csv my_events.csv \
--pd application-fast-active \
--pd radiocore-active \
--pd radiocore-fast-active \
--plotThis script is intended as a proof of concept and is not a very robust tool.
Note that data before the first Coresight sync frame is discarded by the trace decoder. If there are few events being produced this could mean that no events are decoded even though there was data read.