PlatformIO Community

Troubles starting debug session on SAMD device using JLink probe

I’m trying to upload and debug a custom board using Jlink, but the target did not start correctly and doesn’t stop on the set breakpoints after starting a new Debug session.

My setup is as follows:

  • OSX 10.14.6
  • PIO core: 4.3.1, Home: 3.1.1
  • Debugger: Jlink (Edu) connected with SWD port
  • Target Mcu: ATSAMC21E18A (Cortex-M0+ comparable to the ATSAMD21G18 on the Arduino Zero and Adafruit Feather M0 board)
  • Framework: Atmel ASF 4.0, included by the usage of this Library: https://github.com/JelleRoets/AtmelStart_PlatformIO

Compiling and uploading works fine, the target correctly executes the program.
However when starting a debug session the target did not seem to startup or reset correctly since nothing happens.

I found some workaround: When I press the reset button manually after the debug session has started, the target application starts to run correctly (but doesn’t stop at the set breakpoints). When I now clear and reset the breakpoints, the target does stop at the breakpoint!

Any clues what’s going on and how to fix this problem?
Can I do something similar to a reset button press with some (gdb) command? Or is the reset function / vector incorrectly set by the ASF framework?

Hi @JelleRoets! It’s quite hard to guess, is there anything interesting in the debug output? It looks like you’re using a custom board? Are you using standard SWD pinout? Is the nRST pin connected?