Snippets for an nRF91 Series device

nRF91 Series’ Snippets are tailored for tracing on the nRF91 Series devices but can work with other boards as well. On nRF91 Series devices, you can enable the following functionalities using snippets:

Functionality

Snippet name

Compatible board targets

nRF91 modem traces with flash backend using snippets

nrf91-modem-trace-ext-flash

nrf9151dk/nrf9151/ns, nrf9161dk/nrf9161/ns, nrf9160dk/nrf9160/ns, nrf9131ek/nrf9131/ns

nRF91 modem tracing with UART backend using snippets

nrf91-modem-trace-uart

All nRF91 Series board targets

nRF91 modem traces with RTT backend using snippets

nrf91-modem-trace-rtt

All nRF91 Series board targets

nRF91 modem traces with RAM backend using snippets

nrf91-modem-trace-ram

All nRF91 Series board targets

Shared UART for application and TF-M logging

tfm-enable-share-uart

All nRF91 Series board targets

nRF91 modem traces with flash backend using snippets

The nrf91-modem-trace-ext-flash snippet enables modem tracing, the flash backend, and external flash and configures them to store modem traces to a dedicated partition on the external flash for supported boards. To change the partition size, the project needs to configure the CONFIG_NRF_MODEM_LIB_TRACE_BACKEND_FLASH_PARTITION_SIZE Kconfig option.

To enable modem traces with the flash backend, add the nrf91-modem-trace-ext-flash snippet to the build configuration. You can do this in one of the following ways:

To add the modem traces with the flash backend snippet when building an application with west, use the following command pattern, where board_target corresponds to your board target and <image_name> to your application image name:

 west build --board board_target -- -D<image_name>_SNIPPET="nrf91-modem-trace-ext-flash"

nRF91 modem traces with RAM backend using snippets

The nrf91-modem-trace-ram snippet enables modem tracing and configures it to store modem traces to a dedicated partition on the RAM. To change the partition size, the project needs to configure the CONFIG_NRF_MODEM_LIB_TRACE_BACKEND_RAM_LENGTH Kconfig option.

To enable modem traces with the RAM backend, add the nrf91-modem-trace-ram snippet to the build configuration. You can do this in one of the following ways:

To add modem traces with the RAM backend when building an application with west, use the following command pattern, where board_target corresponds to your board target and <image_name> to your application image name:

west build --board board_target -- -D<image_name>_SNIPPET="nrf91-modem-trace-ram"

nRF91 modem tracing with UART backend using snippets

The nrf91-modem-trace-uart snippet enables the CONFIG_NRF_MODEM_LIB_TRACE Kconfig option and chooses the Zephyr UART driver for the backend, with the necessary Kconfig options. The snippet also enables the UART1 peripheral with a baud rate of 1 Mbd and hardware flow control enabled. If this configuration does not match your requirements, you can add a snippet or Kconfig and devicetree overlays to your application with the desired setup.

Note

If you are using the nRF9160 DK, remember to set the board controller switch to the **nRF91** position before programming.

To enable modem tracing with the UART trace backend on a nRF91 Series device, add the nrf91-modem-trace-uart snippet to the build configuration. You can do this in one of the following ways:

To add the modem trace UART snippet when building an application with west, use the following command pattern, where board_target corresponds to your board target and <image_name> to your application image name:

west build --board board_target -- -D<image_name>_SNIPPET="nrf91-modem-trace-uart"

Note

With sysbuild, using the west build -S option applies the snippet to all images. Therefore, use the CMake argument instead, specifying the application image.

nRF91 modem traces with RTT backend using snippets

The nrf91-modem-trace-rtt snippet enables the CONFIG_NRF_MODEM_LIB_TRACE Kconfig option and chooses the RTT trace backend with the necessary Kconfig options.

To enable modem tracing with the RTT backend, add the nrf91-modem-trace-rtt snippet to the build configuration. You can do this in one of the following ways:

To add modem traces with the RTT backend when building an application with west, use the following command pattern, where board_target corresponds to your board target and <image_name> to your application image name:

west build --board board_target -- -D<image_name>_SNIPPET="nrf91-modem-trace-rtt"

Shared UART for application and TF-M logging

If you want to activate TF-M logging while having modem traces with the UART backend enabled, it can be useful to direct the TF-M logs to the UART (UART0) used by the application.

To enable modem traces and TF-M logs, add the nrf91-modem-trace-uart and tfm-enable-share-uart snippets to the build configuration. You can do this in one of the following ways:

To activate both modem traces and TF-M logs when building an application with west, use the following command pattern, where board_target corresponds to your board target:

west build --board board_target -S nrf91-modem-trace-uart -S tfm-enable-share-uart