Blinky nRF52

Updated on 13 October 2022
dev board Adafruit Feather Bluefruit
chip nRF52
This tutorial is more than 1 year old. If the steps below do not work, then please check the latest versions and the documentations of the individual tools used.

Before starting

Dependancies

Ensure the following dependancies are downloaded and available:

Code

Download code blinky-nrf52.ino
void setup() {
  Serial.begin(9600);
  while (!Serial) {}

  pinMode(LED_BUILTIN, OUTPUT);
}

void loop() {
  Serial.println("HIGH");
  digitalWrite(LED_BUILTIN, HIGH);
  delay(1000);

  Serial.println("LOW");
  digitalWrite(LED_BUILTIN, LOW);
  delay(1000);
}

Makefile

BOARD?=adafruit:nrf52:feather52832
PORT?=/dev/tty.SLAB_USBtoUART
BUILD=build
# Arduino CLI version 0.14.0 is used.

.PHONY: default lint all flash clean

default: lint all flash clean

lint:
	cpplint --extensions=ino --filter=-legal/copyright *.ino

all:
	arduino-cli compile --fqbn $(BOARD) --output-dir $(BUILD) ./

flash:
	adafruit-nrfutil dfu genpkg --dev-type 0x0052 --application $(BUILD)/*.hex dfu-package.zip
	adafruit-nrfutil dfu serial --package dfu-package.zip -p $(PORT) -b 115200

clean:
	rm -rf build
	rm dfu-package.zip

Prototype

A photo of the actual setup.

Blinky nRF52 prototype

Arduino IDE settings

Ensure the following IDE settings before flashing.

Blinky nRF52 Arduino IDE settings

Serial console

Serial output from the firmware.

Blinky nRF52 serial console

Description

Create a blinky LED with Adafruit Bluefruit nRF52 breakout board.

Ensure the boards URL is added in Arduino IDE / CLI:

https://www.adafruit.com/package_adafruit_index.json

To use command line arduino-cli, install Adafruit nRF52 nrfutil with pip3:

pip3 install --user adafruit-nrfutil

References

Watch