NRF52840: Difference between revisions

From RevSpace
Jump to navigation Jump to search
No edit summary
 
(12 intermediate revisions by the same user not shown)
Line 1: Line 1:
   {{Project
   {{Project
   |Name=NRF52840
   |Name=NRF52840
   |Picture=nopicture.jpg
   |Picture=nrf52840-supermini.png
   |Omschrijving=Investigating Arduino on inexpensive NRF52840 boards
   |Omschrijving=Running Arduino with platformio on NRF52840
   |Status=In progress
   |Status=In progress
   |Contact=bertrik
   |Contact=bertrik
Line 8: Line 8:


== Intro ==
== Intro ==
NRF52840 is potentially a very nice platform:
This page is about getting inexpensive NRF52840 boards to work with Arduino and platformio.
* low-power. quick wake-up
 
NRF52840 is a nice platform:
* 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?
** 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 ==
[[File:nrf52840-supermini-pinout.png|right|thumb|pinout]]


== Hardware ==
The boards I have are the "promicro" and "supermini".
The boards I have are the "promicro" and "supermini".
These boards look basically identical hardware-wise.
These boards look basically identical hardware-wise.
Line 43: Line 43:
The red LED appears to be under software control.
The red LED appears to be under software control.


=== promicro ===
Pinout/schematic: https://nicekeyboards.com/docs/nice-nano/pinout-schematic
 
=== bootloader ===
The INFO_UF2.TXT says (after double-tap reset):
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)
   UF2 Bootloader 0.6.0 lib/nrfx (v2.0.0) lib/tinyusb (0.10.1-41-gdf0cda2d) lib/uf2 (remotes/origin/configupdate-9-gadbb8c7)
Line 74: Line 76:
[509373.296933]  sdb:
[509373.296933]  sdb:
[509373.297002] sd 3:0:0:0: [sdb] Attached SCSI removable disk
[509373.297002] sd 3:0:0:0: [sdb] Attached SCSI removable disk
</pre>
=== 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:
<pre>
[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
</pre>
</pre>


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


Links:
Links:
Line 115: Line 86:
* Here is a wiki full of useful information on specific boards: https://github.com/joric/nrfmicro/wiki
* Here is a wiki full of useful information on specific boards: https://github.com/joric/nrfmicro/wiki
** Specifically the supermini https://github.com/joric/nrfmicro/wiki/Alternatives#supermini-nrf52840
** Specifically the supermini https://github.com/joric/nrfmicro/wiki/Alternatives#supermini-nrf52840
* See also https://github.com/pdcook/nRFMicro-Arduino-Core
* nRFMicro Arduino Core:
* https://github.com/ICantMakeThings/Nicenano-NRF52-Supermini-PlatformIO-Support
** Meant for integration with Arduino IDE, not platformio!
 
** See https://github.com/pdcook/nRFMicro-Arduino-Core
 
** Uses https://github.com/NordicSemiconductor/nrfx for NRF52840 specific drivers
 
* Platformio support for supermini:
My promicro board currently has bootloader 0.6.0:
** Focused on platformio
  UF2 Bootloader 0.6.0 lib/nrfx (v2.0.0) lib/tinyusb (0.10.1-41-gdf0cda2d) lib/uf2 (remotes/origin/configupdate-9-gadbb8c7)
** https://github.com/ICantMakeThings/Nicenano-NRF52-Supermini-PlatformIO-Support
  Model: nice!nano
** Bit awkward installation (copy/overwrite files inside existing platformio folder)
  Board-ID: nRF52840-nicenano
* https://docs.nordicsemi.com/bundle/ncs-3.1.0/page/zephyr/boards/others/promicro_nrf52840/doc/index.html pro-micro information from Nordic Semi
  SoftDevice: not found
  Date: Jun 19 2021
 
My supermini board came with bootloader 0.6.0:
  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: not found
  Date: Jun 19 2021


Getting 'circuitpython' to work:
Getting 'circuitpython' to work:

Latest revision as of 16:13, 12 January 2026

Project NRF52840
Running Arduino with platformio on NRF52840
Status In progress
Contact bertrik
Last Update 2026-01-12

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: