boards: arduino_nicla_vision: add Arduino Nicla Vision

Initial board support and documentation.

Signed-off-by: Felipe Neves <ryukokki.felipe@gmail.com>
This commit is contained in:
Felipe Neves 2024-08-22 12:20:57 -03:00 committed by Anas Nashif
commit 419edffabf
17 changed files with 633 additions and 0 deletions

View file

@ -0,0 +1,6 @@
# Copyright 2024 Felipe Neves
# SPDX-License-Identifier: Apache-2.0
config BOARD_ARDUINO_NICLA_VISION
select SOC_STM32H747XX_M7 if BOARD_ARDUINO_NICLA_VISION_STM32H747XX_M7
select SOC_STM32H747XX_M4 if BOARD_ARDUINO_NICLA_VISION_STM32H747XX_M4

View file

@ -0,0 +1,18 @@
# Copyright 2024 Felipe Neves
# SPDX-License-Identifier: Apache-2.0
if BOARD_ARDUINO_NICLA_VISION
if BT
choice AIROC_PART
default CYW4343W
endchoice
choice CYW4343W_MODULE
default CYW4343W_MURATA_1DX
endchoice
endif # BT
endif # BOARD_ARDUINO_NICLA_VISION

View file

@ -0,0 +1,33 @@
/*
* Copyright 2024 Felipe Neves
*
* SPDX-License-Identifier: Apache-2.0
*/
/ {
leds {
compatible = "gpio-leds";
red_led: led_0 {
gpios = <&gpioe 3 GPIO_ACTIVE_LOW>;
};
green_led: led_1 {
gpios = <&gpioc 13 GPIO_ACTIVE_LOW>;
};
blue_led: led_2 {
gpios = <&gpiof 4 GPIO_ACTIVE_LOW>;
};
};
};
&rcc {
d1cpre = <1>;
hpre = <2>;
d1ppre = <2>;
d2ppre1 = <2>;
d2ppre2 = <2>;
d3ppre = <2>;
};
&mailbox {
status = "okay";
};

View file

@ -0,0 +1,37 @@
/*
* Copyright 2024 Felipe Neves
*
* SPDX-License-Identifier: Apache-2.0
*/
/dts-v1/;
#include <st/h7/stm32h747Xi_m4.dtsi>
#include <st/h7/stm32h747a(g-i)ix-pinctrl.dtsi>
#include "arduino_nicla_vision.dtsi"
/ {
model = "Arduino Nicla Vision Board (M4)";
compatible = "arduino,nicla-vision";
chosen {
zephyr,console = &uart4;
zephyr,shell-uart = &uart4;
zephyr,sram = &sram1;
zephyr,flash = &flash1;
};
aliases {
led0 = &blue_led;
};
};
&rcc {
clock-frequency = <DT_FREQ_M(240)>;
};
&uart4 {
status = "okay";
pinctrl-0 = <&uart4_tx_pb9 &uart4_rx_pb8>;
pinctrl-names = "default";
current-speed = <115200>;
};

View file

@ -0,0 +1,18 @@
identifier: arduino_nicla_vision/stm32h747xx/m4
name: Arduino Nicla Vision (M4)
type: mcu
arch: arm
toolchain:
- zephyr
- gnuarmemb
- xtools
ram: 288
flash: 1024
supported:
- gpio
testing:
ignore_tags:
- mpu
- nfc
- net
vendor: arduino

View file

@ -0,0 +1,24 @@
# Copyright 2024 Felipe Neves
# SPDX-License-Identifier: Apache-2.0
# Enable GPIO
CONFIG_GPIO=y
# Clock configuration
CONFIG_CLOCK_CONTROL=y
# Enable MPU
CONFIG_ARM_MPU=y
# Enable HW stack protection
CONFIG_HW_STACK_PROTECTION=y
# Enable uart driver
CONFIG_SERIAL=y
# Console
CONFIG_CONSOLE=y
CONFIG_UART_CONSOLE=y
# Enable pin controller
CONFIG_PINCTRL=y

View file

