Head Tracker v2.2
HomeDonateGithubDiscord Chat
  • Head Tracker v2.2
    • Head Tracker v2.1
  • Getting Started
    • Hardware Required
    • Software Installation
      • Flashing Firmware
    • Wiring
      • Option 1- Bluetooth
        • Adding a FrSky BT Module
        • Checking Bluetooth Functionality?
      • Option 2 - Wired
        • Pulse Position Modulation (PPM)
          • Trainer Ports
        • Serial Bus (SBUS)
          • Radio Master TX16S Setup
          • FrSky Taranis X9D
      • Option 3 - Bridged
        • Radio Master TX16S Mk2
      • Analog Input
      • Digital Inputs
      • PPM Input
      • PWM Output
      • ELRS Setup
      • Flight Stick
    • Mounting
      • User Designed Cases
    • Structure of the Application
    • IMU, Calibration and Drift
    • Extended Servo Range
  • Settings
    • GUI Setup
      • Tilt / Roll / Pan
      • General
      • PPM
      • UART
      • Bluetooth
      • PWM
      • Analog & Aux
      • Aux
    • WebBLE
  • Radio Setup
    • How to Edit Documentation
    • Open/Edge TX
      • Color Screen Radios
        • TX16S Example
      • Black and White Radios
    • Jeti
    • Spektrum
      • NX
      • DX
        • DX18
    • Flysky
    • Frsky - Ethos
  • Videos
    • YouTube
  • Support
    • Discord Chat
    • Issues
    • Development
      • Firmware using GitPod.io
      • Firmware using West
        • Debugging
      • GUI (Qt6)
      • Git Workflow and Actions
      • Supported Boards
        • Arduino Nano 33 BLE
          • IMU Sensor Chip
      • Depreciated
        • Firmware (Depreciated)
          • Debugging (Depreciated)
        • GUI (Qt5, Depreciated)
  • Links
    • Download
    • GitHub Page
    • RC Groups Forum
Powered by GitBook
On this page
  • Wiring
  • Be sure to firmly secure the wires on the bottom
  • Debugging using Visual Studio Code, Cortex-Debug and West
  • Debugging with an ESP-PROG via OCD
  1. Support
  2. Development
  3. Firmware using West

Debugging

PreviousFirmware using WestNextGUI (Qt6)

Last updated 1 year ago

This code is getting pretty complicated to be testing with print statements. Since the code runs on a Real time operating system (Zephyr) the processor with be doing a lot of context switches (jumping to different parts of code) it can be difficult to diagnose an issue without a debugger, sometimes even with a debugger :) A print statement badly placed can actually cause a fault. This is why you will need a debugger board if you want to dig deeper into any microcontroller project.

I am using a JLink. The education edition to be more specific which is free for open source use. Full size debugger or mini will work. You should also be able to use a Blackmagic probe and possibly others, but I will not cover that here. The EDU(cation) edition is very well priced and can be found from your favorite electronics suppliers. If you want to work with closed source you cannot use the EDU, and should purchase the full blown version.

Download and install Jlink Software and Docs Package. Follow install guide

Wiring

To wire the debugger to the Nano 33 BLE you will need to solder 5 small wires onto the back of the Nano 33 BLE. Following these guides.

Be sure to firmly secure the wires on the bottom

Highly suggested to use some hot glue and firmly secure the wires that are soldered onto the bottom. I glued the bottom and the bread board at the tie-wrap. Since you are constantly rotating the board around it's pretty easy to rip the small traces off the bottom. This is how my first Nano died.

Debugging using Visual Studio Code, Cortex-Debug and West

Be sure you have Jlink software and Cortex-Debug extension installed in vscode. Some tasks and launch tasks have been setup for some boards in firmware/src/headtracker.code-workspace file. You can use them as a guide to modify or add new ones.

"cortex-debug.JLinkGDBServerPath": "C:/Program Files/SEGGER/JLink",

is set properly.

The pre-launch task is set to compile the code in debug mode before launch continues. After it's successfully build it will upload the code and run.

Debugging with an ESP-PROG via OCD

TO BE COMPLETED On start it always breaks at the code entry point, void main(). Click the Blue play icon to continue execution.

You can add breakpoints wherever you wish, place the red breakpoint dot beside the line to break at.

When the code goes to execute this line it will pause, you can inspect variables, etc.

If your this far through the guide you probably already have an idea how a debugger works! Happy coding. Be sure to create pull requests and submit your changes. Happy coding!

Check in your settings.json in VScode make sure that your path for

Remove and build folder from ht/firmware/src/build before starting or switching boards. Choose the launch task from the list you want.

SEGGER - The Embedded Experts - Downloads - J-Link / J-Trace
Logo
JLink EDU - Full Size
JLink Edu - Mini
EDU Full Size. IOT shown, but is the same connections as BLE version.
EDU Mini Connection