Skip to content

Commit

Permalink
CHESTER: Add Debug article
Browse files Browse the repository at this point in the history
Signed-off-by: hubmartin <[email protected]>
  • Loading branch information
hubmartin committed Mar 22, 2024
1 parent 57c06be commit ac6f3f1
Show file tree
Hide file tree
Showing 7 changed files with 58 additions and 0 deletions.
57 changes: 57 additions & 0 deletions chester/firmware-sdk/debug.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
---
slug: debug
title: Debug
---
import Image from '@theme/IdealImage';

# Debug

Most of the code is possible to debug with Zephyr logging functions like `LOG_INF`, `LOG_HEXDUMP_INF` and others.

However, sometimes it is necessary to do proper low-level hardware debugging with single stepping and memory view.

You can easily do that with [**nRF Connect for VS Code**](https://marketplace.visualstudio.com/items?itemName=nordic-semiconductor.nrf-connect) extension in your VSCode.

![](debug/debugging.png)


## Install

In VSCode hit `Ctrl` + `P` and type `ext install nordic-semiconductor.nrf-connect`, hit enter.

## Debugging

1. Open the **nRF Connect for VS Code** extension, click `Open Existing Application` and choose a folder of the application, where you usually call `west build`.

![](debug/open-existing-application.png)

2. In the project `prj.conf` comment with `#` or **remove `CONFIG_CTR_BLE=y`. BLE is timing sensitive and when enabled, debugging don't work correctly.**

![](debug/disable-ble.png)

3. In the left panel in **Applications** section, click **+ Add build configuration**

4. In the **Board** option select `chester_nrf52840`. Set **Optimization level** to **Optimize for debugging (-Og)**. Then click **Build Configuration** button on the bottom. The project is built.

5. In the left panel in **Actions** click on the **Debug** and start debugging your code.

:::warning

Do not use **Erase board** or any other similar option. CHESTER uses UICR region to save serial number and communication keys. If you erase that, you will need to recover [**PIB data**](../developer-tools/command-line-tools.md#product-information-block).

For erasing the board use [**HARDWARIO CLI**](../developer-tools/command-line-tools.md) erase command which keeps the UICR regions.

:::

## Shell over RTT

In the **Connected devices** left panel, you can open RTT communication with the device. It uses channel 0 which is Zehpyr shell. You can type commands to the terminal. The second RTT channel with logs is not displayed here.

![](debug/rtt-shell.png)

## Threads

In the **NRF DEBUG** tab you can inspect threads and memory.

![](debug/nrf-debug.png)

Binary file added chester/firmware-sdk/debug/debugging.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added chester/firmware-sdk/debug/disable-ble.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added chester/firmware-sdk/debug/nrf-debug.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added chester/firmware-sdk/debug/rtt-shell.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions sidebars-chester.js
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,7 @@ const sidebars = {
'firmware-sdk/installation-on-windows',
'firmware-sdk/installation-in-virtualbox',
'firmware-sdk/build-and-deploy',
'firmware-sdk/debug',
'firmware-sdk/applications',
'firmware-sdk/samples',
'firmware-sdk/application-customization',
Expand Down

0 comments on commit ac6f3f1

Please sign in to comment.