Sometimes, not everything goes according to plan, and we need information about what happened.
We already know how to get debugging information from the application, through log output. However, in the case of the nRF91 Series, we also want debugging information from the modem core. For this reason, the modem core has the functionality to output a modem trace.
To get a modem trace, there are three steps that are needed:
Taking a modem trace from the nRF91 Series SiP requires no extra hardware, only the software tool described in this exercise.
The first step is achieved through the AT command AT%XMODEMTRACE
. This can be used both to activate and deactivate modem tracing in the modem.
The command has the following set command syntax
AT%XMODEMTRACE=<oper>,<set_id>
Terminal command<oper>
– Indicates the operation you want to do. The two most important values here are 0, which deactivates the traces, and 1, which enables them.<set_id>
– Decides which traces the modem will give. This works similar to how you can have different log levels for different libraries in the application. There are 5 different sets to choose from (1
to 5
), with the most commonly used one being 2. This is the set that will give us the most information.Sending the %XMODEMTRACE
AT command only sends the modem traces to the application core. From there, we need some way to get the trace out to us so we can read it.
The Modem library provides us with the necessary facilities through the Modem trace module.
Enabling the Kconfig CONFIG_NRF_MODEM_LIB_TRACE
will enable the module, start tracing, and forwards the modem traces to a backend. Enabling this Kconfig will also send the %XMODEMTRACE
AT command automatically at startup.
There are four available backends for modem tracing, that can all be enabled and configured using Snippets. Snippets are a way to apply common configurations separately when building an application.
nrf91-modem-trace-uart
snippet. Enables CONFIG_NRF_MODEM_LIB_TRACE
and chooses the Zephyr UART driver for the backend and enables UART1.nrf91-modem-trace-rtt
snippet. Enables CONFIG_NRF_MODEM_LIB_TRACE
and chooses RTT for the trace backend. nrf91-modem-trace-ext-flash
snippet. Enables CONFIG_NRF_MODEM_LIB_TRACE
, the flash backend and external flash and stores modem trace in a dedicated partition. Configure CONFIG_NRF_MODEM_LIB_TRACE_BACKEND_FLASH_PARTITION_SIZE
to change the partition size.nrf91-modem-trace-ram
snippet. Enables CONFIG_NRF_MODEM_LIB_TRACE
and configures it to store modem trace to a dedicated partition in RAM. Configure CONFIG_NRF_MODEM_LIB_TRACE_BACKEND_RAM_LENGTH
to change the partition size.We will cover how to add a snippet to the build in Exercise 1 of this lesson. For information on how to add a snippet to the build, see Snippets for an nRF91 Series device.
The default backend outputs the track on UART1
at a baudrate of 1000000
Now that the modem is sending traces to the application, and the application is sending the traces out of the SiP, we just need something to receive the traces. For this, any program that can read the data can be used, but we recommend using the Cellular Monitor application, which is part of the nRF Connect for Desktop. The program will not only capture a trace and store it on your computer, but it will also let you decode the trace.
Sometimes, not everything goes according to plan, and we need information about what happened.
We already know how to get debugging information from the application, through log output. However, in the case of the nRF91 Series, we also want debugging information from the modem core. For this reason, the modem core has the functionality to output a modem trace.
To get a modem trace, there are three steps that are needed:
Taking a modem trace from the nRF91 Series SiP requires no extra hardware, only the software tool described in this exercise.
The first step is achieved through the AT command AT%XMODEMTRACE
. This can be used both to activate and deactivate modem tracing in the modem.
The command has the following set command syntax
AT%XMODEMTRACE=<oper>,<set_id>
Terminal command<oper>
– Indicates the operation you want to do. The two most important values here are 0, which deactivates the traces, and 1, which enables them.<set_id>
– Decides which traces the modem will give. This works similar to how you can have different log levels for different libraries in the application. There are 5 different sets to choose from (1
to 5
), with the most commonly used one being 2. This is the set that will give us the most information.Sending the %XMODEMTRACE
AT command only sends the modem traces to the application core. From there, we need some way to get the trace out to us so we can read it.
The Modem library provides us with the necessary facilities through the Modem trace module.
Enabling the Kconfig CONFIG_NRF_MODEM_LIB_TRACE
will enable the module, start tracing, and forwards the modem traces to a backend. Enabling this Kconfig will also send the %XMODEMTRACE
AT command automatically at startup.
There are four available backends:
nrf91-modem-trace-uart
snippet.nrf91-modem-trace-rtt
snippet.nrf91-modem-trace-ext-flash
snippet.nrf91-modem-trace-ram
snippet.For information on how to add a snippet to the build, see Snippets for an nRF91 Series device.
The default backend outputs the track on UART1
at a baudrate of 1000000
Now that the modem is sending traces to the application, and the application is sending the traces out of the SiP, we just need something to receive the traces. For this, any program that can read the data can be used, but we recommend using the Cellular Monitor application, which is part of the nRF Connect for Desktop. The program will not only capture a trace and store it on your computer, but it will also let you decode the trace.
Sometimes, not everything goes according to plan, and we need information about what happened.
We already know how to get debugging information from the application, through log output. However, in the case of the nRF91 Series, we also want debugging information from the modem core. For this reason, the modem core has the functionality to output a modem trace.
To get a modem trace, there are three steps that are needed:
Taking a modem trace from the nRF91 Series SiP requires no extra hardware, only the software tool described in this exercise.
The first step is achieved through the AT command AT%XMODEMTRACE
. This can be used both to activate and deactivate modem tracing in the modem.
The command has the following set command syntax
AT%XMODEMTRACE=<oper>,<set_id>
Terminal command<oper>
– Indicates the operation you want to do. The two most important values here are 0, which deactivates the traces, and 1, which enables them.<set_id>
– Decides which traces the modem will give. This works similar to how you can have different log levels for different libraries in the application. There are 5 different sets to choose from (1
to 5
), with the most commonly used one being 2. This is the set that will give us the most information.Sending the %XMODEMTRACE
AT command only sends the modem traces to the application core. From there, we need some way to get the trace out to us so we can read it.
The Modem library provides us with the necessary facilities through the Modem trace module.
Enabling the Kconfig CONFIG_NRF_MODEM_LIB_TRACE
will enable the module, start tracing, and forwards the modem traces to a backend. Enabling this Kconfig will also send the %XMODEMTRACE
AT command automatically at startup.
There are three available backends:
nrf91-modem-trace-uart
snippet.nrf91-modem-trace-rtt
snippet.nrf91-modem-trace-ext-flash
snippet.For information on how to add a snippet to the build, see Snippets for an nRF91 Series device.
The default backend outputs the track on UART1
at a baudrate of 1000000
Now that the modem is sending traces to the application, and the application is sending the traces out of the SiP, we just need something to receive the traces. For this, any program that can read the data can be used, but we recommend using the Cellular Monitor application, which is part of the nRF Connect for Desktop. The program will not only capture a trace and store it on your computer, but it will also let you decode the trace.