@ -0,0 +1,194 @@
/*
* Copyright 2024 Felipe Neves
*
* SPDX-License-Identifier: Apache-2.0
*/
/dts-v1/;
#include <st/h7/stm32h747Xi_m7.dtsi>
#include <st/h7/stm32h747a(g-i)ix-pinctrl.dtsi>
#include <zephyr/dt-bindings/memory-attr/memory-attr-arm.h>
#include "arduino_nicla_vision.dtsi"
/ {
model = "Arduino Nicla Vision Board (M7)";
compatible = "arduino,nicla-vision";
chosen {
zephyr,console = &lpuart1;
zephyr,shell-uart = &lpuart1;
zephyr,uart-mcumgr = &lpuart1;
zephyr,bt-hci = &bt_hci_uart;
zephyr,sram = &sram0;
zephyr,flash = &flash0;
zephyr,code-partition = &slot0_partition;
};
sdram1: sdram@c0000000 {
compatible = "zephyr,memory-region", "mmio-sram";
device_type = "memory";
reg = <0xc0000000 DT_SIZE_M(8)>;
zephyr,memory-region = "SDRAM1";
zephyr,memory-attr = <( DT_MEM_ARM(ATTR_MPU_RAM) )>;
};
aliases {
led0 = &red_led;
led1 = &green_led;
};
otghs_ulpi_phy: otghs_ulpis_phy {
compatible = "usb-ulpi-phy";
#phy-cells = <0>;
};
};
&clk_hse {
status = "okay";
clock-frequency = <DT_FREQ_M(25)>;
};
&clk_lse {
status = "okay";
};
&clk_hsi48 {
status = "okay";
};
&pll {
div-m = <5>;
mul-n = <192>;
div-p = <2>;
div-q = <4>;
div-r = <2>;
clocks = <&clk_hse>;
status = "okay";
};
&rcc {
clocks = <&pll>;
clock-frequency = <DT_FREQ_M(480)>;
};
&lpuart1 {
status = "okay";
pinctrl-0 = <&lpuart1_tx_pa9 &lpuart1_rx_pa10>;
pinctrl-names = "default";
current-speed = <115200>;
};
&usart1 {
pinctrl-0 = <&usart1_rx_pb7 &usart1_tx_pb6
&usart1_rts_pa12 &usart1_cts_pa11>;
pinctrl-names = "default";
current-speed = <115200>;
status = "okay";
hw-flow-control;
bt_hci_uart: bt_hci_uart {
compatible = "zephyr,bt-hci-uart";
status = "okay";
murata-1dx {
compatible = "infineon,cyw43xxx-bt-hci";
bt-reg-on-gpios = <&gpiof 14 GPIO_ACTIVE_HIGH>;
bt-host-wake-gpios = <&gpiod 14 GPIO_ACTIVE_HIGH>;
bt-dev-wake-gpios = <&gpioe 9 GPIO_ACTIVE_HIGH>;
fw-download-speed = <115200>;
};
};
};
&i2c1 {
status = "disabled";
pinctrl-0 = <&i2c1_scl_pb8 &i2c1_sda_pb9>;
pinctrl-names = "default";
clock-frequency = <I2C_BITRATE_FAST>;
};
&i2c2 {
status = "okay";
pinctrl-0 = <&i2c2_scl_pf1 &i2c2_sda_pf0>;
pinctrl-names = "default";
clock-frequency = <I2C_BITRATE_FAST>;
vl53l1x: vl53l1x@52 {
compatible = "st,vl53l1x";
reg = <0x52>;
status = "okay";
xshut-gpios = <&gpiog 10 GPIO_ACTIVE_HIGH>;
int-gpios = <&gpiod 8 GPIO_ACTIVE_HIGH>;
};
};
&i2c3 {
status = "okay";
pinctrl-0 = <&i2c3_scl_pa8 &i2c3_sda_pc9>;
pinctrl-names = "default";
clock-frequency = <I2C_BITRATE_FAST>;
};
&spi4 {
status = "okay";
pinctrl-0 = <&spi4_nss_pe11 &spi4_sck_pe12
&spi4_miso_pe13 &spi4_mosi_pe14>;
pinctrl-names = "default";
};
&spi5 {
status = "okay";
pinctrl-0 = <&spi5_nss_pf6 &spi5_sck_pf7
&spi5_miso_pf8 &spi5_mosi_pf11>;
pinctrl-names = "default";
lsm6dso: lsm6dso@0 {
compatible = "st,lsm6dso";
status = "okay";
reg = <0x0>;
irq-gpios = <&gpioa 1 GPIO_ACTIVE_LOW>;
spi-max-frequency = <4000000>;
};
};
&flash0 {
partitions {
compatible = "fixed-partitions";
#address-cells = <1>;
#size-cells = <1>;
boot_partition: partition@0 {
label = "bootloader";
reg = <0x0 0x40000>;
read-only;
};
slot0_partition: partition@40000 {
label = "image-0";
reg = <0x40000 0x000c0000>;
};
};
};
&rng {
status = "okay";
};
zephyr_udc0: &usbotg_hs {
pinctrl-0 = <&usb_otg_hs_ulpi_ck_pa5
&usb_otg_hs_ulpi_d0_pa3
&usb_otg_hs_ulpi_d1_pb0
&usb_otg_hs_ulpi_d2_pb1
&usb_otg_hs_ulpi_d3_pb10
&usb_otg_hs_ulpi_d4_pb11
&usb_otg_hs_ulpi_d5_pb12
&usb_otg_hs_ulpi_d6_pb13
&usb_otg_hs_ulpi_d7_pb5
&usb_otg_hs_ulpi_stp_pc0
&usb_otg_hs_ulpi_dir_pc2_c
&usb_otg_hs_ulpi_nxt_pc3_c>;
pinctrl-names = "default";
maximum-speed = "high-speed";
phys = <&otghs_ulpi_phy>;
status = "okay";
};

