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:
- 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.
The SWD interface is at the back of the Dongle, check up my comments at Nordic Forum.
-
After new bootloader is updated, the serial port COMx will be detected by Windows, you can use it to upload sketch later.
-
Under PlatformIO, create a project using Adafruit_feather_nrf52840 board.
-
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
-
Go to https://github.com/maxgerhardt/pio-community-nrf52-example/find/main to download the file “pca10059.json”.
-
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 ) -
Compile and upload sketch to the Dongle.
-
DONE
Special thanks to Mr. Maximilian Gerhardt for his guidance.
Hopes, this help.