nRF52840 Dongle board support

I’m a new user of Platform IO for IoT development (Arduino, ESP32/ESP8266, NRF52840 Dongle, and STM32 boards).

I’ve been using the Nordic NRF52840 USB Dongle as an inexpensive development board with nRF Connect (Nordic bootloader) & Nordic SDK , Arduino (Adafruit bootloader) and PlatformIO (Zephyr & DFU upload). The PlatformIO - Zephyr combination works fine with a custom DFU upload script from PlatformIO Explorer & CLI but it would be really nice to have an official nrf52840dongle board support.

Are there any plans to have an official Platform board support for the nrf52840dongle?
I’d be interested if anyone is working towards that goal? A lot of folks will benefit.

btw - PlatformIO rocks! Thank you making PlatformIO a fantastic solution for embedded development!

Issue already tracked in Add support for the Nordic nRF52840 USB dongle · Issue #68 · platformio/platform-nordicnrf52 · GitHub with custom user support available in the comments.

What’s the PlatformIO explorer? :smiley:

Also for reference for other users, what platformio.ini do you use to work the with dongle?

I meant the PlatformIO UI.

Thanks! I’ll checkout the link and give

Here’s the platformio.ini tha I use with the nRF52840 dongle. A script is used to flash the firmware with nrfutil.

[env:nrf52840_dongle]
platform = nordicnrf52
board = nrf52840_dk
framework = zephyr
board_build.zephyr.variant = nrf52840dongle_nrf52840
extra_scripts = dfu_upload.py
upload_protocol = custom

1 Like

hi,

May I know how you select the board “nRF52840_dongle” under PlatformIO IDE ?

I can set the URL GitHub - jpconstantineau/Community_nRF52_Arduino: Community Add-on to the Adafruit_nRF52_Arduino Board Support Package under Arduino IDE\Preferences but really no idea how to add to PlatformIO IDE.

Please advise.

Refer to PlatformIO IDE support · Issue #20 · jpconstantineau/Community_nRF52_Arduino · GitHub for your question.

When developing code for nRF52840_dongle with Zephyr RTOS, I use the following configuration in PlatformIO to flash nRF52840_dongle in DFU mode.

platform.ini

[env:nrf52840_dongle]
platform = nordicnrf52
board = nrf52840_dk
framework = zephyr
board_build.zephyr.variant = nrf52840dongle_nrf52840
extra_scripts = dfu_upload.py
upload_protocol = custom

with dfu_upload.py script:

import sys
import os
from os.path import basename
Import("env")

platform = env.PioPlatform()

def dfu_upload(source, target, env):
    firmware_path = str(source[0])
    firmware_name = basename(firmware_path)

    print("Upload to nrf52840 dongle.")
    print("firmware_path = ",firmware_path)
    print("firmware_name = ",firmware_name)

    genpkg = "".join(["nrfutil pkg generate --hw-version 52 --sd-req=0x00 --application ", firmware_path, " --application-version 1 firmware.zip"])
    dfupkg = "nrfutil dfu serial -pkg firmware.zip -p /dev/cu.usbmodemE39E0C51DFFA1 -b 115200"
    print( genpkg )
    os.system( genpkg )
    os.system( dfupkg )

    print("Uploading done.")


# Custom upload command and program name
env.Replace(PROGNAME="firmware", UPLOADCMD=dfu_upload)

Replace /dev/cu.usbmodemE39E0C51DFFA1 with your nRF52840_dongle device (use ls /dev/cu* to list and identify the dongle).

@zpm1066 do you also have a version of this for Arduino framework?

Hi @tranks27, Welcome to the fantastic PlatformIO community!

In Arduino IDE, you can modify pca10056 (Nordic nRF52840DK) variant files for the nRF52840 dongle.

/Users/<user>/Library/Arduino15/packages/adafruit/hardware/nrf52/1.3.0/variants/pca10056

You may only need to change pca10056/variant.h for the I2C / SPI and LEDs pin allocations.

HI @zpm1066, I was referring to the Arduino Framework alternative to Zephyr. I’m also using the Platformio IDE.

For PlatformIO (macOS), you can modify pca10056/variant.h in

/Users/<user>/.platformio/packages/framework-arduinoadafruitnrf52/variants/pca10056

1 Like