NRF52840: Difference between revisions

From RevSpace
Jump to navigation Jump to search
No edit summary
 
(7 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 ==
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 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?
** 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 ==
[[File:nrf52840-supermini-pinout.png|right|thumb|pinout]]
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 46: Line 45:
Pinout/schematic: https://nicekeyboards.com/docs/nice-nano/pinout-schematic
Pinout/schematic: https://nicekeyboards.com/docs/nice-nano/pinout-schematic


=== promicro ===
=== 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 79: Line 78:
</pre>
</pre>


=== supermini ===
== Software ==
The bag that it came in, says "Nice Nano V2.0" and "Pro Micro".
Working platformio example project for the nice!nano and supermini/promicro nrf52840 clones:
https://github.com/bertrik/nicenano-example


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>
== Software ==
Links:
Links:
* Nordic technical documentation: https://docs.nordicsemi.com/category/nrf52840-category
* Nordic technical documentation: https://docs.nordicsemi.com/category/nrf52840-category
Line 131: Line 100:
* HOWEVER, it also says "On nRF boards, CircuitPython 8.2.0 and later require UF2 bootloader version 0.6.1 or later. Older bootloaders cannot load the firmware. See Update UF2 Bootloader below.". Guess what bootloader came with my board ... 0.6.0
* HOWEVER, it also says "On nRF boards, CircuitPython 8.2.0 and later require UF2 bootloader version 0.6.1 or later. Older bootloaders cannot load the firmware. See Update UF2 Bootloader below.". Guess what bootloader came with my board ... 0.6.0
* They point you to https://github.com/adafruit/Adafruit_nRF52_Bootloader/releases/tag/0.9.2 but now what!?!!!
* They point you to https://github.com/adafruit/Adafruit_nRF52_Bootloader/releases/tag/0.9.2 but now what!?!!!
=== Arduino adafruit platform ===
To be figured out:
* Does this typically use the serial DFU, or the UF2?
platformio.ini
<pre>
...
</pre>

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: