Feedback
Feedback

If you are having issues with the exercises, please create a ticket on DevZone: devzone.nordicsemi.com
Click or drag files to this area to upload. You can upload up to 2 files.

Modem trace

v2.8.x – v2.7.0

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:

  1. Tell the modem to give us a trace.
  2. Because the modem does not have an interface to send the trace over, we need the application core to forward it to us.
  3. Finally, we need to decode the trace so that we can read it.

Note

Taking a modem trace from the nRF91 Series SiP requires no extra hardware, only the software tool described in this exercise.

Telling the modem

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.

Forwarding from the modem

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.

  • UART: Configured with nrf91-modem-trace-uart snippet. Enables CONFIG_NRF_MODEM_LIB_TRACE and chooses the Zephyr UART driver for the backend and enables UART1.
  • RTT: Configured with nrf91-modem-trace-rtt snippet. Enables CONFIG_NRF_MODEM_LIB_TRACE and chooses RTT for the trace backend.
  • Flash: Configured with 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.
  • RAM: Configured with 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

Decoding the trace

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.

v2.6.2 – v2.4.0

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:

  1. Tell the modem to give us a trace.
  2. Because the modem does not have an interface to send the trace over, we need the application core to forward it to us.
  3. Finally, we need to decode the trace so that we can read it.

Note

Taking a modem trace from the nRF91 Series SiP requires no extra hardware, only the software tool described in this exercise.

Telling the modem

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.

Forwarding from the modem

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:

  • UART – used to send modem traces over UART, enabled by adding the nrf91-modem-trace-uart snippet.
  • RTT – used to send modem traces over SEGGER RTT, enabled by adding the nrf91-modem-trace-rtt snippet.
  • Flash – used to write modem traces to external fash, enabled by adding the nrf91-modem-trace-ext-flash snippet.
  • RAM – used to write modem traces to RAM buffer, enabled by adding the 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

Decoding the trace

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.

v2.3.0 – v2.2.0

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:

  1. Tell the modem to give us a trace.
  2. Because the modem does not have an interface to send the trace over, we need the application core to forward it to us.
  3. Finally, we need to decode the trace so that we can read it.

Note

Taking a modem trace from the nRF91 Series SiP requires no extra hardware, only the software tool described in this exercise.

Telling the modem

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.

Forwarding from the modem

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:

  • UART (v2.1.0 and up) – used to send modem traces over UART, enabled by adding the nrf91-modem-trace-uart snippet.
  • RTT (v2.1.0 and up) – used to send modem traces over SEGGER RTT, enabled by adding the nrf91-modem-trace-rtt snippet.
  • Flash (v2.3.0 and up) – used to write modem traces to external fash, enabled by adding the 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

Decoding the trace

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.

Register an account
Already have an account? Log in
(All fields are required unless specified optional)

  • 8 or more characters
  • Upper and lower case letters
  • At least one number or special character

Forgot your password?
Enter the email associated with your account, and we will send you a link to reset your password.