NRF52840: Difference between revisions

From RevSpace
Jump to navigation Jump to search
 
(One intermediate revision by the same user not shown)
Line 8: Line 8:


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


NRF52840 is potentially a very nice platform:
NRF52840 is potentially a very nice platform:
Line 29: Line 29:
** 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?
** 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
** Even multiple levels of bootloader? Like the normal one during application and another one using the double-reset method?


== Hardware ==
== Hardware ==
Line 113: Line 112:


== Software ==
== Software ==
Working example project for the nice!nano and supermini/promicro nrf52840 clones:
https://github.com/bertrik/nicenano-example
Links:
Links:
* Nordic technical documentation: https://docs.nordicsemi.com/category/nrf52840-category
* Nordic technical documentation: https://docs.nordicsemi.com/category/nrf52840-category

Latest revision as of 22:16, 1 December 2025

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

Intro

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

NRF52840 is potentially a very nice platform:

  • low-power. quick wake-up
  • inexpensive
  • decent amount of flash (1024k), RAM (256k) and CPU cycles (64 MHz)
  • support various radio protocols like zigbee, ble, thread, matter, enhanced shockburst
  • built-in support for quadrature counting
  • looks like it 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 often 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
    • Serial DFU, used by nrfutil?
    • Mass storage UF2, possibly 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
    • 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

Hardware

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

promicro

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

supermini

The bag that it came in, says "Nice Nano V2.0" and "Pro Micro".

The INFO_UF2.TXT says:

 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

Kernel log says:

[509738.557683] usb 1-2.3: new full-speed USB device number 97 using xhci_hcd
[509738.684319] usb 1-2.3: New USB device found, idVendor=239a, idProduct=00b3, bcdDevice= 1.00
[509738.684329] usb 1-2.3: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[509738.684332] usb 1-2.3: Product: nice!nano
[509738.684335] usb 1-2.3: Manufacturer: Nice Keyboards
[509738.684337] usb 1-2.3: SerialNumber: C06AD6DDE508BCD6
[509738.747638] cdc_acm 1-2.3:1.0: ttyACM0: USB ACM device
[509738.750113] usb-storage 1-2.3:1.2: USB Mass Storage device detected
[509738.750535] scsi host3: usb-storage 1-2.3:1.2
[509739.783832] scsi host3: scsi scan: INQUIRY result too short (5), using 36
[509739.783842] scsi 3:0:0:0: Direct-Access     Adafruit nRF UF2          1.0  PQ: 0 ANSI: 2
[509739.784177] sd 3:0:0:0: Attached scsi generic sg0 type 0
[509739.785504] sd 3:0:0:0: [sdb] 65801 512-byte logical blocks: (33.7 MB/32.1 MiB)
[509739.785712] sd 3:0:0:0: [sdb] Write Protect is off
[509739.785713] sd 3:0:0:0: [sdb] Mode Sense: 03 00 00 00
[509739.785916] sd 3:0:0:0: [sdb] No Caching mode page found
[509739.785918] sd 3:0:0:0: [sdb] Assuming drive cache: write through
[509739.861761]  sdb:
[509739.861829] sd 3:0:0:0: [sdb] Attached SCSI removable disk

Software

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

Links:

Getting 'circuitpython' to work:

Arduino adafruit platform

To be figured out:

  • Does this typically use the serial DFU, or the UF2?

platformio.ini

...