View file

@ -0,0 +1,15 @@
identifier: arduino_nicla_vision/stm32h747xx/m7
name: Arduino Nicla Vision (M7)
type: mcu
arch: arm
toolchain:
- zephyr
- gnuarmemb
- xtools
ram: 512
flash: 1024
supported:
- gpio
- spi
- i2c
vendor: arduino

View file

@ -0,0 +1,30 @@
# Copyright 2024 Felipe Neves
# SPDX-License-Identifier: Apache-2.0
# Disable the internal SMPS regulator
CONFIG_POWER_SUPPLY_DIRECT_SMPS=n
# Enable GPIO
CONFIG_GPIO=y
# Enable clocks
CONFIG_CLOCK_CONTROL=y
# Enable MPU
CONFIG_ARM_MPU=y
# Enable HW stack protection
CONFIG_HW_STACK_PROTECTION=y
# Enable uart driver
CONFIG_SERIAL=y
# Console
CONFIG_CONSOLE=y
CONFIG_UART_CONSOLE=y
# Enable pin controller
CONFIG_PINCTRL=y
# Use zephyr,code-partition as flash offset
CONFIG_USE_DT_CODE_PARTITION=y

View file

@ -0,0 +1,18 @@
# SPDX-License-Identifier: Apache-2.0
if(CONFIG_BOARD_ARDUINO_NICLA_VISION_STM32H747XX_M7)
board_runner_args(jlink "--device=STM32H747XI_M7" "--speed=4000")
board_runner_args(openocd "--config=${BOARD_DIR}/support/openocd_arduino_nicla_vision_m7.cfg")
board_runner_args(openocd --target-handle=_CHIPNAME.cpu0)
elseif(CONFIG_BOARD_ARDUINO_NICLA_VISION_STM32H747XX_M4)
board_runner_args(jlink "--device=STM32H747XI_M4" "--speed=4000")
board_runner_args(openocd "--config=${BOARD_DIR}/support/openocd_arduino_nicla_vision_m4.cfg")
board_runner_args(openocd --target-handle=_CHIPNAME.cpu1)
endif()
board_runner_args(dfu-util "--pid=2341:035f" "--alt=0" "--dfuse")
board_runner_args(blackmagicprobe "--connect-rst")
include(${ZEPHYR_BASE}/boards/common/dfu-util.board.cmake)
include(${ZEPHYR_BASE}/boards/common/blackmagicprobe.board.cmake)
include(${ZEPHYR_BASE}/boards/common/jlink.board.cmake)
include(${ZEPHYR_BASE}/boards/common/openocd.board.cmake)

View file

@ -0,0 +1,5 @@
board:
name: arduino_nicla_vision
vendor: arduino
socs:
- name: stm32h747xx

Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

View file

