Note
If you already have a binary trace data file and would like to have it in a different format, see Converting trace data.
STM tracing uses dictionary-based logging to send messages without redundant strings. This is based on the Zephyr logging API's dictionary feature and is particularly useful for assisted multicore logging.
Complete the following steps:
-
Make sure you have configured your application for tracing.
nrfutil trace stmrequires that your application is compatible with the nRF Connect SDK v3.4.0 or later to work. -
Identify the device's serial port for tracing by listing the connected devices:
nrfutil device listNote
When selecting a serial port for the trace, pick the serial port with the highest serial port number.
-
Use the
nrfutil trace stmcommand to start capturing logs from the device, specifying the tracing options - at least the database configuration for each domain ID, along with the input serial port.
Use the following command pattern:nrfutil trace stm --database-config <domain_id>:build/<app_name>/zephyr/log_dictionary.json --input-serialport <serial_port>In this command, the following parameters are used:
-
<domain_id>is the decimal ID of the domain (core) that the application is running on. When using several domains, use a comma to separate each domain in the list.
Use the following prefixes to indicate the cores:Core Prefix ID Secure Domain sec0x21 Application core app0x22 Radio core rad0x23 System Controller (SysCtrl) sys0x2c Fast Lightweight Processor (FLPR) flpr0x2d Peripheral Processor (PPR) ppr0x2e -
<app_name>is the application name. <serial_port>is the serial port used for output.- The decoded output is written to the console as ASCII by default. Use
--output-type binaryto change the format,--output-raw <PATH>to also write the raw trace data to a file, or redirect the output to save it as a file.
For example:
-
To capture logs from the Secure Domain and the application core, use the following command:
nrfutil trace stm --database-config 0x21:build/my_app/zephyr/log_dictionary.json,0x22:build/my_app/zephyr/log_dictionary.json --input-serialport COM10 -
To capture logs from the Secure Domain, the application core, and the radio core, use the following command:
nrfutil trace stm --database-config 0x21:build/my_app/zephyr/log_dictionary.json,0x22:build/my_app/zephyr/log_dictionary.json,0x23:build/my_app/zephyr/log_dictionary.json --input-serialport COM10
nRF Util starts to capture the log data from the specified serial port and uses the provided dictionary databases to decode the logs into a human-readable format. The tool sends the decoded logs to the console.
-
-
When done, stop tracing by pressing CTRL-C.
For more information about STM tracing with nRF54H20, see the nRF54H20 logging page in the nRF Connect SDK documentation. For more information about multidomain logging, see also Multi-domain logging using ARM Coresight STM in the Zephyr documentation.