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

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.

Depending on which nRF Connect SDK version you are using, there are up to four available backends:

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.