Nordic Semiconductor · NRF52840-DK
nRF52840 DK
Nordic nRF52840 DK: an nRF52840 (Cortex-M4F, Bluetooth LE, Thread, Zigbee) with an on-board J-Link and Arduino Uno headers.
In short
nRF52840 development kit: one 64 MHz Cortex-M4F, 256 KB RAM, 1 MB flash, Bluetooth LE and 802.15.4. No CAN controller: CAN goes through an MCP2515 shield on the Arduino header (SPI on D13/D11/D12, CS D10, INT D2).
Specs
From the board’s model in the store.
- Processor
- nRF52840 · 1× Cortex-M4F · chip "nrf52840"
- Clock
- 64 MHz
- Flash
- 1 MB
- RAM
- 256 KB
- GPIO pins
- 33
- ADC
- SAADC 8 ch 12-bit
- Logic level
- 3 V
- Power
- 5 V USB (in); VDD (Arduino power header, 3.0 V): 3 V; 5 V (Arduino power header): 5 V
- Current per pin
- not in the board’s model yet
- Buses
- UART ×2, I²C ×2, SPI ×4, USB ×1
- On any pin
- UART, I²C, SPI, PWM
- Runs
- bare metal (no OS)
Pin map
Each pin by what it does. Hover or tap a pin to see what else it can be.
- Power 3
- Digital 14
- Analog 5
- Bus 10
- Control 4
- P0_02P0_02
- P0_03P0_03
- P0_04P0_04
- P0_11P0_11
- P0_12P0_12
- P0_13P0_13
- P0_14P0_14
- P0_15P0_15
- P0_16P0_16
- P0_24P0_24
- P0_25P0_25
- P0_26P0_26
- P0_27P0_27
- P0_28P0_28
- P0_29P0_29
- P0_30P0_30
- P0_31P0_31
- P1_00P1_00
- P1_01P1_01
- P1_02P1_02
- P1_03P1_03
- P1_04P1_04
- P1_05P1_05
- P1_06P1_06
- P1_07P1_07
- P1_08P1_08
- P1_09P1_09
- P1_10P1_10
- P1_11P1_11
- P1_12P1_12
- P1_13P1_13
- P1_14P1_14
- P1_15P1_15
- pwr5 V USB
- vddVDD (Arduino power header, 3.0 V)
- v55 V (Arduino power header)
Watch out
What archec checks for this board, from its data. Each one names the check that catches it.
Its pins work at 3 V. A 5 V sensor’s output on one of them needs a level shifter between them.
check
pin-levelThe board already uses P0_13 (Green LED 0 (on when low)), P0_14 (Green LED 1 (on when low)), P0_15 (Green LED 2 (on when low)), P0_16 (Green LED 3 (on when low)), P0_11 (Push button switch 0 (low when pressed)), P0_12 (Push button switch 1 (low when pressed)), P0_24 (Push button switch 2 (low when pressed)), P0_25 (Push button switch 3 (low when pressed)). Something else wired there fights with it.
check
pin-conflictIt gives 3 V (VDD (Arduino power header, 3.0 V)), 5 V (5 V (Arduino power header)). Power each part from a rail at its own voltage.
check
board-supplyIt has 2 UART, 2 I²C, 4 SPI. One more bus of a kind than that is an error.
check
board-peripheral
First model
A blink for this board: the board, an LED and a part that turns it over every 500 ms. archec checks it, then writes the code on the right.
project Blink "Blink" {
version "0.1.0"
edition "1.0"
uses arche-hw-store "^0.1"
}
include "arche-hw-store/boards/nrf52840-dk/nrf52840-dk.arche"
include "arche-hw-store/devices/led/led.arche"
/// Turns the LED over at each step.
component Blinker "Blinker" {
out led: requires Led
fn blink "Blink" {
```arche
led.toggle()
```
wcet 50us
}
}
/// The board, an LED on the board's Green LED 0 (on when low) (P0_13), and the blinker.
system Hw "Blink" {
part board: Nrf52840DK
part led: GpioLed { in pin { pins { pin P0_13 } } }
part blinker: Blinker
blinker.led -> led.led
}
/// The firmware: the blinker every 500 ms.
deployment OnBoard "On the board" {
system Hw
platform Hw
binary blink on board {
thread main "Blink" { runs blinker; period 500ms; step blink }
}
}
//! Your code: the state and behaviour of this part. Write it between the USER CODE markers:
//! when the model changes, `archec gen` writes this file again around them (a new function, a
//! new input) and keeps them. Edit outside them and the file is yours: it is left as it is,
//! and the compiler says what to add (a new trait method).
#[allow(unused_imports)]
use crate::arche::*;
// @arche blinker main.arche:25 part
/// blinker
#[derive(Default)]
pub struct Blinker {}
impl BlinkerBehaviour for Blinker {
// @arche blinker.blink main.arche:13 fn
async fn blink(&mut self, _out: &BlinkerOut) {
// Blink: from the model (```arche)
_out.call_led_toggle().await;
}
}blink/src/app/blinker.rs, one of the 16 files archec writes.