boards: others: Introduce Pro Micro nRF52840 type

This introduces the pro micro nrf52840 board type,
commonly available as the cheapest nrf52840 development board,
and is based on the Nice!Nano

Signed-off-by: Camille BAUD <mail@massdriver.space>
This commit is contained in:
Camille BAUD 2024-10-21 18:41:55 +02:00 committed by Benjamin Cabé
parent 7bb5210e00
commit 0c3913962e
18 changed files with 573 additions and 0 deletions

View file

@ -0,0 +1,13 @@
# Copyright (c) 2024 MASSDRIVER EI (massdriver.space)
# SPDX-License-Identifier: Apache-2.0
if BOARD_PROMICRO_NRF52840
config BOARD_HAS_NRF5_BOOTLOADER
bool "Board has nRF5 bootloader"
default y
help
If selected, applications are linked so that they can be loaded by Nordic
nRF5 bootloader.
endif # BOARD_PROMICRO_NRF52840

View file

@ -0,0 +1,29 @@
# Copyright (c) 2024 MASSDRIVER EI (massdriver.space)
# Copyright (c) 2018-2023 Nordic Semiconductor ASA
#
# SPDX-License-Identifier: Apache-2.0
if BOARD_PROMICRO_NRF52840
source "boards/common/usb/Kconfig.cdc_acm_serial.defconfig"
# To let the nRF5 bootloader load an application, the application
# must be linked after Nordic MBR, that is factory-programmed on the board.
# Nordic nRF5 bootloader exists outside of the partitions specified in the
# DTS file, so we manually override FLASH_LOAD_OFFSET to link the application
# correctly, after Nordic MBR.
# When building MCUBoot, MCUBoot itself will select USE_DT_CODE_PARTITION
# which will make it link into the correct partition specified in DTS file,
# the offset is applied here so that the full partition size can be used when
# the bootloader Kconfig option has been disabled.
config FLASH_LOAD_OFFSET
default 0x1000
depends on BOARD_HAS_NRF5_BOOTLOADER && (MCUBOOT || !USE_DT_CODE_PARTITION)
config BT_CTLR
default BT
endif # BOARD_PROMICRO_NRF52840

View file

@ -0,0 +1,5 @@
# Copyright (c) 2024 MASSDRIVER EI (massdriver.space)
# SPDX-License-Identifier: Apache-2.0
config BOARD_PROMICRO_NRF52840
select SOC_NRF52840_QIAA

View file

@ -0,0 +1,9 @@
# SPDX-License-Identifier: Apache-2.0
board_runner_args(jlink "--device=nRF52840_xxAA" "--speed=4000")
board_runner_args(pyocd "--target=nrf52840" "--frequency=4000000")
if(CONFIG_BUILD_OUTPUT_UF2)
include(${ZEPHYR_BASE}/boards/common/uf2.board.cmake)
endif()
include(${ZEPHYR_BASE}/boards/common/jlink.board.cmake)
include(${ZEPHYR_BASE}/boards/common/pyocd.board.cmake)

View file

@ -0,0 +1,8 @@
board:
name: promicro_nrf52840
full_name: Pro Micro nRF52840
vendor: others
socs:
- name: nrf52840
variants:
- name: uf2

Binary file not shown.

After

Width:  |  Height:  |  Size: 33 KiB

View file

