boards: arm: arduino_nano_33_ble: Add support for sense version of board

This commit adds support for the Arduino Nano 33 BLE Sense board.

The DTS is separated into a common dtsi and one DTS for each version
of the board. The sensors with existing drivers: hts221, lps22hb and
apds9960 are added to the DTS of the Sense version.

A startup delay is added to the vdd_env node. This is done to give some
time for the sensors VDD/VCC to go high before the sensor drivers are
initialized.

The functionality was verified using the driver sample of each sensor.

Signed-off-by: Benjamin Björnsson <benjamin.bjornsson@gmail.com>
This commit is contained in:
Benjamin Björnsson 2022-04-17 08:45:31 +02:00 committed by Maureen Helm
commit e9ab9990d4
9 changed files with 242 additions and 142 deletions

View file

@ -4,3 +4,7 @@
config BOARD_ARDUINO_NANO_33_BLE config BOARD_ARDUINO_NANO_33_BLE
bool "Arduino Nano 33 BLE board" bool "Arduino Nano 33 BLE board"
depends on SOC_NRF52840_QIAA depends on SOC_NRF52840_QIAA
config BOARD_ARDUINO_NANO_33_BLE_SENSE
bool "Arduino Nano 33 BLE Sense board"
depends on SOC_NRF52840_QIAA

View file

@ -1,10 +1,11 @@
# Copyright (c) 2020 Jefferson Lee. # Copyright (c) 2020 Jefferson Lee.
# SPDX-License-Identifier: Apache-2.0 # SPDX-License-Identifier: Apache-2.0
if BOARD_ARDUINO_NANO_33_BLE if BOARD_ARDUINO_NANO_33_BLE || BOARD_ARDUINO_NANO_33_BLE_SENSE
config BOARD config BOARD
default "arduino_nano_33_ble" default "arduino_nano_33_ble" if BOARD_ARDUINO_NANO_33_BLE
default "arduino_nano_33_ble_sense" if BOARD_ARDUINO_NANO_33_BLE_SENSE
config BT_CTLR config BT_CTLR
default BT default BT
@ -12,4 +13,4 @@ config BT_CTLR
config REGULATOR config REGULATOR
default y if SENSOR default y if SENSOR
endif # BOARD_ARDUINO_NANO_33_BLE endif # BOARD_ARDUINO_NANO_33_BLE || BOARD_ARDUINO_NANO_33_BLE_SENSE

View file

