Error: Unknown upload protocol stlink

Hi everyone!

I’ve recently installed platformio in VScode (OSX) and have setup a new blinky project, using the adafruit nrf52 feather and am trying to flash the device using STLINK. (Using openocd CLI I can see the target device and interact with it)

I follow the docs for platformio.ini as follows:

[env:adafruit_feather_nrf52840]
platform = nordicnrf52
board = adafruit_feather_nrf52840
framework = arduino
upload_protocol = stlink

When I hit build, the code complies fine however I get the following error:

Warning! Unknown upload protocol stlink

I tried using an old nucleo board and compiling a blinky to stm32 hoping it would download the stlink protocol, but no luck.

Here’s the result of pio update:

Updating tool-scons                      @ 2.20501.190826 [Up-to-date]
Updating tool-unity                      @ 1.20403.0      [Up-to-date]
Updating contrib-pysite                  @ 2.27.190418    [Up-to-date]
Updating contrib-piohome                 @ 2.3.3          [Up-to-date]
Updating tool-pioplus                    @ 2.5.5          [Up-to-date]

Platform Manager
================
Platform Nordic nRF52
--------
Updating nordicnrf52                     @ 3.7.0          [Up-to-date]
Updating tool-sreccat                    @ 1.164.0        [Up-to-date]
Updating tool-nrfjprog                   @ 1.90702.1      [Up-to-date]
Updating tool-openocd                    @ 2.1000.190707  [Up-to-date]
Updating toolchain-gccarmnoneeabi        @ 1.70201.0      [Up-to-date]
Updating framework-arduinoadafruitnrf52  @ 1.1300.190829  [Up-to-date]

Platform ST STM32
--------
Updating ststm32                         @ 5.6.0          [Up-to-date]
Updating tool-stm32duino                 @ 1.0.1          [Up-to-date]
Updating tool-dfuutil                    @ 1.9.190708     [Up-to-date]
Updating framework-arduinoststm32        @ 3.10601.190716 [Up-to-date]
Updating toolchain-gccarmnoneeabi        @ 1.70201.0      [Up-to-date]
Updating tool-openocd                    @ 2.1000.190707  [Up-to-date]

And pio upgrade:

You're up-to-date!
PlatformIO 4.0.3 is currently the newest version available.

How can I configure platformio in vs code to find/use/download stlink?

PlatformIO does not support stlink upload for this board

https://docs.platformio.org/en/latest/boards/nordicnrf52/adafruit_feather_nrf52840.html#uploading

Though it does understand stlink for other boards and has code to handle it.

So you might try to add "stlink" to the protocols array here:

This file is in your PIO home folder /Users/<user>/.platformio/platforms/nordicnrf52/boards/adafruit_feather_nrf52840.json.

1 Like

Solved! Thank you so much :slight_smile:

1 Like

Out of curiosity… any particular reason to use stlink when the adafruit_feather_nrf52840 has an onboard jlink debugger probe already?

Seems like the “onboard_debug_tools” info in the JSON is wrong, at least I can’t see any JLink device on the board itself…

Also the FAQ section tells you that you need a JLink in order to debug it. The standard for firmware uploading is, as the overview page says

We pre-programed the chip with our UF2 bootloader, which can use either commandline UART programming with nrfutil (we use this for Arduino) or drag-n-drop mass storage, for CircuitPython installation and also because mass-storage-drive bootloaders make updating firmware so easy.

Woopsie… that makes it 2-Nil for PIO… both the board.json AND the PIO board documentation are wrong then… :open_mouth:

Adafruit Feather nRF52840 Express has on-board debug probe and IS READY for debugging. You don’t need to use/buy external debug probe.

^^ Er… no… you still need the debugger… it just has the 2x5 header so it’s debug friendly… I just hate it when the documentation is wrong! :man_facepalming:

https://docs.platformio.org/en/latest/boards/nordicnrf52/adafruit_feather_nrf52840.html#debugging

It looks like valeros fixed up the board definitions two weeks ago … but didn’t update the docs to match. Looks like another PR to write later today :wink:

yep, it’s actually a custom board based on the Adafruit feather - that’s why :slight_smile:

1 Like

Thanks! Fixed in Add ST-Link support for all boards · platformio/platform-nordicnrf52@42b0e8f · GitHub