diff --git a/boards/arm/bl654_sensor_board/Kconfig b/boards/arm/bl654_sensor_board/Kconfig new file mode 100644 index 00000000000..8eb40223d40 --- /dev/null +++ b/boards/arm/bl654_sensor_board/Kconfig @@ -0,0 +1,10 @@ +# BL654 Sensor 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_SENSOR_BOARD diff --git a/boards/arm/bl654_sensor_board/Kconfig.board b/boards/arm/bl654_sensor_board/Kconfig.board new file mode 100644 index 00000000000..6e68f886c43 --- /dev/null +++ b/boards/arm/bl654_sensor_board/Kconfig.board @@ -0,0 +1,8 @@ +# BL654 Sensor Board configuration + +# Copyright (c) 2021 Laird Connectivity +# SPDX-License-Identifier: Apache-2.0 + +config BOARD_BL654_SENSOR_BOARD + bool "BL654 Sensor Board" + depends on SOC_NRF52840_QIAA diff --git a/boards/arm/bl654_sensor_board/Kconfig.defconfig b/boards/arm/bl654_sensor_board/Kconfig.defconfig new file mode 100644 index 00000000000..4ca294e8990 --- /dev/null +++ b/boards/arm/bl654_sensor_board/Kconfig.defconfig @@ -0,0 +1,14 @@ +# BL654 Sensor Board configuration + +# Copyright (c) 2021 Laird Connectivity +# SPDX-License-Identifier: Apache-2.0 + +if BOARD_BL654_SENSOR_BOARD + +config BOARD + default "bl654_sensor_board" + +config BT_CTLR + default BT + +endif # BOARD_BL654_SENSOR_BOARD diff --git a/boards/arm/bl654_sensor_board/bl654_sensor_board.dts b/boards/arm/bl654_sensor_board/bl654_sensor_board.dts new file mode 100644 index 00000000000..a1d6a05a10c --- /dev/null +++ b/boards/arm/bl654_sensor_board/bl654_sensor_board.dts @@ -0,0 +1,130 @@ +/* + * Copyright (c) 2021 Laird Connectivity + * + * SPDX-License-Identifier: Apache-2.0 + */ + +/dts-v1/; +#include + +/ { + model = "Laird BL654 Sensor Board"; + compatible = "lairdconnect,bl654-sensor-board"; + + 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"; + led1: led_1 { + gpios = <&gpio0 16 GPIO_ACTIVE_LOW>; + label = "Blue LED 1"; + }; + }; + + buttons { + compatible = "gpio-keys"; + button1: button_1 { + gpios = <&gpio1 3 GPIO_ACTIVE_HIGH>; + label = "Push button switch 1 (SW1)"; + }; + }; + + /* These aliases are provided for compatibility with samples */ + aliases { + led0 = &led1; + sw0 = &button1; + }; +}; + +&adc { + status = "okay"; +}; + +&gpiote { + status = "okay"; +}; + +&gpio0 { + status = "okay"; +}; + +&gpio1 { + status = "okay"; +}; + +&uart0 { + compatible = "nordic,nrf-uart"; + current-speed = <115200>; + status = "okay"; + tx-pin = <6>; + rx-pin = <8>; + rts-pin = <5>; + cts-pin = <7>; +}; + +&i2c0 { + compatible = "nordic,nrf-twi"; + status = "okay"; + sda-pin = <26>; + scl-pin = <27>; + + bme280@76 { + compatible = "bosch,bme280"; + status = "okay"; + label = "BME280"; + reg = <0x76>; + }; +}; + +&pwm0 { + status = "okay"; + ch0-pin = <16>; +}; + +&flash0 { + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + boot_partition: partition@0 { + label = "mcuboot"; + reg = <0x000000000 0x00010000>; + }; + slot0_partition: partition@10000 { + label = "image-0"; + reg = <0x00010000 0x00070000>; + }; + slot1_partition: partition@80000 { + label = "image-1"; + reg = <0x00080000 0x00070000>; + }; + scratch_partition: partition@f0000 { + label = "image-scratch"; + reg = <0x000f0000 0x00008000>; + }; + + /* + * 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>; + }; + }; +}; diff --git a/boards/arm/bl654_sensor_board/bl654_sensor_board.yaml b/boards/arm/bl654_sensor_board/bl654_sensor_board.yaml new file mode 100644 index 00000000000..52344cddb88 --- /dev/null +++ b/boards/arm/bl654_sensor_board/bl654_sensor_board.yaml @@ -0,0 +1,20 @@ +identifier: bl654_sensor_board +name: BL654_Sensor_Board +type: mcu +arch: arm +ram: 256 +flash: 1024 +toolchain: + - zephyr + - gnuarmemb + - xtools +supported: + - adc + - ble + - counter + - gpio + - i2c + - ieee802154 + - pwm + - watchdog + - netif:openthread diff --git a/boards/arm/bl654_sensor_board/bl654_sensor_board_defconfig b/boards/arm/bl654_sensor_board/bl654_sensor_board_defconfig new file mode 100644 index 00000000000..bf6bb2f6391 --- /dev/null +++ b/boards/arm/bl654_sensor_board/bl654_sensor_board_defconfig @@ -0,0 +1,21 @@ +# SPDX-License-Identifier: Apache-2.0 + +CONFIG_SOC_SERIES_NRF52X=y +CONFIG_SOC_NRF52840_QIAA=y +CONFIG_BOARD_BL654_SENSOR_BOARD=y + +# Enable MPU +CONFIG_ARM_MPU=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/boards/arm/bl654_sensor_board/board.cmake b/boards/arm/bl654_sensor_board/board.cmake new file mode 100644 index 00000000000..14256907c60 --- /dev/null +++ b/boards/arm/bl654_sensor_board/board.cmake @@ -0,0 +1,8 @@ +# SPDX-License-Identifier: Apache-2.0 + +board_runner_args(pyocd "--target=nrf52840" "--frequency=4000000") +board_runner_args(nrfjprog "--softreset") +board_runner_args(jlink "--device=nrf52" "--speed=4000") +include(${ZEPHYR_BASE}/boards/common/pyocd.board.cmake) +include(${ZEPHYR_BASE}/boards/common/nrfjprog.board.cmake) +include(${ZEPHYR_BASE}/boards/common/jlink.board.cmake) diff --git a/boards/arm/bl654_sensor_board/doc/bl654_sensor_board.rst b/boards/arm/bl654_sensor_board/doc/bl654_sensor_board.rst new file mode 100644 index 00000000000..f85c5781102 --- /dev/null +++ b/boards/arm/bl654_sensor_board/doc/bl654_sensor_board.rst @@ -0,0 +1,254 @@ +.. _bl654_sensor_board: + +Laird Connectivity BL654 Sensor Board +##################################### + +Overview +******** + +The BL654 Sensor Board hardware provides support for the Laird Connectivity +BL654 module which is powered by a Nordic Semiconductor nRF52840 ARM +Cortex-M4F CPU. + +This sensor board has the following features: + +* :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:`WDT (Watchdog Timer)` + +.. figure:: img/bl654_sensor_board.png + :width: 467px + :align: center + :alt: BL654 Sensor Board front and back + + BL654 Sensor Board front and back + +.. figure:: img/bl654_sensor_board_usb_swd_programmer.png + :width: 302px + :align: center + :alt: BL654 Sensor Board connected to USB-SWD Programmer (UART and SWD access) + + BL654 Sensor Board connected to USB-SWD Programmer (UART and SWD access) + +More information about the BL654 module can be found on the `BL654 website`_, +more information about the USB-SWD Programmer can be found on the +`USB-SWD Programmer website`_. + +Hardware +******** + +Supported Features +================== + +The BL654 Sensor 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 | ++-----------+------------+----------------------+ +| WDT | on-chip | watchdog | ++-----------+------------+----------------------+ + +Other hardware features are not supported by the Zephyr kernel. +See the `BL654 website`_ for a complete list of BL654 module hardware features. + +Connections and IOs +=================== + +LED +--- + +* LED1 (blue) = P0.16 (active low) + +Push button +----------- + +* BUTTON1 (SW1) = P1.03 (active high) + +Sensor +------ + +The BL654 Sensor Board has an on-board Bosch BME280 +temperature/humidity/pressure sensor which is connected to the BL654 via I2C. + +* SCL = P0.27 +* SDA = P0.26 + +More information about the Bosch BME280 sensor can be found on the +`Bosch BME280 sensor website`_. + +Powering the sensor +******************* + +The sensor can be powered directly from a coin cell or from a voltage supplied +on the UART pins, the board accepts voltage from 1.8v-3.3v. Note that if using a +battery with a UART/debugger connected, the voltage of the UART/debugger (if it +does not automatically sense/adjust) must be within 0.3v of the voltage of the +coin cell to prevent supression diodes in the nRF52840 silicon being activated +or possible back-powering of the battery. + +To power the board from an external source via UART, the solder bridge SB1 must +be blobbed. + +Programming and Debugging +************************* + +Applications for the ``bl654_sensor_board`` board configuration can be built, +flashed, and debugged in the usual way. See :ref:`build_an_application` and +:ref:`application_run` for more details on building and running. An external +debugger/programmer is required which can be connected to using a Tag-Connect +TC2030-CTX cable, a Laird Connectivity USB-SWD Programmer board or Segger JLink +programmer can be used to program and debug the BL654 sensor board. + +Flashing +======== + +If using an external JLink, 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). If using a Laird Connectivity USB-SWD Programmer Board, see the +`pyOCD website`_ to find details about the software and how to install it. + +Here is an example for the :ref:`hello_world` application. + +First, run your favorite terminal program to listen for output - note that an +external UART is required to be connected to the BL654 sensor board's UART, if +using the Laird Connectivity USB-SWD Programmer Board, the BL654 sensor board +can be plugged in to the UART header. An FTDI cable can also be used - the +voltage of the I/O lines and power line must be between 1.8v and 3.3v, do not +connect an FTDI cable with a 5v power line to the BL654 sensor board. + +J3 UART connector pinout (all pins referenced to operating voltage Vdd): + ++---------+------+---------------------------------------------+-----------+ +| Pin No. | Name | Description | Direction | ++=========+======+=============================================+===========+ +| 1 | GND | GND | (N/A) | ++---------+------+---------------------------------------------+-----------+ +| 2 | RTS | UART Ready-to-send pin | OUT | ++---------+------+---------------------------------------------+-----------+ +| 3 | VDD | Supply voltage (requires SB1 to be blobbed) | (N/A) | ++---------+------+---------------------------------------------+-----------+ +| 4 | RXD | UART Receive pin | IN | ++---------+------+---------------------------------------------+-----------+ +| 5 | TXD | UART Transmit pin | (N/A) | ++---------+------+---------------------------------------------+-----------+ +| 6 | CTS | UART Clear-to-send pin | IN | ++---------+------+---------------------------------------------+-----------+ + +.. code-block:: console + + $ minicom -D -b 115200 + +Replace :code:`` with the port where the BL654 sensor board +can be found. For example, under Linux, :code:`/dev/ttyACM0`. + +The BL654 sensor board needs an external programmer to program it, any SWD +programmer which has a 9-pin ARM debug port can be used with a Tag-Connect +TC2030-CTX cable. If using the Laird Connectivity USB-SWD Programmer Board, +connect the cable to P1 and ensure the board is set to supply power to the +target at 3.3v. + +J1 Tag-Connect SWD Pinout: + ++---------+--------+-----------------------------------+-----------+ +| Pin No. | Name | Description | Direction | ++=========+========+===================================+===========+ +| 1 | VDD | Operating voltage | (N/A) | ++---------+--------+-----------------------------------+-----------+ +| 2 | SWDIO | Serial wire data input/output pin | IN/OUT | ++---------+--------+-----------------------------------+-----------+ +| 3 | nRESET | Module reset pin | IN | ++---------+--------+-----------------------------------+-----------+ +| 4 | SWCLK | Serial wire clock input pin | IN | ++---------+--------+-----------------------------------+-----------+ +| 5 | GND | GND | (N/A) | ++---------+--------+-----------------------------------+-----------+ +| 6 | SWO | Serial wire output pin | OUT | ++---------+--------+-----------------------------------+-----------+ + +Then build and flash the application in the usual way. + +.. zephyr-app-commands:: + :zephyr-app: samples/hello_world + :board: bl654_sensor_board + :goals: build flash + +Debugging +========= + +Refer to the :ref:`nordic_segger` page to learn about debugging Nordic based +boards if using an external JLink debugger. If using a Laird Connectivity +USB-SWD Programmer Board, pyOCD can be used for debugging. + +Testing Bluetooth on the BL654 Sensor Board +******************************************* +Many of the Bluetooth examples will work on the BL654 Sensor Board. +Try them out: + +* :ref:`ble_peripheral` +* :ref:`bluetooth-eddystone-sample` +* :ref:`bluetooth-ibeacon-sample` + + +Testing the LED and button on the BL654 Sensor Board +**************************************************** + +There are 2 samples that allow you to test that the button (switch) and LED 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/bl654_sensor_board/bl654_sensor_board.dts`. + + +References +********** + +.. target-notes:: + +.. _Bosch BME280 sensor website: https://www.bosch-sensortec.com/products/environmental-sensors/humidity-sensors-bme280/ +.. _BL654 website: https://connectivity.lairdtech.com/wireless-modules/bluetooth-modules/bluetooth-5-modules/bl654-series +.. _pyOCD website: https://github.com/pyocd/pyOCD +.. _USB-SWD Programmer website: https://www.lairdconnect.com/usb-swd-programmer diff --git a/boards/arm/bl654_sensor_board/doc/img/bl654_sensor_board.png b/boards/arm/bl654_sensor_board/doc/img/bl654_sensor_board.png new file mode 100644 index 00000000000..6d05c33d386 Binary files /dev/null and b/boards/arm/bl654_sensor_board/doc/img/bl654_sensor_board.png differ diff --git a/boards/arm/bl654_sensor_board/doc/img/bl654_sensor_board_usb_swd_programmer.png b/boards/arm/bl654_sensor_board/doc/img/bl654_sensor_board_usb_swd_programmer.png new file mode 100644 index 00000000000..9cc9a2da60e Binary files /dev/null and b/boards/arm/bl654_sensor_board/doc/img/bl654_sensor_board_usb_swd_programmer.png differ diff --git a/tests/drivers/adc/adc_api/src/test_adc.c b/tests/drivers/adc/adc_api/src/test_adc.c index ea1ce0458c6..99117179547 100644 --- a/tests/drivers/adc/adc_api/src/test_adc.c +++ b/tests/drivers/adc/adc_api/src/test_adc.c @@ -44,6 +44,7 @@ defined(CONFIG_BOARD_BL652_DVK) || \ defined(CONFIG_BOARD_BL653_DVK) || \ defined(CONFIG_BOARD_BL654_DVK) || \ + defined(CONFIG_BOARD_BL654_SENSOR_BOARD) || \ defined(CONFIG_BOARD_DEGU_EVK) || \ defined(CONFIG_BOARD_ADAFRUIT_FEATHER_NRF52840) || \ defined(CONFIG_BOARD_RUUVI_RUUVITAG) || \