diff --git a/boards/arm/bl654_usb/Kconfig b/boards/arm/bl654_usb/Kconfig new file mode 100644 index 00000000000..a445fd15f5e --- /dev/null +++ b/boards/arm/bl654_usb/Kconfig @@ -0,0 +1,10 @@ +# BL654 USB adapter board configuration + +# Copyright (c) 2021 Laird Connectivity +# SPDX-License-Identifier: Apache-2.0 + +config BOARD_ENABLE_DCDC + bool "Enable DCDC mode" + select SOC_DCDC_NRF52X + default y + depends on BOARD_BL654_USB diff --git a/boards/arm/bl654_usb/Kconfig.board b/boards/arm/bl654_usb/Kconfig.board new file mode 100644 index 00000000000..49f4dc67fad --- /dev/null +++ b/boards/arm/bl654_usb/Kconfig.board @@ -0,0 +1,8 @@ +# BL654 USB adapter board configuration + +# Copyright (c) 2021 Laird Connectivity +# SPDX-License-Identifier: Apache-2.0 + +config BOARD_BL654_USB + bool "BL654 USB" + depends on SOC_NRF52840_QIAA diff --git a/boards/arm/bl654_usb/Kconfig.defconfig b/boards/arm/bl654_usb/Kconfig.defconfig new file mode 100644 index 00000000000..9a1507dbc3f --- /dev/null +++ b/boards/arm/bl654_usb/Kconfig.defconfig @@ -0,0 +1,61 @@ +# BL654 USB adapter board configuration + +# Copyright (c) 2021 Laird Connectivity +# SPDX-License-Identifier: Apache-2.0 + +if BOARD_BL654_USB + +config BOARD + default "bl654_usb" + +# 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, +# so no override is necessary. + +config FLASH_LOAD_OFFSET + default 0x1000 + depends on BOARD_HAS_NRF5_BOOTLOADER && !USE_DT_CODE_PARTITION + +if USB + +config USB_NRFX + default y + +config USB_DEVICE_STACK + default y + +config USB_UART_CONSOLE + default y + +config UART_INTERRUPT_DRIVEN + default y + +config UART_LINE_CTRL + default y + +config UART_CONSOLE_ON_DEV_NAME + default "CDC_ACM_0" + +config UART_SHELL_ON_DEV_NAME + default "CDC_ACM_0" + +endif # USB + +if IEEE802154 + +config IEEE802154_NRF5 + default y + +endif # IEEE802154 + +config BT_CTLR + default BT + +endif # BOARD_BL654_USB diff --git a/boards/arm/bl654_usb/bl654_usb.dts b/boards/arm/bl654_usb/bl654_usb.dts new file mode 100644 index 00000000000..f1eb21ad6af --- /dev/null +++ b/boards/arm/bl654_usb/bl654_usb.dts @@ -0,0 +1,104 @@ +/* + * Copyright (c) 2021 Laird Connectivity + * + * SPDX-License-Identifier: Apache-2.0 + */ + +/dts-v1/; +#include + +/ { + model = "Laird BL654 USB adapter"; + compatible = "laird,bl654_usb"; + + chosen { + zephyr,sram = &sram0; + zephyr,flash = &flash0; + zephyr,code-partition = &slot0_partition; + }; + + leds { + compatible = "gpio-leds"; + led1: led_1 { + gpios = <&gpio0 13 GPIO_ACTIVE_HIGH>; + label = "Blue LED 1"; + }; + }; + + pwmleds { + compatible = "pwm-leds"; + led1bluepwm: led_pwm_1 { + pwms = <&pwm0 13>; + label = "PWM LED 1 Blue"; + }; + + }; + + /* These aliases are provided for compatibility with samples */ + aliases { + led0 = &led1; + led1pwm = &led1bluepwm; + }; +}; + +&gpio0 { + status = "okay"; +}; + +&gpio1 { + status = "okay"; +}; + +&pwm0 { + status = "okay"; + ch0-pin = <13>; +}; + +&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>; + + /* MCUboot placed after Nordic MBR. + * The size of this partition ensures that MCUBoot + * can be built with CDC ACM support and w/o optimizations. + */ + boot_partition: partition@1000 { + label = "mcuboot"; + reg = <0x00001000 0x000f000>; + }; + + slot0_partition: partition@10000 { + label = "image-0"; + reg = <0x00010000 0x00005e000>; + }; + slot1_partition: partition@6e000 { + label = "image-1"; + reg = <0x006e000 0x00005e000>; + }; + storage_partition: partition@cc000 { + label = "storage"; + reg = <0x000cc000 0x00008000>; + }; + scratch_partition: partition@d4000 { + label = "image-scratch"; + reg = <0x000d4000 0x0000C000>; + }; + + /* Nordic nRF5 bootloader <0xe0000 0x1c000> + * + * In addition, the last and second last flash pages + * are used by the nRF5 bootloader and MBR to store settings. + */ + }; +}; + +&usbd { + compatible = "nordic,nrf-usbd"; + status = "okay"; +}; diff --git a/boards/arm/bl654_usb/bl654_usb.yaml b/boards/arm/bl654_usb/bl654_usb.yaml new file mode 100644 index 00000000000..436566b935f --- /dev/null +++ b/boards/arm/bl654_usb/bl654_usb.yaml @@ -0,0 +1,16 @@ +identifier: bl654_usb +name: BL654_USB +type: mcu +arch: arm +toolchain: + - zephyr + - gnuarmemb + - xtools +supported: + - usb_device + - usb_cdc + - ble + - ieee802154 + - pwm + - watchdog + - counter diff --git a/boards/arm/bl654_usb/bl654_usb_defconfig b/boards/arm/bl654_usb/bl654_usb_defconfig new file mode 100644 index 00000000000..cc4963b97a1 --- /dev/null +++ b/boards/arm/bl654_usb/bl654_usb_defconfig @@ -0,0 +1,28 @@ +# SPDX-License-Identifier: Apache-2.0 + +CONFIG_SOC_SERIES_NRF52X=y +CONFIG_SOC_NRF52840_QIAA=y +CONFIG_BOARD_BL654_USB=y + +# Enable MPU +CONFIG_ARM_MPU=y + +# Enable uart driver +CONFIG_SERIAL=y + +# Enable console +CONFIG_CONSOLE=y +CONFIG_USB_UART_CONSOLE=y + +# Enable GPIO +CONFIG_GPIO=y + +# Enable USB +CONFIG_USB=y + +# Additional board options +CONFIG_GPIO_AS_PINRESET=y + +# 32KHz clock source +CONFIG_CLOCK_CONTROL_NRF_K32SRC_XTAL=y +CONFIG_CLOCK_CONTROL_NRF_K32SRC_150PPM=y diff --git a/boards/arm/bl654_usb/doc/bl654_usb.rst b/boards/arm/bl654_usb/doc/bl654_usb.rst new file mode 100644 index 00000000000..3a2620340b1 --- /dev/null +++ b/boards/arm/bl654_usb/doc/bl654_usb.rst @@ -0,0 +1,194 @@ +.. _bl654_usb: + +Laird Connectivity BL654 USB (451-00004) +######################################## + +Overview +******** + +The BL654 USB adapter hardware (Laird Connectivity part 451-00004) provides +support for the Laird Connectivity BL654 module powered by a Nordic +Semiconductor nRF52840 ARM Cortex-M4F CPU. + +This USB adapter has the following features: + +* CLOCK +* FLASH +* :abbr:`GPIO (General Purpose Input Output)` +* :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:`USB (Universal Serial Bus)` +* :abbr:`WDT (Watchdog Timer)` +* :abbr:`RTC (nRF RTC System Clock)` + +.. figure:: img/bl654_usb.jpg + :width: 500px + :align: center + :alt: BL654 USB adapter + + BL654 USB Adapter + +.. figure:: img/bl654_usb_pcb.jpg + :width: 500px + :align: center + :alt: 451-00004 Box Contents + + BL654 USB Adapter PCB + +More information about the BL654 USB adapter can be found on the `BL654 USB +Dongle Quick Start Guide`_. There is more information on the BL654 range on +the `BL654 website`_. + +Hardware +******** + +Supported Features +================== + +The BL654 USB board configuration supports the following +hardware features: + ++-----------+------------+----------------------+ +| Interface | Controller | Driver/Component | ++===========+============+======================+ +| CLOCK | on-chip | clock_control | ++-----------+------------+----------------------+ +| FLASH | on-chip | flash | ++-----------+------------+----------------------+ +| GPIO | on-chip | gpio | ++-----------+------------+----------------------+ +| MPU | on-chip | arch/arm | ++-----------+------------+----------------------+ +| NVIC | on-chip | arch/arm | ++-----------+------------+----------------------+ +| PWM | on-chip | pwm | ++-----------+------------+----------------------+ +| RADIO | on-chip | Bluetooth, | +| | | ieee802154 | ++-----------+------------+----------------------+ +| RTC | on-chip | system clock | ++-----------+------------+----------------------+ +| USB | on-chip | usb | ++-----------+------------+----------------------+ +| WDT | on-chip | watchdog | ++-----------+------------+----------------------+ + +Other hardware features are not supported by the Zephyr kernel. +See `BL654 website`_ +for a complete list of BL654 USB adapter hardware features. + +Connections and IOs +=================== + +LED +--- + +* LED1 (blue) = P0.13 + +Push buttons +------------ + +* RESET = SW1 = nReset + +Serial Port +=========== + +Zephyr console output is available as follows: + +- using the USB connector, which may be used to make the console available on PC as + USB CDC class. + +Programming and Debugging +************************* + +Applications for the ``bl654_usb`` board configuration can be +built in the usual way (see :ref:`build_an_application` for more details). The +``bl654_usb`` board cannot be used for debugging. The compatible BL654_DVK +board can be used for development. Documentation can be found at the `BL654_DVK +Zephyr site`_ and :zephyr_file:`boards/arm/bl654_dvk/doc/bl654_dvk.rst` + +Flashing +======== + +The board supports programming using the built-in bootloader. + +The board is factory-programmed with a Laird Connectivity variation of Nordic's +open bootloader from Nordic's nRF5x SDK. With this option, you'll use +Nordic's `nrfutil`_ program to create firmware packages supported by this +bootloader and flash them to the device. Make sure ``nrfutil`` is installed +before proceeding. These instructions were tested with version 6.1.0. + +#. With the adapter plugged in, reset the board into the bootloader by pressing +the RESET button. + + The push button is in a pin-hole on the logo side of the USB adapter. + + .. image:: img/bl654_usb_reset.jpg + :width: 500px + :align: center + :alt: Location of RESET button + + The blue LED should start a fade pattern, signalling the bootloader is + running. + +#. Compile a Zephyr application; we'll use :ref:`blinky `. + + .. zephyr-app-commands:: + :app: zephyr/samples/basic/blinky + :board: bl654_usb + :goals: build + +#. Package the application for the bootloader using ``nrfutil``: + + .. code-block:: console + + nrfutil pkg generate --hw-version 52 --sd-req=0x00 \ + --application build/zephyr/zephyr.hex \ + --application-version 1 blinky.zip + +#. Flash it onto the board. Note :file:`/dev/ttyACM0` is for Linux; it will be + something like ``COMx`` on Windows, and something else on macOS. + + .. code-block:: console + + nrfutil dfu usb-serial -pkg blinky.zip -p /dev/ttyACM0 + + When this command exits, observe the blue LED on the board blinking. + + +Testing Bluetooth on the BL654 USB +*********************************** +Many of the Bluetooth examples will work on the BL654 USB. +Try them out: + +* :ref:`ble_peripheral` +* :ref:`bluetooth-eddystone-sample` +* :ref:`bluetooth-ibeacon-sample` + + +Testing the LED on the BL654 USB +************************************************ + +There is a sample that allows you to test that the LED on +the board is working properly with Zephyr: + +* :ref:`blinky-sample` + +You can build and flash the example to make sure Zephyr is running correctly on +your board. The LED definitions can be found in +:zephyr_file:`boards/arm/bl654_usb/bl654_usb.dts`. + + +References +********** + +.. target-notes:: + +.. _BL654 USB Dongle Quick Start Guide: https://www.lairdconnect.com/documentation/user-guide-bl654-usb-nordic-sdk-zephyr +.. _BL654 website: https://connectivity.lairdtech.com/wireless-modules/bluetooth-modules/bluetooth-5-modules/bl654-series +.. _J-Link Software and documentation pack: https://www.segger.com/jlink-software.html +.. _Creating a secure bootloader image: https://www.lairdconnect.com/documentation/application-note-creating-secure-bootloader-image-bl654-usb +.. _nrfutil: https://github.com/NordicSemiconductor/pc-nrfutil +.. _BL654_DVK Zephyr site: https://docs.zephyrproject.org/latest/boards/arm/bl654_dvk/doc/bl654_dvk.html diff --git a/boards/arm/bl654_usb/doc/img/bl654_usb.jpg b/boards/arm/bl654_usb/doc/img/bl654_usb.jpg new file mode 100644 index 00000000000..d05af0ead27 Binary files /dev/null and b/boards/arm/bl654_usb/doc/img/bl654_usb.jpg differ diff --git a/boards/arm/bl654_usb/doc/img/bl654_usb_pcb.jpg b/boards/arm/bl654_usb/doc/img/bl654_usb_pcb.jpg new file mode 100644 index 00000000000..879254326ce Binary files /dev/null and b/boards/arm/bl654_usb/doc/img/bl654_usb_pcb.jpg differ diff --git a/boards/arm/bl654_usb/doc/img/bl654_usb_reset.jpg b/boards/arm/bl654_usb/doc/img/bl654_usb_reset.jpg new file mode 100644 index 00000000000..bdcb58d1eea Binary files /dev/null and b/boards/arm/bl654_usb/doc/img/bl654_usb_reset.jpg differ