Programming ATSAME51J19A

Hello all,

I am trying to use the Black Magic Probe to load firmware (.hex w/ bootloader) onto an ATSAME51J19A using a SWD header on a separate PCB. I have updated my BMP firmware as well as the PIO core (I am using the VSCode extension but am totally fine using the CLI). Why won’t it recognize the ‘blackmagic’ tool despite both documentations explicitly stating there is support? Will I have to set up a custom config for the MCU since its technically not the adafruit feather w/ can?

Here is my platformio.ini file:

platform = GitHub - platformio/platform-atmelsam: Atmel SAM: development platform for PlatformIO
board = adafruit_feather_m4_can
framework = arduino
debug_tool = blackmagic
debug_port = COM4
upload_port = COM4
upload_protocol = blackmagic

Here is my output:
Resolving adafruit_feather_m4_can dependencies…
Already up-to-date.
Updating metadata for the vscode IDE…
Error: Processing adafruit_feather_m4_can (platform: GitHub - platformio/platform-atmelsam: Atmel SAM: development platform for PlatformIO; board: adafruit_feather_m4_can; framework: arduino)

Verbose mode can be enabled via -v, --verbose option
DebugInvalidOptionsError: Unknown debug tool blackmagic. Please use one of atmel-ice, jlink or custom:
File “C:\Users\lkelley.platformio\penv\lib\site-packages\platformio\builder\”, line 175:
File “C:\Users\lkelley.platformio\packages\tool-scons\scons-local-4.5.2\SCons\Script\”, line 598:
return _SConscript(self.fs, *files, **subst_kw)
File “C:\Users\lkelley.platformio\packages\tool-scons\scons-local-4.5.2\SCons\Script\”, line 285:
exec(compile(scriptdata, scriptname, ‘exec’), call_stack[-1].globals)
File “C:\Users\lkelley.platformio\platforms\atmelsam@src-3902fa010271b7fd4b3fe129967364bc\builder\”, line 127:
target_elf = env.BuildProgram()
File “C:\Users\lkelley.platformio\packages\tool-scons\scons-local-4.5.2\SCons\Util\”, line 242:
return self.method(*nargs, **kwargs)
File “C:\Users\lkelley.platformio\penv\lib\site-packages\platformio\builder\tools\”, line 60:
File “C:\Users\lkelley.platformio\packages\tool-scons\scons-local-4.5.2\SCons\Util\”, line 242:
return self.method(*nargs, **kwargs)
File “C:\Users\lkelley.platformio\penv\lib\site-packages\platformio\builder\tools\”, line 110:
File “C:\Users\lkelley.platformio\packages\tool-scons\scons-local-4.5.2\SCons\Util\”, line 242:
return self.method(*nargs, **kwargs)
File “C:\Users\lkelley.platformio\penv\lib\site-packages\platformio\builder\tools\”, line 233:
File “C:\Users\lkelley.platformio\penv\lib\site-packages\platformio\builder\tools\”, line 197:
% board_config.get_debug_tool_name(env.GetProjectOption(“debug_tool”)),
File “C:\Users\lkelley.platformio\penv\lib\site-packages\platformio\platform\”, line 126:
raise DebugInvalidOptionsError(
========================== [FAILED] Took 0.86 seconds ==========================

It does mention the blackmagic tool, but it still depends on the platform and board definition whether they include it. E.g., blackmagic might be supported in PlatformIO for th STM32 platform, but not for others. And even when the platform supports it, the board definition might not.

However, in the case of Atmel SAM the platform itself does have support for it.

But the adafruit_feather_m4_can.json board definition doesn’t list it as available protocol.

So, what you can do is

  1. Experimentally edit your C:\Users\<user>\.platformio\platforms\atmelsam\boards\adafruit_feather_m4_can.json file and add "blackmagic" into the protocols array
  2. File an issue at Issues · platformio/platform-atmelsam · GitHub