J-Link as debugger

Firmware/software/electronics/mechanics
Post Reply
danteppc
Beginner
Posts: 8
Joined: Tue Mar 09, 2021 9:41 am

J-Link as debugger

Post by danteppc »

Hello,

I've been trying to make a JTAG debugger work with Crazyflie 2.1, so far without success.

The device is called "Atmel SAM-ICE", its interface is SEGGER J-Link, I followed instructions on this page:

https://wiki.bitcraze.io/doc:crazyflie:dev:starting

I was able to flash the firmware, however, as for debugging in VSCode, I get this error:

CONSOLE:

Code: Select all

Please check OUTPUT tab (Adapter Output) for output from openocd
Launching server: "openocd" "-c" "gdb_port 50000" "-s" "/Users/mahyar/Developer/Crazyflie/Firmware/crazyflie-firmware" "-f" "interface/jlink.cfg" "-f" "target/stm32f4x.cfg"
OUTPUT:

Code: Select all

Open On-Chip Debugger 0.11.0
Licensed under GNU GPL v2
For bug reports, read
	http://openocd.org/doc/doxygen/bugs.html
Info : auto-selecting first available session transport "jtag". To override use 'transport select <transport>'.
Info : Listening on port 6666 for tcl connections
Info : Listening on port 4444 for telnet connections
Info : J-Link ARM V8 compiled Aug 26 2015 15:08:21
Info : Hardware version: 8.00
Info : VTarget = 2.963 V
Info : clock speed 2000 kHz
Error: JTAG scan chain interrogation failed: all zeroes
Error: Check JTAG interface, timings, target power, etc.
Error: Trying to use configured scan chain anyway...
Error: stm32f4x.cpu: IR capture error; saw 0x00 not 0x01
Warn : Bypassing JTAG setup events due to errors
Error: Invalid ACK (0) in DAP response 
CONFIG:

Code: Select all

{
    "window.zoomLevel": 0,
    "editor.fontSize": 18,
    "dafny.basePath": "/Users/mahyar/.vscode/extensions/correctnesslab.dafny-vscode-0.18.0/dafny/dafny",
    "python.pythonPath": "/Applications/Xcode.app/Contents/Developer/usr/bin/python3",
    "workbench.colorTheme": "Default Light+",
    "launch": {
        "configurations": [

            {
                "name": "Cortex Debug",
                "cwd": "${workspaceRoot}",
                "executable": "./cf2.elf",
                "request": "launch",
                "type": "cortex-debug",
                "device": "STM32F405",
                "svdFile": "STM32F405.svd",
                "servertype": "openocd",
                "configFiles": ["interface/jlink.cfg", "target/stm32f4x.cfg"],
                "runToMain": true,
                "preLaunchCommands": [
                    "set mem inaccessible-by-default off",
                    "enable breakpoint",
                    "monitor reset"
                ]
            }
        ]
    },
    "C_Cpp.updateChannel": "Insiders"
}
I'm going slightly mad...
jtag.jpg
jonasdn
Expert
Posts: 132
Joined: Mon Mar 01, 2021 3:13 pm

Re: J-Link as debugger

Post by jonasdn »

Hi danteppc!

I have no tried this myself and do not have any SEGGER J-Link available, so I am a bit in the dark here :)

But maybe you could try with the Segger JLinkGDB instead of openocd? https://www.segger.com/products/debug-p ... db-server/

There is some docs of how to connect that with VS Code as well: https://wiki.segger.com/J-Link_Visual_Studio_Code
danteppc
Beginner
Posts: 8
Joined: Tue Mar 09, 2021 9:41 am

Re: J-Link as debugger

Post by danteppc »

Thanks for the links! actually the "JLink software" does not officially support STM32F405RG, however, I followed the guide on setting up Eclipse here:

https://www.bitcraze.io/documentation/r ... debugging/

and I used the command

Code: Select all

openocd -f jlink_stm32.cfg
on this file:

Code: Select all

# openocd setup

source [find interface/jlink.cfg]
transport select swd

source [find target/stm32f4x.cfg]
Now it's working and I'm able to debug!!
jonasdn
Expert
Posts: 132
Joined: Mon Mar 01, 2021 3:13 pm

Re: J-Link as debugger

Post by jonasdn »

Excellent! Happy hacking!
Post Reply