@ -0,0 +1,190 @@
.. _promicro_nrf52840_nrf52840:
Pro Micro nRF52840
##################
More of a board type than a unique board, It is based on Nice!Nano.
Also referred to as Pro Micro, Promicro, SuperMini nRF52840 boards.
Overview
********
The hardware provides support for the Nordic
Semiconductor nRF52840 ARM Cortex-M4F CPU and the following devices:
* :abbr:`ADC (Analog to Digital Converter)`
* CLOCK
* FLASH
* :abbr:`GPIO (General Purpose Input Output)`
* :abbr:`I2C (Inter-Integrated Circuit)`
* :abbr:`MPU (Memory Protection Unit)`
* :abbr:`NVIC (Nested Vectored Interrupt Controller)`
* :abbr:`PWM (Pulse Width Modulation)`
* RADIO (Bluetooth Low Energy and 802.15.4)
* :abbr:`RTC (nRF RTC System Clock)`
* :abbr:`SPI (Serial Peripheral Interface)`
* :abbr:`UART (Universal asynchronous receiver-transmitter)`
* :abbr:`USB (Universal Serial Bus)`
* :abbr:`WDT (Watchdog Timer)`
.. figure:: img/others_promicro_nrf52840.webp
:align: center
:alt: Tenstar Pro Micro nRF52840
Tenstar Pro Micro nRF5284
More information about the original board can be found at the
`Nice!Nano website`_.
Information about clones can be found at `Clone Wiki`_.
Pinout and Schematic are available in the `Nice!Nano Documentation`_
Supported Features
==================
The ``promicro_nrf52840/nrf52840`` board target supports the following
hardware features:
+-----------+------------+----------------------+
| Interface | Controller | Driver/Component |
+===========+============+======================+
| ADC | on-chip | adc |
+-----------+------------+----------------------+
| CLOCK | on-chip | clock_control |
+-----------+------------+----------------------+
| FLASH | on-chip | flash |
+-----------+------------+----------------------+
| GPIO | on-chip | gpio |
+-----------+------------+----------------------+
| I2C(M) | on-chip | i2c |
+-----------+------------+----------------------+
| MPU | on-chip | arch/arm |
+-----------+------------+----------------------+
| NVIC | on-chip | arch/arm |
+-----------+------------+----------------------+
| PWM | on-chip | pwm |
+-----------+------------+----------------------+
| RADIO | on-chip | Bluetooth, |
| | | ieee802154 |
+-----------+------------+----------------------+
| RTC | on-chip | system clock |
+-----------+------------+----------------------+
| SPI(M/S) | on-chip | spi |
+-----------+------------+----------------------+
| UART | on-chip | serial |
+-----------+------------+----------------------+
| USB | on-chip | usb |
+-----------+------------+----------------------+
| WDT | on-chip | watchdog |
+-----------+------------+----------------------+
Connections and IOs
===================
LED
---
* LED0 = P0.15, can be any color.
Programming and Debugging
*************************
Applications for the ``promicro_nrf52840/nrf52840`` board target can be
built in the usual way (see :ref:`build_an_application` for more details).
Flashing
========
The board is factory-programmed with Adafruit's UF2 booloader
#. Reset the board into the bootloader by bridging ground and RST 2 times
quickly
The status LED should start a fade pattern, signalling the bootloader is
running.
#. Compile a Zephyr application; we'll use :zephyr:code-sample:`blinky`.
.. zephyr-app-commands::
:app: zephyr/samples/basic/blinky
:board: promicro_nrf52840/nrf52840/uf2
:goals: build
#. Flash it onto the board. You may need to mount the device.
.. code-block:: console
west flash
When this command exits, observe the red LED on the board blinking,
Debugging
=========
You may debug this board using the broken out pads on the back.
PyOCD and openOCD can be used to flash and debug this board.
Recovery
========
In case of a error resulting in a board's bootloader becoming inaccessible,
it is possible to flash anything directly using openOCD:
#. Setup OpenOCD correctly, here for WCH linkE in ARM mode:
.. code-block:: console
openocd -f interface/cmsis-dap.cfg -f target/nrf52.cfg
Note interface and target folders are from openOCD's tcl folder.
#. Connect to openOCD, for example with telnet or GDB:
.. code-block:: console
telnet localhost 4444
.. code-block:: console
target extended-remote localhost:3333
#. Erase flash:
.. code-block:: console
reset halt
nrf5 mass_erase
or
.. code-block:: console
mon reset halt
mon nrf5 mass_erase
#. Flash Bootloader
.. code-block:: console
flash write_image erase nice_nano_bootloader-0.9.2_s140_6.1.1.hex
or
.. code-block:: console
mon flash write_image erase nice_nano_bootloader-0.9.2_s140_6.1.1.hex
References
**********
.. target-notes::
.. _Nice!Nano website:
https://nicekeyboards.com/docs/nice-nano/
.. _Clone Wiki:
https://github.com/joric/nrfmicro/wiki/Alternatives
.. _Nice!Nano Documentation:
https://nicekeyboards.com/docs/nice-nano/pinout-schematic

View file

@ -0,0 +1,7 @@
# Copyright (c) 2022 Nordic Semiconductor
# SPDX-License-Identifier: Apache-2.0
# Suppress "unique_unit_address_if_enabled" to handle the following overlaps:
# - power@40000000 & clock@40000000 & bprot@40000000
# - acl@4001e000 & flash-controller@4001e000
list(APPEND EXTRA_DTC_FLAGS "-Wno-unique_unit_address_if_enabled")

View file

