PlatformIO Community

Using Nordic nRF52840 Dongle under Arduino framework with PlatformIO VSCode

After stranded around, eventually found the solution to compile and upload sketch to Nordic nRF52840 Dongle under PlatformIO and functioning correctly. I decided to put some explanation here so can help you to facilitate the learning process.

Adding nRF52840 Dongle (PCA10059) to PlatformIO:

  1. First, you have to update the bootloader of Nordic nRF52840 Dongle with Adafruit Feather 52840 bootloader using either Arduino IDE or PlatformIO with J-Link EDU ( DON’T USE CLONE J-LINK, IT WON’T WORK ) as shown below.

image

The SWD interface is at the back of the Dongle, check up my comments at Nordic Forum.

  1. After new bootloader is updated, the serial port COMx will be detected by Windows, you can use it to upload sketch later.

  2. Under PlatformIO, create a project using Adafruit_feather_nrf52840 board.

  3. Edit the platformio.ini, add or changed the red highlighted text below:

         [env:adafruit_feather_nrf52840]
         platform = nordicnrf52@5.0.1
         board = pca10059
         framework = arduino
         ;upload_protocol = jlink
         ;debug_tool = jlink
         upload_port = COM15
         upload_speed = 115200
         platform_packages =
             framework-arduinoadafruitnrf52@https://github.com/jpconstantineau/Community_nRF52_Arduino.git#0.1.21
         lib_deps = 
             SPI
             rweather/Crypto@^0.2.0
             adafruit/Adafruit MLX90614 Library@^2.1.3
             adafruit/Adafruit BusIO@^1.9.8
    
  4. Go to https://github.com/maxgerhardt/pio-community-nrf52-example/find/main to download the file “pca10059.json”.

  5. Copy the file “pca10059.json” into “C:.platformio\platforms\nordicnrf52@5.0.1\boards”.
    ( NOTE: The folder “**C:.platformio**” may be under “C:\Users…platformio” at your PC )

  6. Compile and upload sketch to the Dongle.

  7. DONE

Special thanks to Mr. Maximilian Gerhardt for his guidance.

Hopes, this help.

This question is exactly what I wanted to ask. Thanks for the notes. However, I’m not sure how to update the bootloader. Did you mean just connecting the dongle with the J-link? In that case, I don’t have a J-link EDU.

hi,

You have to use the genuine Segger J-Link ( Hardware version 11 ) from the link below to burn the bootloader, the FDTI USB is to burn application ( flash ).

Segger J-Link EDU ( for none commercial ) and J-Link Base ( for commercial ) were the same features, just the usage is different.

Segger J-Link ( Hardware version 11 )

The clone J-Link in the market will not work.

After you have the Segger J-Link hardware programmer, you will find the options to burn your bootloader under the PlatformIO.

The world is shortage of raw materials, aside paying for high price to get the Segger J-Link hardware, common sellers like Digikey, Element14 or even from Octopart, I cannot find one available and no new stock date as well.

1 Like

Segger Edu Mini (US$18) also works fine but make sure it is a genuine Segger J-Link probe.

1 Like

I’m currently using the nrf52840 DK board connected to the dongle via SWD interface to burn the bootloader. The link you posted was for burning bootloader on an adafruit board. Is that exactly the same procedure for burning bootloader on the dongle ( PCA10059)?

For the dongle, are these settings correct?
image

hi,

The one at Adafruit forum is for nRF52832 only because Mr. Maximilian Gerhardt who created the Arduino wrapper header for Nordic nRF52840 or PCA10059 that time, only works under PlatformIO which automatically downloading the corresponding and latest bootloader (based on Adafruit bootloader) for PCA10059. You need the wrapper header to compile so the GPIO pins work correctly.

By the time you reading this, hopefully the latest Arduino IDE covers the Nordic nRF52840 dongle.

I have moved my embedded development to PlatformIO and I still love the Arduino IDE, either old or new version as I also started from there. For stable, easy maintenance and deployment, I have chosen PlatformIO.

1 Like

@rickygai After the adafruit bootloader is burnt on the dongle, does it still flash red LED in bootloader mode?