Segger J-link, Adafruit Metro M4 -> USB dies when debug starts

Hello,

I just got a Segger J link to help troubleshoot a project I’m working on. The hardware is an Adafruit Metro M4 Grand Central (xpost at Adafruit forum).

I am using the Jlink upload protocol, and that works great.

When I start a debug session the controller starts up OK, and the setup breakpoint is hit (I configured “debug_init_break = tbreak setup”). But roughly at the same time I get the Windows ding-dong noise and an error pops up that an unrecognized USB device is connected.

The debug session then never gets out of some low level wait loop (occasionally when I hit pause, it shows some serial related code). So I’m guessing the two are related.

Any thoughts on what might be going on here?

TX!
Bas

Since the USB is handled by the main micro it makes sense that it would disconnect from WIndows when the micro stops at a breakpoint.

Additionally, when debugging you may need to configure it to use the no boot loader linker script if the boot loader doesn’t stick around when the J-Link flashes the application for debugging. You can do that by adding this to your configuration:

board_upload.offset_address = 0x00000000
board_build.arduino.ldscript = flash_without_bootloader.ld

This tells it to flash at 0x00000000 (normally the boot loader lives here) and tells it to compile such that the application addresses start at 0x00000000.

2 Likes

Hi Ryan,

Awesome, I uploaded the code without a bootloader (I found this very helpful post) and my windows serial port still stays disappeared (it shows as an “Unknown USB device (Device descriptor request failed)”.

I’m brand new to this, so your other hint was also super helpful. I removed all breakpoints and now I can get into the serial console when I start the code!

Much appreciated!!!

Bas

Awesome! I’m glad I could help.