@ -0,0 +1,81 @@
/*
* Copyright (c) 2024 MASSDRIVER EI (massdriver.space)
* SPDX-License-Identifier: Apache-2.0
*/
&pinctrl {
uart0_default: uart0_default {
group1 {
psels = <NRF_PSEL(UART_TX, 0, 9)>,
<NRF_PSEL(UART_RX, 0, 10)>;
};
};
uart0_sleep: uart0_sleep {
group1 {
psels = <NRF_PSEL(UART_TX, 0, 9)>,
<NRF_PSEL(UART_RX, 0, 10)>;
low-power-enable;
};
};
i2c0_default: i2c0_default {
group1 {
psels = <NRF_PSEL(TWIM_SDA, 1, 0)>,
<NRF_PSEL(TWIM_SCL, 0, 11)>;
};
};
i2c0_sleep: i2c0_sleep {
group1 {
psels = <NRF_PSEL(TWIM_SDA, 1, 0)>,
<NRF_PSEL(TWIM_SCL, 0, 11)>;
low-power-enable;
};
};
i2c1_default: i2c1_default {
group1 {
psels = <NRF_PSEL(TWIM_SDA, 1, 4)>,
<NRF_PSEL(TWIM_SCL, 1, 6)>;
};
};
i2c1_sleep: i2c1_sleep {
group1 {
psels = <NRF_PSEL(TWIM_SDA, 1, 4)>,
<NRF_PSEL(TWIM_SCL, 1, 6)>;
low-power-enable;
};
};
spi2_default: spi2_default {
group1 {
psels = <NRF_PSEL(SPIM_SCK, 1, 1)>,
<NRF_PSEL(SPIM_MOSI, 1, 2)>,
<NRF_PSEL(SPIM_MISO, 1, 7)>;
};
};
spi2_sleep: spi2_sleep {
group1 {
psels = <NRF_PSEL(SPIM_SCK, 1, 1)>,
<NRF_PSEL(SPIM_MOSI, 1, 2)>,
<NRF_PSEL(SPIM_MISO, 1, 7)>;
low-power-enable;
};
};
pwm0_default: pwm0_default {
group1 {
psels = <NRF_PSEL(PWM_OUT0, 0, 17)>;
};
};
pwm0_sleep: pwm0_sleep {
group1 {
psels = <NRF_PSEL(PWM_OUT0, 0, 17)>;
low-power-enable;
};
};
};

View file

@ -0,0 +1,20 @@
identifier: promicro_nrf52840/nrf52840
name: Pro Micro nRF52840
type: mcu
arch: arm
ram: 256
flash: 1024
toolchain:
- zephyr
- gnuarmemb
- xtools
supported:
- adc
- usb_device
- ble
- pwm
- spi
- watchdog
- counter
- netif:openthread
- gpio

View file

@ -0,0 +1,9 @@
/*
* Copyright (c) 2024 MASSDRIVER EI (massdriver.space)
*
* SPDX-License-Identifier: Apache-2.0
*/
/dts-v1/;
#include "promicro_nrf52840_nrf52840_common.dts"
#include <nordic/nrf52840_partition.dtsi>

View file

