PlatformIO Community

Cannot debug ledControl example of ArduinoBLE on mkr1010 with jlink plus probe

When I run ledControl example of ArduinoBLE library, is OK.
But when I debug, it stops at BLE.begin() with an exception.
Any idea about a solution?

image
image
image

Please file an issue at Issues · platformio/platform-atmelsam · GitHub, maybe the devs know more.

I bought the business support but I haven’t received an access yet. How do I ask for the access?
BTW the ‘stop the war’ banner is hiding the send button and I have to close the window and resume the topic to be able to press the Reply button. Not convenient.

CC @ivankravets

Indeed. Reloading the page a 3times fixes it ("Stop the war" banner makes it difficult to Reply to messages - #4 by ivankravets).

1 Like

Sorry, we will finally fix it :pray:

Do you have custom breakpoints in IDE?

No custom breakpoints

Let’s start with something simple:

  1. Could you debug the same project WITHOUT ArduinoBLE library?
  2. If “yes”, stop debugging, and open PlatformIO Core CLI and type:
pio debug --interface=gdb pio debug --interface gdb -x .pioinit

Where does it stop now?

The crash is somewhere related to the USB serial problem. I find a workaround:

  • first start the debugger. It will stop with an exception
  • now restart the debug (CTL+SHIFT+F5). Everything OK, Serial monitor is talking!
1 Like

Ah indeed, actually that was noticed 2 years ago too: Problems starting debug session with jlink on feather M0 - #6 by RoSchmi

But noone ever found the cause.

Removing the bootloader in the topic above helped though.

1 Like

Interestingly, the official Arduino guide does not include any steps with removing the bootloader. Could someone try Arduino IDE 2.0 and their simple example? Do you experience the same problems?

It seems like a board-related issue, not J-Link or PlatformIO.

I try on Arduino 2.0 rc6 with a simple loop. USB connection is OK if I put my breakpoint after the 1 sec delay. With platformio, it do not work with the same breakpoint.
If I put the breakpoint before the 1 sec delay, Arduino 2.0 loose USB connection also.
Looks like USB connection is reseted after debug start, then it needs some time to set up wit the target running. If a bkp is met before, the USB is not finalized in time and Window threw ‘USB not recorgnized’
image

Did you also disable the initial breakpoint in PlatformIO? See Debugging options — PlatformIO latest documentation

So, you can remove all breakpoints in IDE and set just the initial breakpoint to the loop:

debug_init_break = tbreak loop

Yes, I try but USB gives also the error. I also add a 5 sec delay but this doesn’t help.
image