<commit_before># CircuitPython Port To The Nordic Semiconductor nRF52 Series

This is a port of CircuitPython to the Nordic Semiconductor nRF52 series of chips.

## Supported Features

* UART
* SPI
* LEDs
* Pins
* ADC
* I2C
* PWM
* Temperature
* RTC (Real Time Counter. Low-Power counter)
* BLE support including:
  * Peripheral role
  * Scanner role
  * _REPL over Bluetooth LE_ (optionally using WebBluetooth)
  * ubluepy: Bluetooth LE module for CircuitPython
  * 1 non-connectable advertiser while in connection

## Tested Hardware

* nRF52840
  * [PCA10056](http://www.nordicsemi.com/eng/Products/nRF52840-Preview-DK)

## Board Specific Instructions

For board-specific instructions on building and flashing CircuitPython, see
the following links:

> **NOTE**: These board specific readmes may be more up to date than the
  generic board-neutral documentation further down.

* Adafruit Feather nRF52840: `boards/feather_nrf52840_express/README.md`: 1MB Flash, 256KB SRAM
* Nordic PCA10056 (uses nRF52840): `boards/pca10056/README.md`
* MakerDiary NRF52840 MDK: `boards/makerdiary_nrf52840_mdk/README.md`

For all other board targets, see the generic notes below.

## Compile and Flash

Prerequisite steps for building the nrf port:

    git clone <URL>.git circuitpython
    cd circuitpython
    git submodule update --init
    make -C mpy-cross

To build and flash issue the following command inside the ports/nrf/ folder:

	make BOARD=pca10056
	make BOARD=pca10056 flash

## Compile and Flash with Bluetooth Stack

First prepare the bluetooth folder by downloading Bluetooth LE stacks and headers:

     ./bluetooth/download_ble_stack.sh

If the Bluetooth stacks has been downloaded, compile the target with the following command:

    make BOARD=pca10040 SD=s132

The **make sd** will trigger a flash of the bluetooth stack before that application is flashed. Note that **make sd** will perform a full erase of the chip, which could cause 3rd party bootloaders to also be wiped.

    make BOARD=pca10040 SD=s132 sd

Note: further tuning of features to include in bluetooth or even setting up the device to use REPL over Bluetooth can be configured in the `bluetooth_conf.h`.

## Target Boards and Make Flags

Target Board (BOARD)     | Bluetooth Stack (SD)    | Bluetooth Support      | Flash Util
-------------------------|-------------------------|------------------------|-------------------------------
pca10056                 | s140                    | Peripheral and Scanner | [Segger](#segger-targets)
feather_nrf52840_express | s140                    | Peripheral and Scanner | UF2 bootloader
makerdiary_nrf52840_mdk  | s140                    | Peripheral and Scanner | pyocd or ARM mbed DAPLink<commit_msg>Mention the MDK USB Dongle.<commit_after># CircuitPython Port To The Nordic Semiconductor nRF52 Series

This is a port of CircuitPython to the Nordic Semiconductor nRF52 series of chips.

## Supported Features

* UART
* SPI
* LEDs
* Pins
* ADC
* I2C
* PWM
* Temperature
* RTC (Real Time Counter. Low-Power counter)
* BLE support including:
  * Peripheral role
  * Scanner role
  * _REPL over Bluetooth LE_ (optionally using WebBluetooth)
  * ubluepy: Bluetooth LE module for CircuitPython
  * 1 non-connectable advertiser while in connection

## Tested Hardware

* nRF52840
  * [PCA10056](http://www.nordicsemi.com/eng/Products/nRF52840-Preview-DK)

## Board Specific Instructions

For board-specific instructions on building and flashing CircuitPython, see
the following links:

> **NOTE**: These board specific readmes may be more up to date than the
  generic board-neutral documentation further down.

* Adafruit Feather nRF52840: `boards/feather_nrf52840_express/README.md`: 1MB Flash, 256KB SRAM
* Nordic PCA10056 (uses nRF52840): `boards/pca10056/README.md`
* MakerDiary nRF52840 MDK: `boards/makerdiary_nrf52840_mdk/README.md`
* MakerDiary nRF52840 MDK USB Dongle: `boards/makerdiary_nrf52840_mdk_usb_dongle/README.md`

For all other board targets, see the generic notes below.

## Compile and Flash

Prerequisite steps for building the nrf port:

    git clone <URL>.git circuitpython
    cd circuitpython
    git submodule update --init
    make -C mpy-cross

To build and flash issue the following command inside the ports/nrf/ folder:

	make BOARD=pca10056
	make BOARD=pca10056 flash

## Compile and Flash with Bluetooth Stack

First prepare the bluetooth folder by downloading Bluetooth LE stacks and headers:

     ./bluetooth/download_ble_stack.sh

If the Bluetooth stacks has been downloaded, compile the target with the following command:

    make BOARD=pca10040 SD=s132

The **make sd** will trigger a flash of the bluetooth stack before that application is flashed. Note that **make sd** will perform a full erase of the chip, which could cause 3rd party bootloaders to also be wiped.

    make BOARD=pca10040 SD=s132 sd

Note: further tuning of features to include in bluetooth or even setting up the device to use REPL over Bluetooth can be configured in the `bluetooth_conf.h`.

## Target Boards and Make Flags

Target Board (BOARD)     | Bluetooth Stack (SD)    | Bluetooth Support      | Flash Util
-------------------------|-------------------------|------------------------|-------------------------------
pca10056                 | s140                    | Peripheral and Scanner | [Segger](#segger-targets)
feather_nrf52840_express | s140                    | Peripheral and Scanner | UF2 bootloader
makerdiary_nrf52840_mdk  | s140                    | Peripheral and Scanner | pyocd or ARM mbed DAPLink
makerdiary_nrf52840_mdk_usb_dongle | s140          | Peripheral and Scanner | DFU bootloader & nrfutil
{'fraction_non_alphanumeric': 0.09570898816881511, 'fraction_numerical': 0.04273353346282889, 'mean_word_length': 3.2174236783320924, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 6, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7206276', 'n_tokens_mistral': 1888, 'n_tokens_neox': 1613, 'n_words': 639}