@ -0,0 +1,193 @@
.. _arduino_nicla_vision_board:
Arduino Nicla Vision
####################
Overview
********
Arduino Nicla Vision is a development board by Arduino based on the
STM32H747GAII, a dual core ARM Cortex-M7 + Cortex-M4 MCU, with 2MBytes of Flash
memory and 1MB SRAM.
The board features:
- RGB LED
- Reset Boot button
- USB device
- Murata Type 1DX Bluetooth + WiFi module (CYW4343W based)
- GC2145 2 Megapixel Camera Sensor
- SE050C2HQ1 Crypto IC
- MP34DT06JTR Omnidirectional Microphone
- VL53L1CBV0FY ToF Sensor
- LSM6DSOXTR Gyro+Accelerometer Sensor
.. image:: img/arduino_nicla_vision.webp
:align: center
:alt: Arduino Nicla Vision
More information about the board, including the datasheet, pinout and
schematics, can be found at the `Arduino Nicla Vision website`_.
More information about STM32H747GAII6 can be found here:
- `STM32H747XI on www.st.com`_
- `STM32H747xx reference manual`_
- `STM32H747xx datasheet`_
Supported Features
==================
The current Zephyr ``arduino_nicla_vision/stm32h747xx/m7`` board configuration supports the
following hardware features:
+-----------+------------+-------------------------------------+
| Interface | Controller | Driver/Component |
+===========+============+=====================================+
| NVIC | on-chip | nested vector interrupt controller |
+-----------+------------+-------------------------------------+
| UART | on-chip | serial port-polling; |
| | | serial port-interrupt |
+-----------+------------+-------------------------------------+
| PINMUX | on-chip | pinmux |
+-----------+------------+-------------------------------------+
| GPIO | on-chip | gpio |
+-----------+------------+-------------------------------------+
| FLASH | on-chip | flash memory |
+-----------+------------+-------------------------------------+
| RNG | on-chip | True Random number generator |
+-----------+------------+-------------------------------------+
| I2C | on-chip | i2c |
+-----------+------------+-------------------------------------+
| SPI | on-chip | spi |
+-----------+------------+-------------------------------------+
| IPM | on-chip | virtual mailbox based on HSEM |
+-----------+------------+-------------------------------------+
| RADIO | Murata 1DX | WiFi and Bluetooth module |
+-----------+------------+-------------------------------------+
And the ``arduino_nicla_vision/stm32h747xx/m4`` has the following
support from Zephyr:
+-----------+------------+-------------------------------------+
| Interface | Controller | Driver/Component |
+===========+============+=====================================+
| NVIC | on-chip | nested vector interrupt controller |
+-----------+------------+-------------------------------------+
| UART | on-chip | serial port-polling; |
| | | serial port-interrupt |
+-----------+------------+-------------------------------------+
| PINMUX | on-chip | pinmux |
+-----------+------------+-------------------------------------+
| GPIO | on-chip | gpio |
+-----------+------------+-------------------------------------+
Other hardware features are not yet supported on Zephyr port.
Fetch Binary Blobs
******************
The board Bluetooth/WiFi module requires fetching some binary blob files, to do
that run the command:
.. code-block:: console
west blobs fetch hal_infineon
.. note:: Only Bluetooth functionality is currently supported.
Resources sharing
=================
The dual core nature of STM32H747 SoC requires sharing HW resources between the
two cores. This is done in 3 ways:
- **Compilation**: Clock configuration is only accessible to M7 core. M4 core only
has access to bus clock activation and deactivation.
- **Static pre-compilation assignment**: Peripherals such as a UART are assigned in
devicetree before compilation. The user must ensure peripherals are not assigned
to both cores at the same time.
- **Run time protection**: Interrupt-controller and GPIO configurations could be
accessed by both cores at run time. Accesses are protected by a hardware semaphore
to avoid potential concurrent access issues.
Programming and Debugging
*************************
Applications for the ``arduino_nicla_vision`` board should be built per core target,
using either ``arduino_nicla_vision/stm32h747xx/m7`` or ``arduino_nicla_vision/stm32h747xx/m4`` as the target.
See :ref:`build_an_application` for more information about application builds.
Flashing
========
This board can be flashed either using dfu-util, or with an external debugging
probe, such as a J-Link or Black Magic Probe, connected to the on board MIPI-10
SWD port marked as "JTAG".
.. note::
The board ships with a custom Arduino bootloader programmed in the first
flash page that can be triggered by double clicking the ``RST`` button. This
bootloader is USB-DFU compatible and supports programming both the internal
and external flash and is the one used by ``west flash`` by default.
First, connect the Arduino Nicla Vision board to your host computer using the USB
port to prepare it for flashing. Double click the ``RST`` button to put the
board into the Arduino Bootloader mode. Then build and flash your application.
Here is an example for the :ref:`hello_world` application.
.. zephyr-app-commands::
:zephyr-app: samples/hello_world
:board: arduino_nicla_vision/stm32h747xx/m7
:goals: build flash
Run a serial host program to connect with your board:
.. code-block:: console
$ minicom -D /dev/ttyACM0
You should see the following message on the console:
.. code-block:: console
Hello World! arduino_nicla_vision
Similarly, you can build and flash samples on the M4 target.
Here is an example for the :zephyr:code-sample:`blinky` application on M4 core.
.. zephyr-app-commands::
:zephyr-app: samples/basic/blinky
:board: arduino_nicla_vision/stm32h747xx/m4
:goals: build flash
Debugging
=========
Debugging is supported by using ``west debug`` with an external probe such as a
J-Link or Black Magic Probe, connected to the on board through the edge eslov pins
as "SWD". For example::
west debug -r jlink
.. _Arduino Nicla Vision website:
https://docs.arduino.cc/hardware/nicla-vision/
.. _Arduino Nicla Vision User Manual:
https://docs.arduino.cc/tutorials/nicla-vision/user-manual/
.. _STM32H747XI on www.st.com:
https://www.st.com/content/st_com/en/products/microcontrollers-microprocessors/stm32-32-bit-arm-cortex-mcus/stm32-high-performance-mcus/stm32h7-series/stm32h747-757/stm32h747xi.html
.. _STM32H747xx reference manual:
https://www.st.com/resource/en/reference_manual/dm00176879.pdf
.. _STM32H747xx datasheet:
https://www.st.com/resource/en/datasheet/stm32h747xi.pdf
.. _dfu-util:
http://dfu-util.sourceforge.net/build.html

