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.

Exercise 1

v2.8.x – v2.7.0

Capturing a modem trace

In this exercise, we will use the Cellular Monitor 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. In the GitHub repository for this course, go to the base code for this exercise, found in l7/l7_e1 of whichever version directory you are using.

2. Enable outputting modem traces in the application.

2.1 Add a build configuration and select whichever board you are using

2.2 Under Snippets, select Add Snippet, search for nrf91-modem-trace-uart, select it then click Ok.

2.3 Scroll down and select Build Configuration.

3. Flash the project to your device.

When the build is done, flash the application to your device.

4. Open nRF Connect for Desktop and the Cellular Monitor application.

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

6. Configure the Trace Options, before beginning the trace.

In the sidebar on the left, under Trace Options, make sure both “Reset device on start” and “Save trace file to disk” are enabled.

Trace database, the default option is Autoselect, where the Cellular Monitor detects which modem firmware version is running on the device. If you get an error like below, the application isn’t able to detect this, and you should select the version manually.

Error when creating trace: unable to locate db directory plugin path: C:\Users\<user>\.nrfconnect-apps\node_modules\pc-nrfconnect-cellularmonitor\node_modules\@nordicsemiconductor\nrf-monitor-lib-js\Release\win32-x64\nrfml-insight-source.nrfml, the app
Terminal

Note

If Wireshark is already installed, you can also enable “Open in Wireshark” to see the output from the trace as the application is running. This is very useful when actually debugging a problem in real-time.

7. To start the tracing, select the Start button at the top of the sidebar.

If the trace capturing is successful, the file size of the trace should be increasing and there should be incoming commands in the Packet Event Viewer.

The Packet Event Viewer underneath the dashboard displays the incoming commands from the modem on the AT, RRC, NAS and IP levels. Make sure LIVE is enabled to see the incoming commands in real-time.

Important

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 modem tracing in the application or that the application has crashed.

8. View the log output from the application while tracing.

When capturing a trace, it’s useful to monitor the log output from the application simultaneously. To do this, click on the Open Serial Terminal button in the sidebar, which will launch the Serial Terminal application already connected to your device and display the output.

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

To find out where the trace is stored, click on the trace name in RAW file name under Trace Options.

Note

When sharing the trace file with Nordic Semiconductor for debugging assistance, make sure that this is the file you send (.mtrace or .bin) as it contains more information than the file type (.pcap) that we will open in Wireshark in the next exercise.

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 l7/l7_e1_sol of whichever version directory you are using.

v2.6.2 – v2.4.0

Capturing a modem trace

In this exercise, we will use the Cellular Monitor 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. In the GitHub repository for this course, go to the base code for this exercise, found in l7/l7_e1 of whichever version directory you are using.

2. Enable outputting modem traces in the application and include the AT Host library.

Let’s tell the modem to give us a trace, by enabling CONFIG_NRF_MODEM_LIB_TRACE.

In addition, include the AT Host library so that Cellular Monitor can send AT commands to the modem.

CONFIG_NRF_MODEM_LIB_TRACE=y
CONFIG_AT_HOST_LIBRARY=y
Kconfig

2. Build and flash the project to your device.

3. Open nRF Connect for Desktop and the Cellular Monitor application.

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

5. Configure the Trace Options, before beginning the trace.

In the sidebar on the left, under Trace Options, make sure both “Reset device on start” and “Save trace file to disk” are enabled.

Note

If Wireshark is already installed, you can also enable “Open in Wireshark” to see the output from the trace as the application is running. This is very useful when actually debugging a problem in real-time.

6. To start the tracing, select the Start button at the top of the sidebar.

If the trace capturing is successful, the file size of the trace should be increasing and there should be incoming commands in the Packet Event Viewer.

The Packet Event Viewer underneath the dashboard displays the incoming commands from the modem on the AT, RRC, NAS and IP levels. Make sure LIVE is enabled to see the incoming commands in real-time.

Important

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.

7. View the log output from the application while tracing.

When capturing a trace, it’s useful to monitor the log output from the application simultaneously. To do this, click on the Open Serial Terminal button in the sidebar, which will launch the Serial Terminal application already connected to your device and display the output.

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

To find out where the trace is stored, click on the trace name in RAW file name under Trace Options.

Note

When sharing the trace file with Nordic Semiconductor for debugging assistance, make sure that this is the file you send (.mtrace or .bin) as it contains more information than the file type (.pcap) that we will open in Wireshark in the next exercise.

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 l7/l7_e1_sol of whichever version directory you are using.

v2.3.0 – v2.2.0

Capturing a modem trace

In this exercise, we will use the Cellular Monitor 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. In the GitHub repository for this course, go to the base code for this exercise, found in l7/l7_e1 of whichever version directory you are using.

2. Enable outputting modem traces in the application and include the AT Host library.

Let’s tell the modem to give us a trace, by enabling CONFIG_NRF_MODEM_LIB_TRACE.

In addition, include the AT Host library so that Cellular Monitor can send AT commands to the modem.

CONFIG_NRF_MODEM_LIB_TRACE=y
CONFIG_AT_HOST_LIBRARY=y
Kconfig

2. Build and flash the project to your device.

3. Open nRF Connect for Desktop and the Cellular Monitor application.

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

5. Configure the Trace Options, before beginning the trace.

In the sidebar on the left, under Trace Options, make sure both “Reset device on start” and “Save trace file to disk” are enabled.

Note

If Wireshark is already installed, you can also enable “Open in Wireshark” to see the output from the trace as the application is running. This is very useful when actually debugging a problem in real-time.

6. To start the tracing, select the Start button at the top of the sidebar.

If the trace capturing is successful, the file size of the trace should be increasing and there should be incoming commands in the Packet Event Viewer.

The Packet Event Viewer underneath the dashboard displays the incoming commands from the modem on the AT, RRC, NAS and IP levels. Make sure LIVE is enabled to see the incoming commands in real-time.

Important

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.

7. View the log output from the application while tracing.

When capturing a trace, it’s useful to monitor the log output from the application simultaneously. To do this, click on the Open Serial Terminal button in the sidebar, which will launch the Serial Terminal application already connected to your device and display the output.

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

To find out where the trace is stored, click on the trace name in RAW file name under Trace Options.

Note

When sharing the trace file with Nordic Semiconductor for debugging assistance, make sure that this is the file you send (.mtrace or .bin) as it contains more information than the file type (.pcap) that we will open in Wireshark in the next exercise.

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 l7/l7_e1_sol of whichever version directory you are using.

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.