@ -0,0 +1,144 @@
/*
* Copyright (c) 2020 Jefferson Lee
*
* SPDX-License-Identifier: Apache-2.0
*/
/ {
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 = &code_partition;
};
leds {
compatible = "gpio-leds";
led0: led_0 {
gpios = <&gpio0 24 GPIO_ACTIVE_LOW>;
label = "Red LED";
};
led1: led_1 {
gpios = <&gpio0 16 GPIO_ACTIVE_LOW>;
label = "Green LED";
};
led2: led_2 {
gpios = <&gpio0 6 GPIO_ACTIVE_LOW>;
label = "Blue LED";
};
led4: led_4 {
gpios = <&gpio1 9 GPIO_ACTIVE_HIGH>;
label = "User LED";
};
};
vdd_env: vdd-env {
compatible = "regulator-fixed";
label = "vdd_env";
regulator-name = "vdd_env";
enable-gpios = <&gpio0 22 GPIO_ACTIVE_HIGH>;
regulator-boot-on;
startup-delay-us = <5000>;
};
zephyr,user {
/* I2C pull-ups are connected to VDD via pin voltage level */
pull-up-gpios = <&gpio1 0 GPIO_ACTIVE_HIGH>;
};
/* These aliases are provided for compatibility with samples */
aliases {
led0 = &led0;
led1 = &led1;
led2 = &led2;
led4 = &led4;
spi = &spi2;
};
};
&flash0 {
partitions {
compatible = "fixed-partitions";
#address-cells = <1>;
#size-cells = <1>;
boot_partition: partition@0 {
label = "sam-ba";
reg = <0x00000000 0x00010000>;
read-only;
};
code_partition: partition@10000 {
label = "code";
reg = <0x00010000 0x000e8000>;
read-only;
};
/*
* 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>;
};
};
};
&adc {
status = "okay";
};
&uart0 {
compatible = "nordic,nrf-uart";
current-speed = <115200>;
status = "okay";
pinctrl-0 = <&uart0_default>;
pinctrl-1 = <&uart0_sleep>;
pinctrl-names = "default", "sleep";
};
arduino_i2c: &i2c0 {
compatible = "nordic,nrf-twim";
status = "okay";
pinctrl-0 = <&i2c0_default>;
pinctrl-1 = <&i2c0_sleep>;
pinctrl-names = "default", "sleep";
};
&i2c1 {
compatible = "nordic,nrf-twim";
status = "okay";
pinctrl-0 = <&i2c1_default>;
pinctrl-1 = <&i2c1_sleep>;
pinctrl-names = "default", "sleep";
};
/* SPI2 is used because SPI1/0 shares conflicts with I2C1/0 */
arduino_spi: &spi2 {
compatible = "nordic,nrf-spim";
status = "okay";
pinctrl-0 = <&spi2_default>;
pinctrl-1 = <&spi2_sleep>;
pinctrl-names = "default", "sleep";
};
&gpio0 {
status = "okay";
};
&gpio1 {
status = "okay";
};
zephyr_udc0: &usbd {
compatible = "nordic,nrf-usbd";
status = "okay";
};

View file

@ -5,146 +5,11 @@
*/ */
/dts-v1/; /dts-v1/;
#include <nordic/nrf52840_qiaa.dtsi> #include <nordic/nrf52840_qiaa.dtsi>
#include "arduino_nano_33_ble-common.dtsi"
#include "arduino_nano_33_ble-pinctrl.dtsi" #include "arduino_nano_33_ble-pinctrl.dtsi"
#include "arduino_nano_r3_connector.dtsi" #include "arduino_nano_r3_connector.dtsi"
/ { / {
model = "Arduino Nano 33 BLE (Sense)"; model = "Arduino Nano 33 BLE";
compatible = "arduino,arduino_nano_33_ble"; compatible = "arduino,arduino_nano_33_ble";
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 = &code_partition;
};
leds {
compatible = "gpio-leds";
led0: led_0 {
gpios = <&gpio0 24 GPIO_ACTIVE_LOW>;
label = "Red LED";
};
led1: led_1 {
gpios = <&gpio0 16 GPIO_ACTIVE_LOW>;
label = "Green LED";
};
led2: led_2 {
gpios = <&gpio0 6 GPIO_ACTIVE_LOW>;
label = "Blue LED";
};
led4: led_4 {
gpios = <&gpio1 9 GPIO_ACTIVE_HIGH>;
label = "User LED";
};
};
vdd_env: vdd-env {
compatible = "regulator-fixed-sync", "regulator-fixed";
label = "vdd_env";
regulator-name = "vdd_env";
enable-gpios = <&gpio0 22 GPIO_ACTIVE_HIGH>;
regulator-boot-on;
};
zephyr,user {
/* I2C pull-ups are connected to VDD via pin voltage level */
pull-up-gpios = <&gpio1 0 GPIO_ACTIVE_HIGH>;
};
/* These aliases are provided for compatibility with samples */
aliases {
led0 = &led0;
led1 = &led1;
led2 = &led2;
led4 = &led4;
spi = &spi2;
};
};
&flash0 {
partitions {
compatible = "fixed-partitions";
#address-cells = <1>;
#size-cells = <1>;
boot_partition: partition@0 {
label = "sam-ba";
reg = <0x00000000 0x00010000>;
read-only;
};
code_partition: partition@10000 {
label = "code";
reg = <0x00010000 0x000e8000>;
read-only;
};
/*
* 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>;
};
};
};
&adc {
status = "okay";
};
&uart0 {
compatible = "nordic,nrf-uart";
current-speed = <115200>;
status = "okay";
pinctrl-0 = <&uart0_default>;
pinctrl-1 = <&uart0_sleep>;
pinctrl-names = "default", "sleep";
};
arduino_i2c: &i2c0 {
compatible = "nordic,nrf-twim";
status = "okay";
pinctrl-0 = <&i2c0_default>;
pinctrl-1 = <&i2c0_sleep>;
pinctrl-names = "default", "sleep";
};
&i2c1 {
compatible = "nordic,nrf-twim";
status = "okay";
pinctrl-0 = <&i2c1_default>;
pinctrl-1 = <&i2c1_sleep>;
pinctrl-names = "default", "sleep";
};
/* SPI2 is used because SPI1/0 shares conflicts with I2C1/0 */
arduino_spi: &spi2 {
compatible = "nordic,nrf-spim";
status = "okay";
pinctrl-0 = <&spi2_default>;
pinctrl-1 = <&spi2_sleep>;
pinctrl-names = "default", "sleep";
};
&gpio0 {
status = "okay";
};
&gpio1 {
status = "okay";
};
zephyr_udc0: &usbd {
compatible = "nordic,nrf-usbd";
status = "okay";
}; };

View file

@ -1,5 +1,5 @@
identifier: arduino_nano_33_ble identifier: arduino_nano_33_ble
name: Arduino Nano 33 BLE (Sense) name: Arduino Nano 33 BLE
type: mcu type: mcu
arch: arm arch: arm
toolchain: toolchain:
@ -17,4 +17,4 @@ supported:
- uart - uart
- usb_cdc - usb_cdc
- usb_device - usb_device
- watchdog - watchdog

View file

@ -0,0 +1,39 @@
/*
* Copyright (c) 2020 Jefferson Lee
*
* SPDX-License-Identifier: Apache-2.0
*/
/dts-v1/;
#include <nordic/nrf52840_qiaa.dtsi>
#include "arduino_nano_33_ble-common.dtsi"
#include "arduino_nano_33_ble-pinctrl.dtsi"
#include "arduino_nano_r3_connector.dtsi"
/ {
model = "Arduino Nano 33 BLE Sense";
compatible = "arduino,arduino_nano_33_ble_sense";
};
&i2c1 {
hts221: hts221@5f {
compatible = "st,hts221";
status = "okay";
reg = <0x5f>;
label = "HTS221";
};
lps22hb: lps22hb-press@5c {
compatible = "st,lps22hb-press";
status = "okay";
reg = <0x5c>;
label = "LPS22HB";
};
apds9960: apds9960@39 {
compatible = "avago,apds9960";
status = "okay";
reg = <0x39>;
label = "APDS9960";
int-gpios = <&gpio0 19 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>;
};
};

View file

@ -0,0 +1,20 @@
identifier: arduino_nano_33_ble_sense
name: Arduino Nano 33 BLE Sense
type: mcu
arch: arm
toolchain:
- zephyr
- gnuarmemb
- xtools
supported:
- adc
- ble
- i2c
- ieee802154
- pwm
- serial
- spi
- uart
- usb_cdc
- usb_device
- watchdog

View file

@ -0,0 +1,26 @@
# SPDX-License-Identifier: Apache-2.0
CONFIG_SOC_SERIES_NRF52X=y
CONFIG_SOC_NRF52840_QIAA=y
CONFIG_BOARD_ARDUINO_NANO_33_BLE_SENSE=y
# Enable MPU
CONFIG_ARM_MPU=y
CONFIG_HW_STACK_PROTECTION=y
# enable peripherals
CONFIG_GPIO=y
CONFIG_SERIAL=y
# enable console
CONFIG_CONSOLE=y
CONFIG_UART_CONSOLE=y
# enable sam-ba bootloader on legacy mode
CONFIG_BOOTLOADER_BOSSA=y
CONFIG_BOOTLOADER_BOSSA_LEGACY=y
# additional board options
CONFIG_GPIO_AS_PINRESET=y
CONFIG_PINCTRL=y

View file

@ -51,6 +51,7 @@
defined(CONFIG_BOARD_BT510) || \ defined(CONFIG_BOARD_BT510) || \
defined(CONFIG_BOARD_PINNACLE_100_DVK) || \ defined(CONFIG_BOARD_PINNACLE_100_DVK) || \
defined(CONFIG_BOARD_ARDUINO_NANO_33_BLE) || \ defined(CONFIG_BOARD_ARDUINO_NANO_33_BLE) || \
defined(CONFIG_BOARD_ARDUINO_NANO_33_BLE_SENSE) || \
defined(CONFIG_BOARD_UBX_BMD300EVAL_NRF52832) || \ defined(CONFIG_BOARD_UBX_BMD300EVAL_NRF52832) || \
defined(CONFIG_BOARD_UBX_BMD330EVAL_NRF52810) || \ defined(CONFIG_BOARD_UBX_BMD330EVAL_NRF52810) || \
defined(CONFIG_BOARD_UBX_BMD340EVAL_NRF52840) || \ defined(CONFIG_BOARD_UBX_BMD340EVAL_NRF52840) || \