View file

@ -0,0 +1,12 @@
source [find interface/stlink.cfg]
transport select hla_swd
set DUAL_BANK 1
set DUAL_CORE 1
source [find target/stm32h7x.cfg]
reset_config srst_only srst_nogate connect_assert_srst

View file

@ -0,0 +1,28 @@
source [find interface/stlink.cfg]
transport select hla_swd
source [find target/stm32h7x.cfg]
# Use connect_assert_srst here to be able to program
# even when core is in sleep mode
reset_config srst_only srst_nogate connect_assert_srst
$_CHIPNAME.cpu0 configure -event gdb-attach {
echo "Debugger attaching: halting execution"
gdb_breakpoint_override hard
}
$_CHIPNAME.cpu0 configure -event gdb-detach {
echo "Debugger detaching: resuming execution"
resume
}
# Due to the use of connect_assert_srst, running gdb requires
# to reset halt just after openocd init.
rename init old_init
proc init {} {
old_init
reset halt
}

View file

@ -12,6 +12,7 @@ tests:
- stm32h7s78_dk - stm32h7s78_dk
- gd32f350r_eval - gd32f350r_eval
- arduino_portenta_h7/stm32h747xx/m4 - arduino_portenta_h7/stm32h747xx/m4
- arduino_nicla_vision/stm32h747xx/m4
- arduino_giga_r1/stm32h747xx/m4 - arduino_giga_r1/stm32h747xx/m4
- nucleo_h755zi_q/stm32h755xx/m4 - nucleo_h755zi_q/stm32h755xx/m4
harness: keyboard harness: keyboard

View file

@ -12,6 +12,7 @@ common:
- native_sim - native_sim
platform_exclude: platform_exclude:
- arduino_giga_r1/stm32h747xx/m4 - arduino_giga_r1/stm32h747xx/m4
- arduino_nicla_vision/stm32h747xx/m4
- arduino_portenta_h7/stm32h747xx/m4 - arduino_portenta_h7/stm32h747xx/m4
- lpcxpresso51u68 - lpcxpresso51u68
- nucleo_h745zi_q/stm32h745xx/m4 - nucleo_h745zi_q/stm32h745xx/m4