NRF52840: Difference between revisions

From RevSpace
Jump to navigation Jump to search
Line 10: Line 10:
This page is about getting inexpensive NRF52840 boards to work with Arduino and platformio.
This page is about getting inexpensive NRF52840 boards to work with Arduino and platformio.


NRF52840 is potentially a very nice platform:
NRF52840 is a nice platform:
* low-power. quick wake-up
* low-power
* inexpensive
* inexpensive
* decent amount of flash (1024k), RAM (256k) and CPU cycles (64 MHz)
* decent amount of flash (1024k), RAM (256k) and CPU cycles (64 MHz)
* support various radio protocols like zigbee, ble, thread, matter, enhanced shockburst
* support various radio protocols like zigbee, ble, thread, enhanced shockburst
* built-in support for quadrature counting
* built-in support for quadrature counting
* looks like it can run arduino too
* can run arduino too


However the eco-system of inexpensive boards is a complicated landscape:
However the eco-system of inexpensive boards is a complicated landscape:
* AliExpress sellers offer "promicro" and "supermini" board with unclear characteristics
* AliExpress sellers offer "promicro" and "supermini" board with unclear characteristics
* LEDs are often swapped (blue = hardware charge, red = software led?)
* LEDs are sometimes swapped (blue = hardware charge, red = software led?)
* Various firmware upload interface options (which one to use?):
* Various firmware upload interface options (which one to use?):
** Using nrfutil, sends a .zip file containing various parts
** Using nrfutil, sends a .zip file containing various parts, over USB-serial
** Serial DFU, used by nrfutil?
** Mass storage UF2, activated using the double-reset
** Mass storage UF2, possibly activated using the double-reset
** SWD debug interface (requires soldering!)
** SWD debug interface (requires soldering!)
* Confusing situation regarding bootloaders:
* Confusing situation regarding bootloaders:
** Most boards seem to come with a modified version of a bootloader meant for another type of board
** Most boards seem to come with a modified version of a bootloader meant for another type of board
** Type of bootloader depends on type of firmware you want to run, "ZMK", Arduino using Arduino IDE, Arduino using platformio
** Type of bootloader depends on type of firmware you want to run, "ZMK", Arduino using Arduino IDE, Arduino using platformio
** Space for "SoftDevice" needs to be reserved, what is this? -> it's a kind of binary blob implementing the bluetooth low-energy stack
** Risk of accidentally overwriting the bootloader, with UF2 flash offsets sometimes being absolute, sometimes being relative
** Risk of accidentally overwriting the bootloader, with UF2 flash offsets sometimes being absolute, sometimes being relative



Revision as of 07:41, 5 January 2026

Project NRF52840
File:Nopicture.jpg
Investigating Arduino on inexpensive NRF52840 boards
Status In progress
Contact bertrik
Last Update 2026-01-05

Intro

This page is about getting inexpensive NRF52840 boards to work with Arduino and platformio.

NRF52840 is a nice platform:

  • low-power
  • inexpensive
  • decent amount of flash (1024k), RAM (256k) and CPU cycles (64 MHz)
  • support various radio protocols like zigbee, ble, thread, enhanced shockburst
  • built-in support for quadrature counting
  • can run arduino too

However the eco-system of inexpensive boards is a complicated landscape:

  • AliExpress sellers offer "promicro" and "supermini" board with unclear characteristics
  • LEDs are sometimes swapped (blue = hardware charge, red = software led?)
  • Various firmware upload interface options (which one to use?):
    • Using nrfutil, sends a .zip file containing various parts, over USB-serial
    • Mass storage UF2, activated using the double-reset
    • SWD debug interface (requires soldering!)
  • Confusing situation regarding bootloaders:
    • Most boards seem to come with a modified version of a bootloader meant for another type of board
    • Type of bootloader depends on type of firmware you want to run, "ZMK", Arduino using Arduino IDE, Arduino using platformio
    • Risk of accidentally overwriting the bootloader, with UF2 flash offsets sometimes being absolute, sometimes being relative

Hardware

pinout

The boards I have are the "promicro" and "supermini". These boards look basically identical hardware-wise.

There is a 4-pad connector to program it using SWD (VDD/SWD/SDC/GND). This can be used to write the bootloader for example. The pads have a spacing of 1.5mm.

The blue LED appears to flash independently of software, this is probably the charge circuit behaving randomly without a battery present. The red LED appears to be under software control.

Pinout/schematic: https://nicekeyboards.com/docs/nice-nano/pinout-schematic

bootloader

The INFO_UF2.TXT says (after double-tap reset):

 UF2 Bootloader 0.6.0 lib/nrfx (v2.0.0) lib/tinyusb (0.10.1-41-gdf0cda2d) lib/uf2 (remotes/origin/configupdate-9-gadbb8c7)
 Model: nice!nano
 Board-ID: nRF52840-nicenano
 SoftDevice: S140 version 6.1.1
 Date: Jun 19 2021

The CURRENT.UF2 file is 1.4 MB

Kernel log says:

[509372.005339] usb 1-2.3: new full-speed USB device number 96 using xhci_hcd
[509372.132351] usb 1-2.3: New USB device found, idVendor=239a, idProduct=00b3, bcdDevice= 1.00
[509372.132361] usb 1-2.3: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[509372.132364] usb 1-2.3: Product: nice!nano
[509372.132366] usb 1-2.3: Manufacturer: Nice Keyboards
[509372.132368] usb 1-2.3: SerialNumber: 98D93A272A6CCC7D
[509372.187474] cdc_acm 1-2.3:1.0: ttyACM0: USB ACM device
[509372.190177] usb-storage 1-2.3:1.2: USB Mass Storage device detected
[509372.190467] scsi host3: usb-storage 1-2.3:1.2
[509373.200470] scsi host3: scsi scan: INQUIRY result too short (5), using 36
[509373.200481] scsi 3:0:0:0: Direct-Access     Adafruit nRF UF2          1.0  PQ: 0 ANSI: 2
[509373.200825] sd 3:0:0:0: Attached scsi generic sg0 type 0
[509373.202317] sd 3:0:0:0: [sdb] 65801 512-byte logical blocks: (33.7 MB/32.1 MiB)
[509373.202556] sd 3:0:0:0: [sdb] Write Protect is off
[509373.202559] sd 3:0:0:0: [sdb] Mode Sense: 03 00 00 00
[509373.202782] sd 3:0:0:0: [sdb] No Caching mode page found
[509373.202784] sd 3:0:0:0: [sdb] Assuming drive cache: write through
[509373.296933]  sdb:
[509373.297002] sd 3:0:0:0: [sdb] Attached SCSI removable disk

Software

Working platformio example project for the nice!nano and supermini/promicro nrf52840 clones: https://github.com/bertrik/nicenano-example

Links:

Getting 'circuitpython' to work: