Exercise 1

Capturing a modem trace

In this exercise, we will use the Trace Collector v2 to capture a modem trace.

The application used in this exercise connects to a CoAP server over DTLS, just like we did in Lesson 5 Exercise 2. The difference is it also requests both PSM (with the values <Periodic-TAU> 8 hours and <Active-Timer> 16 seconds) and eDRX.

This will prepare us to debug problems by analyzing the trace, which we will do in Exercise 2.

Exercise Steps

1. 1. In the GitHub repository for this course, go to the base code for this exercise, found in lesson7/cellfund_less7_exer1.

2. Enable outputting modem traces in the application

Let’s tell the modem to give us a trace, by adding the following lines to the prj.conf file

2. Build and flash the project to your device.

3. Open nRF Connect for Desktop and install the Trace Collector v2 Preview application.

When it’s done installing, click Open.

4. In the upper left-hand corner select your device, in this case, the nRF9160 DK.

5. In the Trace Output Format section, select “PCAP”, as shown below.


If Wireshark is installed, you can also select “LIVE” to see the output from the trace as the application is running. This is very useful when actually debugging a problem in real time. However, as we are going to use the captured trace file in the next exercise, we use “PCAP” as that will save the trace to a file.

6. To start the tracing, select Start tracing in the window.

This window will appear to detect the modem firmware running on the modem core. This is to know which trace database file to use when deciphering the modem trace, as there are different ones for different versions.

When the window disappears, proceed to the next step.

7. To make sure the trace captures the beginning of the application, reset the device.

nRF9160 DK

Press the reset button, SW5, located here:


To reset the Thingy:91, turn the device off and on again.

You should now be able to see the file size increase when there is network activity.


If the file size is not increasing while the application is running, the modem tracing was likely not successful.

This could be for a number of reasons, for example that you haven’t enabled it in the Modem library (CONFIG_NRF_MODEM_LIB_TRACE) or that the application has crashed.

8. When the application has run for a few minutes, or until you’ve encountered the error you want to debug, press the Stop tracing button to stop the trace capture.

9. Click on the PCAP file name, to open a file browser window at the location where the trace was stored.

The trace will be the one most recently modified, and with the most recent time in the name.

In the next exercise, we will open the file in Wireshark to see the contents of the trace and explain parts of it.

The solution for this exercise can be found in lesson7/cellfund_less7_exer1_solution.

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

Forgot your password?
Enter your email address, and we will send a link to reset your password.