How to re-purpose a nRF51802 board as PlatformIO - Arduino for development?

Hello everyone!

Recently I’ve been looking into creating a custom STM32 board and then using it with PlatformIO - Zephyr. However, I now have a several small minimal nRF51802 boards that I’m hoping to use as custom boards.

I’m trying to re-purpose a nRF51802 board that is no longer required. It was a board housed in a small plastic enclosure, attached to a 3M filtrete smart air filter. After changing the filter, I thought I’d open up the BT board and analyze it.

As shown below, the board (3cm x 3.5cm) is quite minimal design, running off a CR2032 battery, has the standard J-Link connector pads, and exposes two GPIOs. These are accessible from a small cutout on the board enclosure. I suspect the exposed GPIOs were probably used for a UART or I2C, or as standard GPIOs for some other diagnostic function.

3m_filtrete_smart_air_filter_bt_5

The board’s BT exposes several services, including a battery service, which is used to detect the battery life. The board sends BLE notifications to a 3M app as when to change filter, in addition, any other processing the board does to detect air quality or amount passing throw the filter.

According to the Nordic specs, the nRF51802 is an ultra-low power SoC, 32-bit ARM Cortex-MO with 256KB flash, 16KB RAM and BLE. It a low cost variant of the nRF51822 (used in BBC micro:bit, beacons & other BLE boards) with the same functionality but with 2dB less RX sensitivity.

What are my options to derive a custom board definition and reuse?

I can probably use the Nordic SDK but would prefer to use PlatformIO with either an Arduino core or Zephyr (though unlikely as nRF51802 isn’t a Zephyr supported SoC).

I didn’t see any Arduino core for the nRF51802 but was wondering if a nRF51822 Arduino core definition could re-used.

Can anyone with nRF51 experience or custom board development please chime in?

Other than using the Nordic SDK, Do you think that the nRF51802 board can be used with PlatformIO Arduino or Zephyr?

I have several these nRF51802 boards. So, if anyone (maxgerhardt?) is interested, I would be glad to share more info and forward one of the boards if anyone is up for a challenge! The reward would be a low board running, with ability to develop using PlatformIO with J-Link debugging.

Hello,

An update on a post I made back in Jan '21.

Yesterday I revisited the nRF51802 board with the CR2032 battery that was retrieved off one of several used furnace air filters. I decided to flash the nRF51802 using the nRF51 SDK, using both Arduino IDE and PlatformIO. As the nRF51802 (256kB Flash, 16kB RAM) is simply a lower cost version of the nRF51822, there is no reason as to why I shouldn’t be able to flash it.

Soldering wires to SWDIO/SWDCLK/GND/VCC and one of the exposed GPIO was a challenge. The two exposed GPIOs and VCC are part of the 3x2 pad that really should be used with a pogo pins connector. These are normally expensive and can be difficult to get. So, considering that the nRF51802 boards were free, I decided to try some delicate soldering.

I managed to solder the SWD & VCC pads except the GPIO pads came off. I ended up using one of the GPIO test points. On the next board, I’ll be a little more careful on the GPIO pads or purchase some pogo pins.

I connected an external RGB LED to one of the GPIOs and successfully flashed a BLE LED example in both Arduino IDE and PlatformIO.

Initially, I ran into issues using the nRF51802 board with PlatformIO. In Arduino IDE, there is an option to use “Generic nRF5” (nRF51802) and select chip version with 16kB RAM/256kB Flash & Softdevice “S110”.

In PlatformIO, /.platformio/packages/framework-arduinonordicnrf5/boards.txt has an entry for Generic_nRF51822 and /.platformio/packages/framework-arduinonordicnrf5/variants/Generic. However, there is no /.platformio/platforms.nordicnrf51/boards/generic.json.

I ended up creating a generic.json for the Generic_nRF51822 , based on one of the example json.

{
  "build": {
    "arduino":{
      "ldscript": "nrf51_xxaa.ld"
    },
    "core": "nRF5",
    "cpu": "cortex-m0",
    "extra_flags": "-DARDUINO_BBC_MICROBIT -DUSE_LFRC",
    "f_cpu": "16000000L",
    "mcu": "nrf51822",
    "variant": "Generic",
    "zephyr": {
       "variant": "generic_nrf51"
    }
  },
  "connectivity": [
    "bluetooth"
  ],
  "debug": {
    "onboard_tools": [
      "jlink"
    ],
    "svd_path": "nrf51.svd",
    "jlink_device": "nRF51822_xxAA"
  },
  "frameworks": [
    "arduino",
    "mbed",
    "zephyr"
  ],
  "name": "Generic nRF51",
  "upload": {
    "maximum_ram_size": 16384,
    "maximum_size": 262144,
    "protocol": "jlink",
    "protocols": [
      "cmsis-dap",
      "mbed",
      "jlink"
    ]
  },
  "url": "https://www.nordicsemi.com/Products/nRF51822",
  "vendor": "Nordic"
}

I was then able to compile & build a BLE LED example that used the Softdevice S110, and flash it with the ever reliable Segger J-Link Edu Mini.

Next up, test out a debug session!

With regard to the missing generic.json from platform-nordicnrf51 repo, I’ll raise an issue against it on GiitHub. It’ll assist anyone else attempting to use the Generic_nRF51822 for their projects.

I’ve opened up an issue against platform-nordicnrf51 repo.