diff --git a/boards/arm/ubx_evkninab3_nrf52840/Kconfig b/boards/arm/ubx_evkninab3_nrf52840/Kconfig new file mode 100644 index 00000000000..b4a505fb1f1 --- /dev/null +++ b/boards/arm/ubx_evkninab3_nrf52840/Kconfig @@ -0,0 +1,10 @@ +# EVK-NINA-B3 board configuration + +# Copyright (c) 2021 u-blox AG +# SPDX-License-Identifier: Apache-2.0 + +config BOARD_ENABLE_DCDC + bool "Enable DCDC mode" + select SOC_DCDC_NRF52X + default y + depends on BOARD_UBX_EVKNINAB3_NRF52840 diff --git a/boards/arm/ubx_evkninab3_nrf52840/Kconfig.board b/boards/arm/ubx_evkninab3_nrf52840/Kconfig.board new file mode 100644 index 00000000000..ee5b2dc98b9 --- /dev/null +++ b/boards/arm/ubx_evkninab3_nrf52840/Kconfig.board @@ -0,0 +1,8 @@ +# EVK-NINA-B3 board configuration + +# Copyright (c) 2021 u-blox AG +# SPDX-License-Identifier: Apache-2.0 + +config BOARD_UBX_EVKNINAB3_NRF52840 + bool "u-blox EVK-NINA-B3" + depends on SOC_NRF52840_QIAA diff --git a/boards/arm/ubx_evkninab3_nrf52840/Kconfig.defconfig b/boards/arm/ubx_evkninab3_nrf52840/Kconfig.defconfig new file mode 100644 index 00000000000..f7ea1e8c509 --- /dev/null +++ b/boards/arm/ubx_evkninab3_nrf52840/Kconfig.defconfig @@ -0,0 +1,28 @@ +# EVK-NINA-B3 board configuration + +# Copyright (c) 2021 u-blox AG +# SPDX-License-Identifier: Apache-2.0 + +if BOARD_UBX_EVKNINAB3_NRF52840 + +config BOARD + default "ubx_evkninab3_nrf52840" + +if USB + +config USB_NRFX + default y + +config USB_DEVICE_STACK + default y + +endif # USB + +config IEEE802154_NRF5 + default y + depends on IEEE802154 + +config BT_CTLR + default BT + +endif # BOARD_UBX_EVKNINAB3_NRF52840 diff --git a/boards/arm/ubx_evkninab3_nrf52840/board.cmake b/boards/arm/ubx_evkninab3_nrf52840/board.cmake new file mode 100644 index 00000000000..cebf56272c6 --- /dev/null +++ b/boards/arm/ubx_evkninab3_nrf52840/board.cmake @@ -0,0 +1,12 @@ +# EVK-NINA-B3 board configuration + +# Copyright (c) 2021 u-blox AG +# 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=nrf52840" "--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/ubx_evkninab3_nrf52840/doc/img/EVK-NINA-B3.png b/boards/arm/ubx_evkninab3_nrf52840/doc/img/EVK-NINA-B3.png new file mode 100644 index 00000000000..008b324ab75 Binary files /dev/null and b/boards/arm/ubx_evkninab3_nrf52840/doc/img/EVK-NINA-B3.png differ diff --git a/boards/arm/ubx_evkninab3_nrf52840/doc/index.rst b/boards/arm/ubx_evkninab3_nrf52840/doc/index.rst new file mode 100644 index 00000000000..70e9ff04241 --- /dev/null +++ b/boards/arm/ubx_evkninab3_nrf52840/doc/index.rst @@ -0,0 +1,323 @@ +.. _ubx_ninab3_nrf52840: + +u-blox EVK-NINA-B3 +################## + +Overview +******** + +The u-blox EVK-NINA-B30 Development Kit hardware provides support for the +u-blox NINA-B30x Bluetooth 5.0 module, based on 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)` +* Segger RTT (RTT Console) +* :abbr:`SPI (Serial Peripheral Interface)` +* :abbr:`UART (Universal asynchronous receiver-transmitter)` +* :abbr:`USB (Universal Serial Bus)` +* :abbr:`WDT (Watchdog Timer)` + +.. figure:: img/EVK-NINA-B3.png + :width: 600px + :align: center + :alt: EVK-NINA-B3 + + EVK-NINA-B3 (Credit: u-blox AG) + +More information about the EVK-NINA-B3 and the NINA-B30x modules +can be found at the `u-blox website`_. + +Hardware +******** + +The NINA-B30x on the EVK-NINA-B30x contains an internal high-frequency +oscillator at 32MHz as well as a low frequency (slow) oscillator +of 32.768kHz. + + +Supported Features +================== + +The ubx_evkninab3_nrf52840 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, | +| | | IEEE 802.15.4 | ++-----------+------------+----------------------+ +| 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 the `u-blox website`_ for a complete list of EVK-NINA-B30x +hardware features. + +Connections and IOs +=================== + +LED +--- + +* LED1 (red) = P0.13 +* LED2 (blue) = P1.00 +* LED3 (green) = P0.25 + +Push buttons +------------ + +* BUTTON1 = SW1 = P0.25 +* BUTTON2 = SW2 = P0.2 +* BOOT = SW0 = boot/reset + +External Connectors +------------------- + +.. note:: + The pin numbers noted below are referenced to + the pin 1 markings on the EVK-NINA-B30x + for each header + + +Arduino Headers +--------------- + +Power (J1) + ++-------+--------------+-------------------------+ +| PIN # | Signal Name | NINA-B30x Functions | ++=======+==============+=========================+ +| 1 | N/C | N/A | ++-------+--------------+-------------------------+ +| 2 | VDD_IO | N/A | ++-------+--------------+-------------------------+ +| 3 | RESET | P0.18 / RESET | ++-------+--------------+-------------------------+ +| 4 | 3V3 | N/A | ++-------+--------------+-------------------------+ +| 5 | 5V0 | N/A | ++-------+--------------+-------------------------+ +| 6 | GND | N/A | ++-------+--------------+-------------------------+ +| 7 | GND | N/A | ++-------+--------------+-------------------------+ +| 8 | VIN | N/A | ++-------+--------------+-------------------------+ + +Analog in (J2) + ++-------+--------------+-------------------------+ +| PIN # | Signal Name | NINA-B30x Functions | ++=======+==============+=========================+ +| 1 | A0 | P0.04 / AIN2 | ++-------+--------------+-------------------------+ +| 2 | A1 | P0.30 / AIN6 | ++-------+--------------+-------------------------+ +| 3 | A2 | P0.05 / AIN3 | ++-------+--------------+-------------------------+ +| 4 | A3 | P0.02 / AIN0 | ++-------+--------------+-------------------------+ +| 5 | A4 | P0.28 / AIN4 | ++-------+--------------+-------------------------+ +| 6 | A5 | P0.03 / AIN1 | ++-------+--------------+-------------------------+ + +Digital I/O (J3) + ++-------+--------------+-------------------------+ +| PIN # | Signal Name | NINA-B30x Functions | ++=======+==============+=========================+ +| 8 | D7 | P0.10 | ++-------+--------------+-------------------------+ +| 7 | D6 | P0.09 | ++-------+--------------+-------------------------+ +| 6 | D5 | P0.11 | ++-------+--------------+-------------------------+ +| 5 | D4 | P0.13 | ++-------+--------------+-------------------------+ +| 4 | D3 | P0.31 | ++-------+--------------+-------------------------+ +| 3 | D2 | P1.12 | ++-------+--------------+-------------------------+ +| 2 | D1 (TX) | P1.13 | ++-------+--------------+-------------------------+ +| 1 | D0 (RX) | P0.29 | ++-------+--------------+-------------------------+ + +Digital I/O (J4) + ++-------+--------------+-------------------------+ +| PIN # | Signal Name | NINA-B30x Functions | ++=======+==============+=========================+ +| 10 | SCL | P0.24 | ++-------+--------------+-------------------------+ +| 9 | SDA | P0.16 | ++-------+--------------+-------------------------+ +| 8 | N/C | N/A | ++-------+--------------+-------------------------+ +| 7 | GND | N/A | ++-------+--------------+-------------------------+ +| 6 | D13 (SCK) | P0.07 | ++-------+--------------+-------------------------+ +| 5 | D12 (MISO) | P1.00 | ++-------+--------------+-------------------------+ +| 4 | D11 (MOSI) | P0.15 | ++-------+--------------+-------------------------+ +| 3 | D10 (SS) | P0.14 | ++-------+--------------+-------------------------+ +| 2 | D9 | P0.12 | ++-------+--------------+-------------------------+ +| 1 | D8 | P1.09 | ++-------+--------------+-------------------------+ + + +Programming and Debugging +************************* + +Applications for the ``ubx_evkninab3_nrf52840`` 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 EVK-NINA-B30x +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: ubx_evkninab3_nrf52840 + :goals: build flash + +Debugging +========= + +Refer to the :ref:`nordic_segger` page to learn about debugging +u-blox boards with a Segger J-LINK-OB IC. + + +Testing the LEDs and buttons in the EVK-NINA-B30x +************************************************* + +There are 2 samples that allow you to test that the buttons +(switches) and LEDs on the board are working properly with Zephyr: + +.. code-block:: console + + samples/basic/blinky + samples/basic/button + +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/ubx_evkninab3_nrf52840/ubx_ninab3_nrf52840.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 device tree overlay file to the main directory of your application: + + .. code-block:: console + + $ cat ubx_evkninab3_nrf52840.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. 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 device tree compiler. + +Selecting the pins +================== +To select the pin numbers for tx-pin and rx-pin: + +.. code-block:: console + + tx-pin = + +Open the data sheet for the NINA-B3 at `u-blox website`_, Section 3 'Pin definition'. +In the table 7 select the pins marked 'GPIO_xx'. Note that pins marked as 'Radio sensitive pin' +can only be used in under-10KHz applications. They are not suitable for 115200 speed of UART. + +Translate 'Pin' into number for Device tree 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``. + +.. note: + Pins are defined according to the "nRF52" pin number, not the module pad number. + +References +********** + +.. target-notes:: + +.. _u-blox website: https://www.u-blox.com/en/product/nina-b3-series-open-cpu diff --git a/boards/arm/ubx_evkninab3_nrf52840/ubx_evkninab3_nrf52840.dts b/boards/arm/ubx_evkninab3_nrf52840/ubx_evkninab3_nrf52840.dts new file mode 100644 index 00000000000..f19070ca513 --- /dev/null +++ b/boards/arm/ubx_evkninab3_nrf52840/ubx_evkninab3_nrf52840.dts @@ -0,0 +1,227 @@ +/* + * Copyright (c) 2021 u-blox AG + * + * SPDX-License-Identifier: Apache-2.0 + */ + +/dts-v1/; +#include + +/ { + model = "u-blox EVK NINA-B3 nRF52840"; + compatible = "nordic,ubx_evkninab3_nrf52840"; + + 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_ACTIVE_LOW>; + label = "Red LED 0"; + }; + led1: led_1 { + gpios = <&gpio1 0 GPIO_ACTIVE_LOW>; + label = "Blue LED 1"; + }; + led2: led_2 { + gpios = <&gpio0 25 GPIO_ACTIVE_LOW>; + label = "Green LED 2"; + }; + }; + + pwmleds { + compatible = "pwm-leds"; + red_pwm_led: red_pwm_led { + pwms = <&pwm0 13>; + }; + green_pwm_led: green_pwm_led { + pwms = <&pwm0 32>; + }; + blue_pwm_led: blue_pwm_led { + pwms = <&pwm0 25>; + }; + }; + + buttons { + compatible = "gpio-keys"; + button0: button_0 { + gpios = <&gpio0 25 (GPIO_PULL_UP | \ + GPIO_ACTIVE_LOW)>; + label = "Push button switch 0 (SW1)"; + }; + button1: button_1 { + gpios = <&gpio0 2 (GPIO_PULL_UP | \ + GPIO_ACTIVE_LOW)>; + label = "Push button switch 1 (SW2)"; + }; + }; + + 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 04 0>, /* A0 */ + <1 0 &gpio0 30 0>, /* A1 */ + <2 0 &gpio0 5 0>, /* A2 */ + <3 0 &gpio0 2 0>, /* A3 */ + <4 0 &gpio0 28 0>, /* A4 */ + <5 0 &gpio0 3 0>, /* A5 */ + <6 0 &gpio0 29 0>, /* D0 */ + <7 0 &gpio1 13 0>, /* D1 */ + <8 0 &gpio1 12 0>, /* D2 */ + <9 0 &gpio0 31 0>, /* D3 */ + <10 0 &gpio0 13 0>, /* D4 */ + <11 0 &gpio0 11 0>, /* D5 */ + <12 0 &gpio0 9 0>, /* D6 */ + <13 0 &gpio0 10 0>, /* D7 */ + <14 0 &gpio1 9 0>, /* D8 */ + <15 0 &gpio0 12 0>, /* D9 */ + <16 0 &gpio0 14 0>, /* D10 */ + <17 0 &gpio0 15 0>, /* D11 */ + <18 0 &gpio1 0 0>, /* D12 */ + <19 0 &gpio0 7 0>, /* D13 */ + <20 0 &gpio0 16 0>, /* D14 */ + <21 0 &gpio0 24 0>; /* D15 */ + }; + + arduino_adc: analog-connector { + compatible = "arduino,uno-adc"; + #io-channel-cells = <1>; + io-channel-map = <0 &adc 2>, /* A0 = P0.04 = AIN2 */ + <1 &adc 6>, /* A1 = P0.30 = AIN6 */ + <2 &adc 3>, /* A2 = P0.5 = AIN3 */ + <3 &adc 0>, /* A3 = P0.2 = AIN0 */ + <4 &adc 4>, /* A4 = P0.28 = AIN4 */ + <5 &adc 1>; /* A5 = P0.3 = AIN1 */ + }; + + /* These aliases are provided for compatibility with samples */ + aliases { + led0 = &led0; + led1 = &led1; + led2 = &led2; + pwm-led0 = &red_pwm_led; + pwm-led1 = &blue_pwm_led; + pwm-led2 = &green_pwm_led; + red-pwm-led = &red_pwm_led; + blue-pwm-led = &blue_pwm_led; + green-pwm-led = &green_pwm_led; + sw0 = &button0; + sw1 = &button1; + }; +}; + +&adc { + status = "okay"; +}; + +&gpiote { + status = "okay"; +}; + +&gpio0 { + status = "okay"; +}; + +&gpio1 { + status = "okay"; +}; + +&uart0 { + compatible = "nordic,nrf-uarte"; + status = "okay"; + current-speed = <115200>; + tx-pin = <45>; + rx-pin = <29>; + rts-pin = <31>; + cts-pin = <44>; +}; + +arduino_i2c: &i2c0 { + compatible = "nordic,nrf-twi"; + status = "okay"; + sda-gpios = <&gpio0 16 0>; + scl-gpios = <&gpio0 24 0>; +}; + +&spi0 { + compatible = "nordic,nrf-spi"; + /* Cannot be used together with i2c0. */ + /* status = "okay"; */ + sck-pin = <7>; + mosi-pin = <32>; + miso-pin = <15>; +}; + +&spi1 { + compatible = "nordic,nrf-spi"; + status = "okay"; + sck-pin = <3>; + mosi-pin = <28>; + miso-pin = <9>; +}; + +&pwm0 { + status = "okay"; + ch0-pin = <13>; + ch0-inverted; + ch1-pin = <32>; + ch1-inverted; + ch2-pin = <25>; + ch2-inverted; +}; + +&flash0 { + + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + boot_partition: partition@0 { + label = "mcuboot"; + reg = <0x000000000 0x0000C000>; + }; + slot0_partition: partition@c000 { + label = "image-0"; + reg = <0x0000C000 0x00067000>; + }; + slot1_partition: partition@73000 { + label = "image-1"; + reg = <0x00073000 0x00067000>; + }; + scratch_partition: partition@da000 { + label = "image-scratch"; + reg = <0x000da000 0x0001e000>; + }; + + /* + * The flash starting at 0x000f8000 and ending at + * 0x000fffff is reserved for use by the application. + */ + + /* + * Storage partition will be used by FCB/LittleFS/NVS + * if enabled. + */ + storage_partition: partition@f8000 { + label = "storage"; + reg = <0x000f8000 0x00008000>; + }; + }; +}; + +&usbd { + compatible = "nordic,nrf-usbd"; + status = "okay"; +}; diff --git a/boards/arm/ubx_evkninab3_nrf52840/ubx_evkninab3_nrf52840.yaml b/boards/arm/ubx_evkninab3_nrf52840/ubx_evkninab3_nrf52840.yaml new file mode 100644 index 00000000000..f207045905e --- /dev/null +++ b/boards/arm/ubx_evkninab3_nrf52840/ubx_evkninab3_nrf52840.yaml @@ -0,0 +1,25 @@ +identifier: ubx_evkninab3_nrf52840 +name: UBX-EVKNINAB3-NRF52840 +type: mcu +arch: arm +ram: 256 +flash: 1024 +toolchain: + - zephyr + - gnuarmemb + - xtools +supported: + - adc + - arduino_gpio + - arduino_i2c + - ble + - counter + - gpio + - i2c + - ieee802154 + - pwm + - spi + - usb_cdc + - usb_device + - watchdog + - netif:openthread diff --git a/boards/arm/ubx_evkninab3_nrf52840/ubx_evkninab3_nrf52840_defconfig b/boards/arm/ubx_evkninab3_nrf52840/ubx_evkninab3_nrf52840_defconfig new file mode 100644 index 00000000000..b7f0094701f --- /dev/null +++ b/boards/arm/ubx_evkninab3_nrf52840/ubx_evkninab3_nrf52840_defconfig @@ -0,0 +1,30 @@ +# EVK-NINA-B3 board configuration + +# Copyright (c) 2021 u-blox AG +# SPDX-License-Identifier: Apache-2.0 + +CONFIG_SOC_SERIES_NRF52X=y +CONFIG_SOC_NRF52840_QIAA=y +CONFIG_BOARD_UBX_EVKNINAB3_NRF52840=y + +# Enable MPU +CONFIG_ARM_MPU=y + +# Enable hardware stack protection +CONFIG_HW_STACK_PROTECTION=y + +# Enable RTT +CONFIG_USE_SEGGER_RTT=y + +# enable GPIO +CONFIG_GPIO=y + +# enable uart driver +CONFIG_SERIAL=y + +# enable console +CONFIG_CONSOLE=y +CONFIG_UART_CONSOLE=y + +# additional board options +CONFIG_GPIO_AS_PINRESET=y diff --git a/tests/drivers/adc/adc_api/src/test_adc.c b/tests/drivers/adc/adc_api/src/test_adc.c index da66c9a238d..e71ef453200 100644 --- a/tests/drivers/adc/adc_api/src/test_adc.c +++ b/tests/drivers/adc/adc_api/src/test_adc.c @@ -54,7 +54,8 @@ defined(CONFIG_BOARD_UBX_BMD330EVAL_NRF52810) || \ defined(CONFIG_BOARD_UBX_BMD340EVAL_NRF52840) || \ defined(CONFIG_BOARD_UBX_BMD360EVAL_NRF52811) || \ - defined(CONFIG_BOARD_UBX_BMD380EVAL_NRF52840) + defined(CONFIG_BOARD_UBX_BMD380EVAL_NRF52840) || \ + defined(CONFIG_BOARD_UBX_EVKNINAB3_NRF52840) #include #define ADC_DEVICE_NAME DT_LABEL(DT_INST(0, nordic_nrf_saadc))