Skip to content

Commit 35c5fbe

Browse files
saltyJeffMaureenHelm
authored andcommitted
boards: Add the Arduino Nano BLE 33
This commit adds the board definition files needed to support the Arduino Nano BLE 33. Tested: the following have been verified with my logic analyzer. * Serial peripherals (UART, I2C, SPI) * USB * RTC Untested: * PWM. In theory it should work but I don't have a good enough logic analyzer to test this * RTC's. The board doesn't have a backup battery. The peripherals are enabled for modding another battery in the device tree. Signed-off-by: Jefferson Lee <[email protected]>
1 parent f4a2683 commit 35c5fbe

File tree

13 files changed

+534
-1
lines changed

13 files changed

+534
-1
lines changed
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# Copyright (c) 2020 Jefferson Lee.
2+
# SPDX-License-Identifier: Apache-2.0
3+
4+
add_library(arduino_nano_33_ble_pins INTERFACE)
5+
target_include_directories(arduino_nano_33_ble_pins
6+
INTERFACE "${CMAKE_CURRENT_SOURCE_DIR}/inc/")
7+
8+
9+
if(CONFIG_BOARD_ARDUINO_NANO_33_BLE_INIT_SENSORS)
10+
zephyr_library()
11+
zephyr_library_sources("${CMAKE_CURRENT_SOURCE_DIR}/src/init_sensors.c")
12+
target_link_libraries(${ZEPHYR_CURRENT_LIBRARY} PRIVATE arduino_nano_33_ble_pins)
13+
endif()
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# Copyright (c) 2020 Jefferson Lee.
2+
# SPDX-License-Identifier: Apache-2.0
3+
4+
config BOARD_ARDUINO_NANO_33_BLE
5+
bool "Arduino Nano 33 BLE board"
6+
depends on SOC_NRF52840_QIAA
7+
8+
config BOARD_ARDUINO_NANO_33_BLE_EN_USB_CONSOLE
9+
bool "Sends the console output over the USB port"
10+
depends on BOARD_ARDUINO_NANO_33_BLE
11+
select SERIAL
12+
select USB
13+
select CONSOLE
14+
select PRINTK
15+
select UART_INTERRUPT_DRIVEN
16+
select USB_UART_CONSOLE
17+
18+
config BOARD_ARDUINO_NANO_33_BLE_INIT_SENSORS
19+
bool "Initializes the internal I2C sensors on the board"
20+
depends on BOARD_ARDUINO_NANO_33_BLE
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
# Copyright (c) 2020 Jefferson Lee.
2+
# SPDX-License-Identifier: Apache-2.0
3+
4+
if BOARD_ARDUINO_NANO_33_BLE
5+
config BOARD
6+
default "arduino_nano_33_ble"
7+
8+
if USB
9+
config USB_NRFX
10+
default y
11+
config USB_DEVICE_STACK
12+
default y
13+
endif # USB
14+
15+
config BT_CTLR
16+
default BT
17+
18+
if I2C
19+
config I2C_NRFX
20+
default y
21+
config NRFX_TWIM
22+
default y
23+
config I2C_0
24+
default y
25+
config I2C_1
26+
default y
27+
config BOARD_ARDUINO_NANO_33_BLE_INIT_SENSORS
28+
default y
29+
endif #I2C
30+
31+
if SPI
32+
config SPI_NRFX
33+
default y
34+
config NRFX_SPIM
35+
default y
36+
config SPI_2
37+
default y
38+
config SPI_2_NRF_SPIM
39+
default y
40+
endif #SPI
41+
42+
endif #board
Lines changed: 125 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,125 @@
1+
/*
2+
* Copyright (c) 2020 Jefferson Lee
3+
*
4+
* SPDX-License-Identifier: Apache-2.0
5+
*/
6+
/dts-v1/;
7+
#include <nordic/nrf52840_qiaa.dtsi>
8+
9+
/ {
10+
model = "Arduino Nano 33 BLE (Sense)";
11+
compatible = "arduino,arduino_nano_33_ble";
12+
13+
chosen {
14+
zephyr,console = &uart0;
15+
zephyr,shell-uart = &uart0;
16+
zephyr,uart-mcumgr = &uart0;
17+
zephyr,bt-mon-uart = &uart0;
18+
zephyr,bt-c2h-uart = &uart0;
19+
zephyr,sram = &sram0;
20+
zephyr,flash = &flash0;
21+
zephyr,code-partition = &code_partition;
22+
};
23+
24+
leds {
25+
compatible = "gpio-leds";
26+
led0: led_0 {
27+
gpios = <&gpio0 24 0>;
28+
label = "Red LED";
29+
};
30+
};
31+
32+
/* These aliases are provided for compatibility with samples */
33+
aliases {
34+
led0 = &led0;
35+
spi = &spi2;
36+
};
37+
};
38+
39+
&flash0 {
40+
partitions {
41+
compatible = "fixed-partitions";
42+
#address-cells = <1>;
43+
#size-cells = <1>;
44+
45+
code_partition: partition@10000 {
46+
label = "code";
47+
reg = <0x10000 0xf0000>;
48+
read-only;
49+
};
50+
};
51+
};
52+
53+
/*
54+
* guide specifying pin numbers: https://docs.zephyrproject.org/latest/boards/arm/nrf52840dk_nrf52840/doc/index.html
55+
* Given Pin PB.A:
56+
* pin_no = B*32 + A
57+
* ex. P1.0 => 32
58+
*/
59+
&adc {
60+
status = "okay";
61+
};
62+
&uart0 {
63+
compatible = "nordic,nrf-uart";
64+
current-speed = <115200>;
65+
status = "okay";
66+
tx-pin = <35>; //P1.03
67+
rx-pin = <42>; //P1.10
68+
};
69+
&i2c0 {
70+
compatible = "nordic,nrf-twim";
71+
status = "okay";
72+
sda-pin = <31>; //P0.31
73+
scl-pin = <2>; //P0.02
74+
};
75+
&i2c1 {
76+
compatible = "nordic,nrf-twim";
77+
status = "okay";
78+
sda-pin = <14>; //P0.14
79+
scl-pin = <15>; //P0.15
80+
};
81+
// we use SPI2 because SPI1/0 shares conflicts with I2C1/0
82+
&spi2 {
83+
compatible = "nordic,nrf-spim";
84+
status = "okay";
85+
sck-pin = <13>; //P0.13
86+
mosi-pin = <33>; //P1.01
87+
miso-pin = <40>; //P1.08
88+
};
89+
&gpio0 {
90+
status = "okay";
91+
};
92+
&gpio1 {
93+
status = "okay";
94+
};
95+
&usbd {
96+
compatible = "nordic,nrf-usbd";
97+
status = "okay";
98+
};
99+
// All PWM's should be enaled
100+
&pwm0 {
101+
status = "okay";
102+
};
103+
&pwm1 {
104+
status = "okay";
105+
};
106+
&pwm2 {
107+
status = "okay";
108+
};
109+
&pwm3 {
110+
status = "okay";
111+
};
112+
/*
113+
* NOTE: curiously, there is no PDM (microphone) interface in the
114+
* nordic DTSI file.
115+
* You'll need to use the nordic-specific PDM libraries.
116+
*/
117+
118+
/*
119+
* the following sets up the peripherals according to this file:
120+
* https://github.com/arduino/ArduinoCore-nRF528x-mbedos/blob/19ddd214d255ca20b233eefa76662b360595c146/variants/ARDUINO_NANO33BLE/variant.cpp#L136
121+
* The bootloader will conflict with RTC1
122+
*/
123+
&rtc1 {
124+
status = "disabled";
125+
};
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
identifier: arduino_nano_33_ble
2+
name: Arduino Nano 33 BLE (Sense)
3+
type: mcu
4+
arch: arm
5+
toolchain:
6+
- zephyr
7+
- gnuarmemb
8+
- xtools
9+
supported:
10+
- adc
11+
- ble
12+
- i2c
13+
- ieee802154
14+
- pwm
15+
- serial
16+
- spi
17+
- uart
18+
- usb_cdc
19+
- usb_device
20+
- watchdog
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# SPDX-License-Identifier: Apache-2.0
2+
3+
CONFIG_SOC_SERIES_NRF52X=y
4+
CONFIG_SOC_NRF52840_QIAA=y
5+
CONFIG_BOARD_ARDUINO_NANO_33_BLE=y
6+
7+
# Enable MPU
8+
CONFIG_ARM_MPU=y
9+
CONFIG_HW_STACK_PROTECTION=y
10+
11+
# enable peripherals
12+
CONFIG_GPIO=y
13+
CONFIG_SERIAL=y
14+
CONFIG_CONSOLE=y
15+
16+
# enable flashing and linker options
17+
CONFIG_USE_DT_CODE_PARTITION=y
18+
19+
# additional board options
20+
CONFIG_GPIO_AS_PINRESET=y
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# SPDX-License-Identifier: Apache-2.0
2+
3+
include(${ZEPHYR_BASE}/boards/common/bossac.board.cmake)
182 KB
Loading
Lines changed: 141 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,141 @@
1+
.. _arduino_nano_33_ble:
2+
3+
Arduino Nano 33 BLE (Sense)
4+
#################################
5+
6+
Overview
7+
********
8+
9+
The Arduino Nano 33 BLE is designed around Nordic Semiconductor's
10+
nRF52840 ARM Cortex-M4F CPU. Arduino sells 2 variants of the board, the
11+
plain `BLE`_ type and the `BLE Sense`_ type. The "Sense" variant is distinguished by
12+
the inclusion of more sensors, but otherwise both variants are the same.
13+
14+
.. image:: img/arduino_nano_33_ble_sense.png
15+
:width: 500px
16+
:align: center
17+
:alt: Arduino Nano 33 BLE (Sense variant)
18+
19+
The Sense variant of the board
20+
21+
Hardware
22+
********
23+
24+
Supported Features
25+
==================
26+
27+
The package is configured to support the following hardware:
28+
29+
+-----------+------------+----------------------+
30+
| Interface | Controller | Driver/Component |
31+
+===========+============+======================+
32+
| ADC | on-chip | adc |
33+
+-----------+------------+----------------------+
34+
| CLOCK | on-chip | clock_control |
35+
+-----------+------------+----------------------+
36+
| FLASH | on-chip | flash |
37+
+-----------+------------+----------------------+
38+
| GPIO | on-chip | gpio |
39+
+-----------+------------+----------------------+
40+
| I2C0 | on-chip | i2c |
41+
+-----------+------------+----------------------+
42+
| I2C1 | on-chip | i2c |
43+
+-----------+------------+----------------------+
44+
| MPU | on-chip | arch/arm |
45+
+-----------+------------+----------------------+
46+
| NVIC | on-chip | arch/arm |
47+
+-----------+------------+----------------------+
48+
| PWM | on-chip | pwm |
49+
+-----------+------------+----------------------+
50+
| RADIO | on-chip | Bluetooth, |
51+
| | | ieee802154 |
52+
+-----------+------------+----------------------+
53+
| RTC | on-chip | system clock |
54+
+-----------+------------+----------------------+
55+
| SPI | on-chip | spi |
56+
+-----------+------------+----------------------+
57+
| UART | on-chip | serial |
58+
+-----------+------------+----------------------+
59+
| USB | on-chip | usb |
60+
+-----------+------------+----------------------+
61+
| WDT | on-chip | watchdog |
62+
+-----------+------------+----------------------+
63+
64+
Other hardware features are not supported by the Zephyr kernel.
65+
66+
Notably, this includes the PDM (microphone) interface.
67+
68+
Connections and IOs
69+
===================
70+
71+
The `schematic`_ will tell you everything
72+
you need to know about the pins.
73+
74+
A convinience header mapping the Arduino pin names to their
75+
Zephyr pin numbers can be found in :code:`arduino_nano_33_ble_pins.h`,
76+
if you link against the :code:`arduino_nano_33_ble_pins` CMake library.
77+
78+
For your convience, two Kconfig options are added:
79+
80+
#. :code:`BOARD_ARDUINO_NANO_33_BLE_INIT_SENSORS`:
81+
This configuration option enables the internal I2C sensors.
82+
#. :code:`BOARD_ARDUINO_NANO_33_BLE_EN_USB_CONSOLE`:
83+
This configuration option enables the USB CDC subsystem and
84+
the console, so that printk works.
85+
86+
Programming and Debugging
87+
*************************
88+
89+
This board requires the Arduino variant of bossac. You will not
90+
be able to flash with the bossac included with the zephyr-sdk, or
91+
using shumatech's mainline build.
92+
93+
You can get this variant of bossac with one of two ways:
94+
95+
#. Building the binary from the `Arduino source tree <https://github.com/arduino/BOSSA/tree/nrf>`_
96+
#. Downloading the Arduino IDE
97+
98+
#. Install the board support package within the IDE
99+
#. Change your IDE preferences to provide verbose logging
100+
#. Build and flash a sample application, and read the logs to figure out where Arduino stored bossac.
101+
102+
Once you have a path to bossac, you can pass it as an argument to west:
103+
104+
.. code-block:: bash
105+
106+
west flash --bossac="<path to the arduino version of bossac>"
107+
108+
Flashing
109+
========
110+
111+
Attach the board to your computer using the USB cable, and then
112+
113+
.. zephyr-app-commands::
114+
:zephyr-app: samples/blinky
115+
:board: arduino_nano_33_ble
116+
:goals: build
117+
:compact:
118+
119+
Double-tap the RESET button on your board. Your board should disconnect, reconnect,
120+
and there should be a pulsing orange LED near the USB port.
121+
122+
Then, you can flash the image using the above script.
123+
124+
You should see the the red LED blink.
125+
126+
References
127+
**********
128+
129+
.. target-notes::
130+
131+
.. _BLE:
132+
https://store.arduino.cc/usa/nano-33-ble/
133+
134+
.. _BLE SENSE:
135+
https://store.arduino.cc/usa/nano-33-ble-sense/
136+
137+
.. _pinouts:
138+
https://learn.adafruit.com/introducing-the-adafruit-nrf52840-feather/pinouts
139+
140+
.. _schematic:
141+
https://content.arduino.cc/assets/NANO33BLE_V2.0_sch.pdf

0 commit comments

Comments
 (0)