@ -0,0 +1,120 @@
/*
* Copyright (c) 2024 MASSDRIVER EI (massdriver.space)
* Copyright (c) 2018-2023 Nordic Semiconductor ASA
* Copyright (c) 2017 Linaro Limited
*
* SPDX-License-Identifier: Apache-2.0
*/
/dts-v1/;
#include <nordic/nrf52840_qiaa.dtsi>
#include "promicro_nrf52840-pinctrl.dtsi"
#include <zephyr/dt-bindings/input/input-event-codes.h>
/ {
model = "Pro Micro nRF52840";
compatible = "others,promicro-nrf52840";
chosen {
zephyr,sram = &sram0;
zephyr,flash = &flash0;
zephyr,ieee802154 = &ieee802154;
};
leds {
compatible = "gpio-leds";
led0: led_0 {
gpios = <&gpio0 15 GPIO_ACTIVE_HIGH>;
label = "Red LED";
};
};
pwmleds {
compatible = "pwm-leds";
red_pwm_led: led_pwm_0 {
pwms = <&pwm0 0 PWM_MSEC(20) PWM_POLARITY_INVERTED>;
label = "Red PWM LED";
};
};
aliases {
led0 = &led0;
pwm-led0 = &red_pwm_led;
red-pwm-led = &red_pwm_led;
bootloader-led0 = &led0;
mcuboot-led0 = &led0;
spi = &spi2;
watchdog0 = &wdt0;
};
};
&adc {
status = "okay";
};
&gpiote {
status = "okay";
};
&uicr {
nfct-pins-as-gpios;
gpio-as-nreset;
};
&gpio0 {
status = "okay";
};
&gpio1 {
status = "okay";
};
&uart0 {
compatible = "nordic,nrf-uarte";
status = "okay";
current-speed = <115200>;
pinctrl-0 = <&uart0_default>;
pinctrl-1 = <&uart0_sleep>;
pinctrl-names = "default", "sleep";
};
&i2c0 {
compatible = "nordic,nrf-twi";
status = "okay";
pinctrl-0 = <&i2c0_default>;
pinctrl-1 = <&i2c0_sleep>;
pinctrl-names = "default", "sleep";
};
&i2c1 {
compatible = "nordic,nrf-twi";
status = "okay";
pinctrl-0 = <&i2c1_default>;
pinctrl-1 = <&i2c1_sleep>;
pinctrl-names = "default", "sleep";
};
&pwm0 {
status = "okay";
pinctrl-0 = <&pwm0_default>;
pinctrl-1 = <&pwm0_sleep>;
pinctrl-names = "default", "sleep";
};
&spi2 {
compatible = "nordic,nrf-spi";
status = "okay";
pinctrl-0 = <&spi2_default>;
pinctrl-1 = <&spi2_sleep>;
pinctrl-names = "default", "sleep";
};
&ieee802154 {
status = "okay";
};
zephyr_udc0: &usbd {
status = "okay";
};
#include <../boards/common/usb/cdc_acm_serial.dtsi>

View file

@ -0,0 +1,16 @@
# SPDX-License-Identifier: Apache-2.0
# Enable MPU
CONFIG_ARM_MPU=y
# Enable hardware stack protection
CONFIG_HW_STACK_PROTECTION=y
# Enable GPIO
CONFIG_GPIO=y
# Board Kconfig.defconfig enables USB CDC ACM and should disable USB remote
# wakeup by default. It needs to be disabled here, because the USB nrfx
# driver always overwrites option from Kconfig mentioned above with the
# imply from CONFIG_USB_NRFX.
CONFIG_USB_DEVICE_REMOTE_WAKEUP=n

View file

@ -0,0 +1,9 @@
/*
* Copyright (c) 2024 MASSDRIVER EI (massdriver.space)
*
* SPDX-License-Identifier: Apache-2.0
*/
/dts-v1/;
#include "promicro_nrf52840_nrf52840_common.dts"
#include <nordic/nrf52840_partition_uf2_sdv6.dtsi>

View file

@ -0,0 +1,20 @@
identifier: promicro_nrf52840/nrf52840/uf2
name: Pro Micro nRF52840
type: mcu
arch: arm
ram: 256
flash: 1024
toolchain:
- zephyr
- gnuarmemb
- xtools
supported:
- adc
- usb_device
- ble
- pwm
- spi
- watchdog
- counter
- netif:openthread
- gpio

View file

@ -0,0 +1,23 @@
# SPDX-License-Identifier: Apache-2.0
# Enable MPU
CONFIG_ARM_MPU=y
# Enable hardware stack protection
CONFIG_HW_STACK_PROTECTION=y
# Enable GPIO
CONFIG_GPIO=y
# Board Kconfig.defconfig enables USB CDC ACM and should disable USB remote
# wakeup by default. It needs to be disabled here, because the USB nrfx
# driver always overwrites option from Kconfig mentioned above with the
# imply from CONFIG_USB_NRFX.
CONFIG_USB_DEVICE_REMOTE_WAKEUP=n
# Build UF2 by default, supported by the Adafruit nRF52 Bootloader
CONFIG_BUILD_OUTPUT_UF2=y
# UF2 Bootloader can use DT offset
CONFIG_BOARD_HAS_NRF5_BOOTLOADER=n
CONFIG_USE_DT_CODE_PARTITION=y

View file

@ -0,0 +1,7 @@
/*
* SPDX-License-Identifier: Apache-2.0
*
* Copyright (c) 2023 Benjamin Björnsson <benjamin.bjornsson@gmail.com>
*/
#include "nordic,nrf-saadc-common.dtsi"

View file

@ -0,0 +1,7 @@
/*
* SPDX-License-Identifier: Apache-2.0
*
* Copyright (c) 2023 Benjamin Björnsson <benjamin.bjornsson@gmail.com>
*/
#include "nordic,nrf-saadc-common.dtsi"