From 82c6d7c415a8bcc2f8ec8f8a771e17771a14ff68 Mon Sep 17 00:00:00 2001 From: Emil Obalski Date: Tue, 16 Jul 2019 15:51:36 +0200 Subject: [PATCH] boards: nordic: Add support for nRF52833_pca10100 board This commit adds support for nRF52833 development board. Changes afffects: - Introduce files related to board description. - Add blank documentation file (for future update). - configuration files for build process. Signed-off-by: Emil Obalski --- boards/arm/nrf52833_pca10100/Kconfig | 14 ++ boards/arm/nrf52833_pca10100/Kconfig.board | 9 + .../arm/nrf52833_pca10100/Kconfig.defconfig | 63 +++++ boards/arm/nrf52833_pca10100/board.cmake | 9 + boards/arm/nrf52833_pca10100/doc/index.rst | 221 ++++++++++++++++ .../nrf52833_pca10100/nrf52833_pca10100.dts | 238 ++++++++++++++++++ .../nrf52833_pca10100/nrf52833_pca10100.yaml | 17 ++ .../nrf52833_pca10100_defconfig | 27 ++ 8 files changed, 598 insertions(+) create mode 100644 boards/arm/nrf52833_pca10100/Kconfig create mode 100644 boards/arm/nrf52833_pca10100/Kconfig.board create mode 100644 boards/arm/nrf52833_pca10100/Kconfig.defconfig create mode 100644 boards/arm/nrf52833_pca10100/board.cmake create mode 100644 boards/arm/nrf52833_pca10100/doc/index.rst create mode 100644 boards/arm/nrf52833_pca10100/nrf52833_pca10100.dts create mode 100644 boards/arm/nrf52833_pca10100/nrf52833_pca10100.yaml create mode 100644 boards/arm/nrf52833_pca10100/nrf52833_pca10100_defconfig diff --git a/boards/arm/nrf52833_pca10100/Kconfig b/boards/arm/nrf52833_pca10100/Kconfig new file mode 100644 index 00000000000..43c3c2814ca --- /dev/null +++ b/boards/arm/nrf52833_pca10100/Kconfig @@ -0,0 +1,14 @@ +# Kconfig - nRF52833 PCA10100 board configuration +# +# Copyright (c) 2019 Nordic Semiconductor ASA +# +# SPDX-License-Identifier: Apache-2.0 + +if BOARD_NRF52833_PCA10100 + +config BOARD_ENABLE_DCDC + bool "Enable DCDC mode" + select SOC_DCDC_NRF52X + default y + +endif # BOARD_NRF52833_PCA10100 diff --git a/boards/arm/nrf52833_pca10100/Kconfig.board b/boards/arm/nrf52833_pca10100/Kconfig.board new file mode 100644 index 00000000000..f8aee0dd511 --- /dev/null +++ b/boards/arm/nrf52833_pca10100/Kconfig.board @@ -0,0 +1,9 @@ +# Kconfig - nRF52833 PCA10100 board configuration +# +# Copyright (c) 2019 Nordic Semiconductor ASA +# +# SPDX-License-Identifier: Apache-2.0 + +config BOARD_NRF52833_PCA10100 + bool "NRF52833 PCA10100" + depends on SOC_NRF52833_QIAA diff --git a/boards/arm/nrf52833_pca10100/Kconfig.defconfig b/boards/arm/nrf52833_pca10100/Kconfig.defconfig new file mode 100644 index 00000000000..90f212f2d6a --- /dev/null +++ b/boards/arm/nrf52833_pca10100/Kconfig.defconfig @@ -0,0 +1,63 @@ +# Kconfig - nRF52833 PCA10100 board configuration +# +# Copyright (c) 2019 Nordic Semiconductor ASA +# +# SPDX-License-Identifier: Apache-2.0 + +if BOARD_NRF52833_PCA10100 + +config BOARD + default "nrf52833_pca10100" + +if ADC + +config ADC_0 + default y + +endif # ADC + +if I2C + +config I2C_0 + default y + +endif # I2C + +if PWM + +config PWM_0 + default y + +endif # PWM + +if SPI + +config SPI_1 + default y + +config SPI_2 + default y + +endif # SPI + +if USB + +config USB_NRF52 + default y + +config USB_DEVICE_STACK + default y + +endif # USB + +if IEEE802154 + +config IEEE802154_NRF5 + default y + +endif # IEEE802154 + +config BT_CTLR + default BT + +endif # BOARD_NRF52833_PCA10100 diff --git a/boards/arm/nrf52833_pca10100/board.cmake b/boards/arm/nrf52833_pca10100/board.cmake new file mode 100644 index 00000000000..11d3ce2106c --- /dev/null +++ b/boards/arm/nrf52833_pca10100/board.cmake @@ -0,0 +1,9 @@ +# SPDX-License-Identifier: Apache-2.0 + +board_runner_args(nrfjprog "--nrf-family=NRF52") +board_runner_args(jlink "--device=nrf52" "--speed=4000") +board_runner_args(pyocd "--target=nrf52833" "--frequency=4000000") +include(${ZEPHYR_BASE}/boards/common/nrfjprog.board.cmake) +include(${ZEPHYR_BASE}/boards/common/jlink.board.cmake) +include(${ZEPHYR_BASE}/boards/common/pyocd.board.cmake) +include(${ZEPHYR_BASE}/boards/common/openocd-nrf5.board.cmake) diff --git a/boards/arm/nrf52833_pca10100/doc/index.rst b/boards/arm/nrf52833_pca10100/doc/index.rst new file mode 100644 index 00000000000..13fc3219db2 --- /dev/null +++ b/boards/arm/nrf52833_pca10100/doc/index.rst @@ -0,0 +1,221 @@ +.. _nrf52833_pca10100: + +nRF52833-PCA10100 +################# + +Overview +******** + +The nRF52833 Preview Development Kit (PCA10100) hardware provides +support for the Nordic Semiconductor nRF52833 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)` +* Segger RTT (RTT Console) +* :abbr:`SPI (Serial Peripheral Interface)` +* :abbr:`UART (Universal asynchronous receiver-transmitter)` +* :abbr:`USB (Universal Serial Bus)` +* :abbr:`WDT (Watchdog Timer)` + +More information about the board can be found at the +`nRF52833 PDK website`_. The `Nordic Semiconductor Documentation library`_ +contains the processor's information and the datasheet. + +Hardware +******** + +nRF52833 PDK has two external oscillators. The frequency of +the slow clock is 32.768 kHz. The frequency of the main clock +is 32 MHz. + +Supported Features +================== + +The nrf52833_pca10100 board configuration 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 | ++-----------+------------+----------------------+ +| RTT | Segger | console | ++-----------+------------+----------------------+ +| SPI(M/S) | on-chip | spi | ++-----------+------------+----------------------+ +| UART | on-chip | serial | ++-----------+------------+----------------------+ +| USB | on-chip | usb | ++-----------+------------+----------------------+ +| WDT | on-chip | watchdog | ++-----------+------------+----------------------+ + +Other hardware features are not supported by the Zephyr kernel. +See `nRF52833 PDK website`_ and `Nordic Semiconductor Documentation library`_ +for a complete list of nRF52833 Development Kit board hardware features. + +Connections and IOs +=================== + +LED +--- + +* LED1 (green) = P0.13 +* LED2 (green) = P0.14 +* LED3 (green) = P0.15 +* LED4 (green) = P0.16 + +Push buttons +------------ + +* BUTTON1 = SW1 = P0.11 +* BUTTON2 = SW2 = P0.12 +* BUTTON3 = SW3 = P0.24 +* BUTTON4 = SW4 = P0.25 +* BOOT = SW5 = boot/reset + +Programming and Debugging +************************* + +Applications for the ``nrf52833_pca10100`` board configuration can be +built and flashed in the usual way (see :ref:`build_an_application` +and :ref:`application_run` for more details); however, the standard +debugging targets are not currently available. + +Flashing +======== + +Follow the instructions in the :ref:`nordic_segger` page to install +and configure all the necessary software. Further information can be +found in :ref:`nordic_segger_flashing`. Then build and flash +applications as usual (see :ref:`build_an_application` and +:ref:`application_run` for more details). + +Here is an example for the :ref:`hello_world` application. + +First, run your favorite terminal program to listen for output. + +.. code-block:: console + + $ minicom -D -b 115200 + +Replace :code:`` with the port where the board nRF52 DK +can be found. For example, under Linux, :code:`/dev/ttyACM0`. + +Then build and flash the application in the usual way. + +.. zephyr-app-commands:: + :zephyr-app: samples/hello_world + :board: nrf52833_pca10100 + :goals: build flash + +Debugging +========= + +Refer to the :ref:`nordic_segger` page to learn about debugging Nordic boards with a +Segger IC. + + +Testing the LEDs and buttons in the nRF52833 PDK +************************************************ + +There are 2 samples that allow you to test that the buttons (switches) and LEDs on +the board are working properly with Zephyr: + +* :ref:`blinky-sample` +* :ref:`button-sample` + +You can build and flash the examples to make sure Zephyr is running correctly on +your board. The button and LED definitions can be found in +:zephyr_file:`boards/arm/nrf52833_pca10100/nrf52833_pca10100.dts`. + +Using UART1 +*********** + +The following approach can be used when an application needs to use +more than one UART for connecting peripheral devices: + +1. Add devicetree overlay file to the main directory of your application: + + .. code-block:: console + + $ cat nrf52833_pca10100.overlay + &uart1 { + compatible = "nordic,nrf-uarte"; + current-speed = <115200>; + status = "okay"; + tx-pin = <14>; + rx-pin = <16>; + }; + + In the overlay file above, pin P0.16 is used for RX and P0.14 is used for TX + +2. Go to menuconfig and enable :option:`CONFIG_UART_1_NRF_UARTE`: + + (top menu) -> Device Drivers -> Serial Drivers -> nRF UART nrfx drivers + +3. Use the UART1 as ``device_get_binding("UART_1")`` + +Overlay file naming +=================== + +The file has to be named ``.overlay`` and placed in the app main directory to be +picked up automatically by the build system. + +Selecting the pins +================== +To select the pin numbers for tx-pin and rx-pin: + +.. code-block:: console + + tx-pin = + +Open the `nRF52833 Product Specification`_, chapter 7 'Hardware and Layout'. +In the table 7.1.1 'aQFN73 ball assignments' select the pins marked +'General purpose I/O'. Note that pins marked as 'low frequency I/O only' can only be used +in under-10KHz applications. They are not suitable for 115200 speed of UART. + +Translate the 'Pin' into number for devicetree by using the following formula:: + + pin_no = b*32 + a + +where ``a`` and ``b`` are from the Pin value in the table (Pb.a). +For example, for P0.1, ``pin_no = 1`` and for P1.0, ``pin_no = 32``. + +References +********** + +.. target-notes:: + +.. _nRF52833 PDK website: https://www.nordicsemi.com/Software-and-Tools/Development-Kits/nRF52833-DK +.. _Nordic Semiconductor Documentation library: https://www.nordicsemi.com/DocLib +.. _J-Link Software and documentation pack: https://www.segger.com/jlink-software.html +.. _nRF52833 Product Specification: https://infocenter.nordicsemi.com/pdf/nRF52833_OPS_v0.7.pdf diff --git a/boards/arm/nrf52833_pca10100/nrf52833_pca10100.dts b/boards/arm/nrf52833_pca10100/nrf52833_pca10100.dts new file mode 100644 index 00000000000..4792d362bc9 --- /dev/null +++ b/boards/arm/nrf52833_pca10100/nrf52833_pca10100.dts @@ -0,0 +1,238 @@ +/* + * Copyright (c) 2019 Nordic Semiconductor ASA + * + * SPDX-License-Identifier: Apache-2.0 + */ + +/dts-v1/; +#include + +/ { + model = "Nordic PCA10100 Dev Kit"; + compatible = "nordic,pca10100-dk", "nordic,nrf52833-qiaa", + "nordic,nrf52833"; + + chosen { + zephyr,console = &uart0; + zephyr,shell-uart = &uart0; + zephyr,uart-mcumgr = &uart0; + zephyr,bt-mon-uart = &uart0; + zephyr,bt-c2h-uart = &uart0; + zephyr,sram = &sram0; + zephyr,flash = &flash0; + zephyr,code-partition = &slot0_partition; + }; + + leds { + compatible = "gpio-leds"; + led0: led_0 { + gpios = <&gpio0 13 GPIO_INT_ACTIVE_LOW>; + label = "Green LED 0"; + }; + led1: led_1 { + gpios = <&gpio0 14 GPIO_INT_ACTIVE_LOW>; + label = "Green LED 1"; + }; + led2: led_2 { + gpios = <&gpio0 15 GPIO_INT_ACTIVE_LOW>; + label = "Green LED 2"; + }; + led3: led_3 { + gpios = <&gpio0 16 GPIO_INT_ACTIVE_LOW>; + label = "Green LED 3"; + }; + }; + + pwmleds { + compatible = "pwm-leds"; + pwm_led0: pwm_led_0 { + pwms = <&pwm0 13>; + }; + }; + + buttons { + compatible = "gpio-keys"; + button0: button_0 { + gpios = <&gpio0 11 GPIO_PUD_PULL_UP>; + label = "Push button switch 0"; + }; + button1: button_1 { + gpios = <&gpio0 12 GPIO_PUD_PULL_UP>; + label = "Push button switch 1"; + }; + button2: button_2 { + gpios = <&gpio0 24 GPIO_PUD_PULL_UP>; + label = "Push button switch 2"; + }; + button3: button_3 { + gpios = <&gpio0 25 GPIO_PUD_PULL_UP>; + label = "Push button switch 3"; + }; + }; + + arduino_header: connector { + compatible = "arduino-header-r3"; + #gpio-cells = <2>; + gpio-map-mask = <0xffffffff 0xffffffc0>; + gpio-map-pass-thru = <0 0x3f>; + gpio-map = <0 0 &gpio0 3 0>, /* A0 */ + <1 0 &gpio0 4 0>, /* A1 */ + <2 0 &gpio0 28 0>, /* A2 */ + <3 0 &gpio0 29 0>, /* A3 */ + <4 0 &gpio0 30 0>, /* A4 */ + <5 0 &gpio0 31 0>, /* A5 */ + <6 0 &gpio1 1 0>, /* D0 */ + <7 0 &gpio1 2 0>, /* D1 */ + <8 0 &gpio1 3 0>, /* D2 */ + <9 0 &gpio1 4 0>, /* D3 */ + <10 0 &gpio1 5 0>, /* D4 */ + <11 0 &gpio1 6 0>, /* D5 */ + <12 0 &gpio1 7 0>, /* D6 */ + <13 0 &gpio1 8 0>, /* D7 */ + <14 0 &gpio0 17 0>, /* D8 */ + <15 0 &gpio0 19 0>, /* D9 */ + <16 0 &gpio0 20 0>, /* D10 */ + <17 0 &gpio0 21 0>, /* D11 */ + <18 0 &gpio0 22 0>, /* D12 */ + <19 0 &gpio0 23 0>, /* D13 */ + <20 0 &gpio0 26 0>, /* D14 */ + <21 0 &gpio0 27 0>; /* D15 */ + }; + + /* These aliases are provided for compatibility with samples */ + aliases { + led0 = &led0; + led1 = &led1; + led2 = &led2; + led3 = &led3; + pwm-led0 = &pwm_led0; + sw0 = &button0; + sw1 = &button1; + sw2 = &button2; + sw3 = &button3; + }; +}; + +&adc { + status = "okay"; +}; + +&gpiote { + status = "okay"; +}; + +&gpio0 { + status = "okay"; +}; + +&gpio1 { + status = "okay"; +}; + +&uart0 { + compatible = "nordic,nrf-uart"; + status = "okay"; + current-speed = <115200>; + tx-pin = <6>; + rx-pin = <8>; + rts-pin = <5>; + cts-pin = <7>; +}; + +arduino_serial: &uart1 { + status = "okay"; + current-speed = <115200>; + rx-pin = <33>; + tx-pin = <34>; +}; + +arduino_i2c: &i2c0 { + compatible = "nordic,nrf-twi"; + status = "okay"; + sda-pin = <26>; + scl-pin = <27>; +}; + +&i2c1 { + compatible = "nordic,nrf-twi"; + /* Cannot be used together with spi1. */ + /* status = "okay"; */ + sda-pin = <30>; + scl-pin = <31>; +}; + +&pwm0 { + status = "okay"; + ch0-pin = <13>; + ch0-inverted; +}; + +&spi0 { + compatible = "nordic,nrf-spi"; + /* Cannot be used together with i2c0. */ + /* status = "okay"; */ + sck-pin = <27>; + mosi-pin = <26>; + miso-pin = <29>; +}; + +&spi1 { + compatible = "nordic,nrf-spi"; + status = "okay"; + sck-pin = <31>; + mosi-pin = <30>; + miso-pin = <40>; +}; + +&spi2 { + compatible = "nordic,nrf-spi"; + status = "okay"; + sck-pin = <19>; + mosi-pin = <20>; + miso-pin = <21>; +}; + +arduino_spi: &spi3 { + status = "okay"; + sck-pin = <41>; + miso-pin = <43>; + mosi-pin = <42>; +}; + +&flash0 { + /* + * For more information, see: + * http://docs.zephyrproject.org/latest/guides/dts/index.html#flash-partitions + */ + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + boot_partition: partition@0 { + label = "mcuboot"; + reg = <0x000000000 0xC000>; + }; + slot0_partition: partition@c000 { + label = "image-0"; + reg = <0x0000C000 0x32000>; + }; + slot1_partition: partition@3e000 { + label = "image-1"; + reg = <0x0003E000 0x32000>; + }; + scratch_partition: partition@70000 { + label = "image-scratch"; + reg = <0x00070000 0xA000>; + }; + storage_partition: partition@7a000 { + label = "storage"; + reg = <0x0007A000 0x00006000>; + }; + }; +}; + +&usbd { + compatible = "nordic,nrf-usbd"; + status = "okay"; +}; diff --git a/boards/arm/nrf52833_pca10100/nrf52833_pca10100.yaml b/boards/arm/nrf52833_pca10100/nrf52833_pca10100.yaml new file mode 100644 index 00000000000..988b4389421 --- /dev/null +++ b/boards/arm/nrf52833_pca10100/nrf52833_pca10100.yaml @@ -0,0 +1,17 @@ +identifier: nrf52833_pca10100 +name: nRF52833-PCA10100 +type: mcu +arch: arm +toolchain: + - zephyr + - gnuarmemb + - xtools +supported: + - adc + - usb_device + - ble + - gpio + - ieee802154 + - pwm + - watchdog + - counter diff --git a/boards/arm/nrf52833_pca10100/nrf52833_pca10100_defconfig b/boards/arm/nrf52833_pca10100/nrf52833_pca10100_defconfig new file mode 100644 index 00000000000..8a8afb2baae --- /dev/null +++ b/boards/arm/nrf52833_pca10100/nrf52833_pca10100_defconfig @@ -0,0 +1,27 @@ +# SPDX-License-Identifier: Apache-2.0 + +CONFIG_ARM=y +CONFIG_SOC_FAMILY_NRF=y +CONFIG_SOC_SERIES_NRF52X=y +CONFIG_SOC_NRF52833_QIAA=y +CONFIG_BOARD_NRF52833_PCA10100=y + +# Enable MPU +CONFIG_ARM_MPU=y + +# Enable RTT +CONFIG_HAS_SEGGER_RTT=y + +# enable GPIO +CONFIG_GPIO=y + +# enable uart driver +CONFIG_SERIAL=y +CONFIG_UART_0_NRF_UART=y + +# enable console +CONFIG_CONSOLE=y +CONFIG_UART_CONSOLE=y + +# additional board options +CONFIG_GPIO_AS_PINRESET=y