boards: xtensa: m5stickc_plus: initial support

adds initial support for M5StickC-Plus board

Signed-off-by: Jakub Zimnol <j.zimnol@avsystem.com>
This commit is contained in:
Jakub Zimnol 2022-09-05 12:12:52 +02:00 committed by Carles Cufí
commit e065050f1b
10 changed files with 458 additions and 1 deletions

View file

@ -0,0 +1,8 @@
# M5StickC PLUS board configuration
# Copyright (c) 2022 AVSystem Sławomir Wolf Sp.j. (AVSystem)
# SPDX-License-Identifier: Apache-2.0
config BOARD_M5STICKC_PLUS
bool "M5StickC PLUS Development Board"
depends on SOC_ESP32

View file

@ -0,0 +1,25 @@
# M5StickC PLUS board configuration
# Copyright (c) 2022 AVSystem Sławomir Wolf Sp.j. (AVSystem)
# SPDX-License-Identifier: Apache-2.0
config BOARD
default "m5stickc_plus"
depends on BOARD_M5STICKC_PLUS
config ENTROPY_ESP32_RNG
default y if ENTROPY_GENERATOR
if BT
config HEAP_MEM_POOL_SIZE
default 16384
config ENTROPY_GENERATOR
default y
choice BT_HCI_BUS_TYPE
default BT_ESP32
endchoice
endif # BT

View file

@ -0,0 +1,9 @@
# SPDX-License-Identifier: Apache-2.0
if(NOT "${OPENOCD}" MATCHES "^${ESPRESSIF_TOOLCHAIN_PATH}/.*")
set(OPENOCD OPENOCD-NOTFOUND)
endif()
find_program(OPENOCD openocd PATHS ${ESPRESSIF_TOOLCHAIN_PATH}/openocd-esp32/bin NO_DEFAULT_PATH)
include(${ZEPHYR_BASE}/boards/common/esp32.board.cmake)
include(${ZEPHYR_BASE}/boards/common/openocd.board.cmake)

View file

@ -0,0 +1,137 @@
.. _m5stickc_plus:
M5StickC PLUS
#############
Overview
********
M5StickC PLUS, one of the core devices in M5Stacks product series, is an ESP32-based development board.
M5StickC PLUS features the following integrated components:
- ESP32-PICO-D4 chip (240MHz dual core, 600 DMIPS, 520KB SRAM, Wi-Fi)
- ST7789v2, LCD TFT 1.14", 135x240 px screen
- IMU MPU-6886
- SPM-1423 microphone
- RTC BM8563
- PMU AXP192
- 120 mAh 3,7 V battery
Some of the ESP32 I/O pins are broken out to the board's pin headers for easy access.
Functional Description
**********************
The following table below describes the key components, interfaces, and controls
of the M5StickC PLUS board.
.. _ST7789v2: https://m5stack.oss-cn-shenzhen.aliyuncs.com/resource/docs/datasheet/core/ST7789V.pdf
.. _MPU-6886: https://m5stack.oss-cn-shenzhen.aliyuncs.com/resource/docs/datasheet/core/MPU-6886-000193%2Bv1.1_GHIC_en.pdf
.. _ESP32-PICO-D4: https://m5stack.oss-cn-shenzhen.aliyuncs.com/resource/docs/datasheet/core/esp32-pico-d4_datasheet_en.pdf
.. _SPM-1423: https://m5stack.oss-cn-shenzhen.aliyuncs.com/resource/docs/datasheet/core/SPM1423HM4H-B_datasheet_en.pdf
+------------------+-------------------------------------------------------------------------+
| Key Component | Description |
+==================+=========================================================================+
| 32.768 kHz RTC | External precision 32.768 kHz crystal oscillator serves as a clock with |
| | low-power consumption while the chip is in Deep-sleep mode. |
+------------------+-------------------------------------------------------------------------+
| ESP32-PICO-D4 | This `ESP32-PICO-D4`_ module provides complete Wi-Fi and Bluetooth |
| module | functionalities and integrates a 4-MB SPI flash. |
+------------------+-------------------------------------------------------------------------+
| Diagnostic LED | One user LED connected to the GPIO pin. |
+------------------+-------------------------------------------------------------------------+
| USB Port | USB interface. Power supply for the board as well as the |
| | communication interface between a computer and the board. |
| | Contains: TypeC x 1, GROVE(I2C+I/O+UART) x 1 |
+------------------+-------------------------------------------------------------------------+
| Power Switch | Power on/off button. |
+------------------+-------------------------------------------------------------------------+
| A/B user buttons | Two push buttons intended for any user use. |
+------------------+-------------------------------------------------------------------------+
| LCD screen | Built-in LCD TFT display \(`ST7789v2`_, 1.14", 135x240 px\) controlled |
| | by the SPI interface |
+------------------+-------------------------------------------------------------------------+
| MPU-6886 | The `MPU-6886`_ is a 6-axis MotionTracking device that combines a |
| | 3-axis gyroscope and a 3-axis accelerometer. |
+------------------+-------------------------------------------------------------------------+
| Built-in | The `SPM-1423`_ I2S driven microphone. |
| microphone | |
+------------------+-------------------------------------------------------------------------+
Start Application Development
*****************************
Before powering up your M5StickC PLUS, please make sure that the board is in good
condition with no obvious signs of damage.
System requirements
===================
Prerequisites
-------------
Espressif HAL requires WiFi and Bluetooth binary blobs in order work. Run the command
below to retrieve those files.
.. code-block:: console
west blobs fetch hal_espressif
.. note::
It is recommended running the command above after :file:`west update`.
Building & Flashing
-------------------
Build and flash applications as usual (see :ref:`build_an_application` and
:ref:`application_run` for more details).
.. zephyr-app-commands::
:zephyr-app: samples/hello_world
:board: m5stickc_plus
:goals: build
The usual ``flash`` target will work with the ``m5stickc_plus`` board
configuration. Here is an example for the :ref:`hello_world`
application.
.. zephyr-app-commands::
:zephyr-app: samples/hello_world
:board: m5stickc_plus
:goals: flash
The baud rate of 921600bps is set by default. If experiencing issues when flashing,
try using different values by using ``--esp-baud-rate <BAUD>`` option during
``west flash`` (e.g. ``west flash --esp-baud-rate 115200``).
You can also open the serial monitor using the following command:
.. code-block:: shell
west espressif monitor
After the board has automatically reset and booted, you should see the following
message in the monitor:
.. code-block:: console
***** Booting Zephyr OS vx.x.x-xxx-gxxxxxxxxxxxx *****
Hello World! m5stickc_plus
Debugging
---------
M5StickC PLUS debugging is not supported due to pinout limitations.
Related Documents
*****************
- `M5StickC PLUS schematic <https://static-cdn.m5stack.com/resource/docs/products/core/m5stickc_plus/m5stickc_plus_sch_03.webp>`_ (WEBP)
- `ESP32-PICO-D4 Datasheet <https://www.espressif.com/sites/default/files/documentation/esp32-pico-d4_datasheet_en.pdf>`_ (PDF)
- `M5StickC PLUS docs <https://docs.m5stack.com/en/core/m5stickc_plus>`_
- `ESP32 Datasheet <https://www.espressif.com/sites/default/files/documentation/esp32_datasheet_en.pdf>`_ (PDF)
- `ESP32 Hardware Reference <https://docs.espressif.com/projects/esp-idf/en/latest/esp32/hw-reference/index.html>`_

View file

@ -0,0 +1,70 @@
/*
* Copyright (c) 2022 AVSystem Sławomir Wolf Sp.j. (AVSystem)
*
* SPDX-License-Identifier: Apache-2.0
*/
#include <zephyr/dt-bindings/pinctrl/esp-pinctrl-common.h>
#include <dt-bindings/pinctrl/esp32-pinctrl.h>
#include <zephyr/dt-bindings/pinctrl/esp32-gpio-sigmap.h>
&pinctrl {
uart0_tx_gpio1: uart0_tx_gpio1 {
pinmux = <UART0_TX_GPIO1>;
};
uart0_rx_gpio3: uart0_rx_gpio3 {
pinmux = <UART0_RX_GPIO3>;
bias-pull-up;
};
spim2_miso_gpio12: spim2_miso_gpio12 {
pinmux = <SPIM2_MISO_GPIO12>;
};
spim2_mosi_gpio11: spim2_mosi_gpio11 {
pinmux = <SPIM2_MOSI_GPIO11>;
output-low;
};
spim2_sclk_gpio14: spim2_sclk_gpio14 {
pinmux = <SPIM2_SCLK_GPIO14>;
};
spim2_csel_gpio16: spim2_csel_gpio16 {
pinmux = <SPIM2_CSEL_GPIO16>;
};
spim3_miso_gpio25: spim3_miso_gpio25 {
pinmux = <SPIM3_MISO_GPIO25>;
};
spim3_mosi_gpio15: spim3_mosi_gpio15 {
pinmux = <SPIM3_MOSI_GPIO15>;
output-low;
};
spim3_sclk_gpio13: spim3_sclk_gpio13 {
pinmux = <SPIM3_SCLK_GPIO13>;
};
spim3_csel_gpio5: spim3_csel_gpio5 {
pinmux = <SPIM3_CSEL_GPIO5>;
};
i2c0_sda_gpio21: i2c0_sda_gpio21 {
pinmux = <I2C0_SDA_GPIO21>;
bias-pull-up;
drive-open-drain;
output-high;
};
i2c0_scl_gpio22: i2c0_scl_gpio22 {
pinmux = <I2C0_SCL_GPIO22>;
bias-pull-up;
drive-open-drain;
output-high;
};
};

View file

@ -0,0 +1,163 @@
/*
* Copyright (c) 2022 AVSystem Sławomir Wolf Sp.j. (AVSystem)
*
* SPDX-License-Identifier: Apache-2.0
*/
/dts-v1/;
#include <espressif/esp32.dtsi>
#include "m5stickc_plus-pinctrl.dtsi"
/ {
model = "esp32";
compatible = "espressif,esp32";
aliases {
led0 = &red_led;
sw0 = &user_button_0;
sw1 = &user_button_1;
uart-0 = &uart0;
i2c-0 = &i2c0;
watchdog0 = &wdt0;
};
chosen {
zephyr,sram = &sram0;
zephyr,console = &uart0;
zephyr,shell-uart = &uart0;
zephyr,flash = &flash0;
};
leds {
compatible = "gpio-leds";
red_led: led_0 {
gpios = <&gpio0 10 GPIO_ACTIVE_HIGH>;
label = "Red - LED0";
};
};
gpio_keys {
compatible = "gpio-keys";
user_button_0: button_0 {
label = "User button 0";
gpios = <&gpio1 5 GPIO_ACTIVE_LOW>;
};
user_button_1: button_1 {
label = "User button 1";
gpios = <&gpio1 7 GPIO_ACTIVE_LOW>;
};
};
};
&cpu0 {
clock-frequency = <ESP32_CLK_CPU_240M>;
};
&cpu1 {
clock-frequency = <ESP32_CLK_CPU_240M>;
};
&uart0 {
status = "okay";
current-speed = <115200>;
pinctrl-0 = <&uart0_tx_gpio1 &uart0_rx_gpio3>;
pinctrl-names = "default";
};
&gpio0 {
status = "okay";
};
&gpio1 {
status = "okay";
};
/* IMU MPU-6886, RTC BM8563, PMU AXP192 */
&i2c0 {
status = "okay";
clock-frequency = <I2C_BITRATE_STANDARD>;
sda-gpios = <&gpio0 21 GPIO_OPEN_DRAIN>;
scl-gpios = <&gpio0 22 GPIO_OPEN_DRAIN>;
pinctrl-0 = <&i2c0_sda_gpio21 &i2c0_scl_gpio22>;
pinctrl-names = "default";
};
&spi2 {
#address-cells = <1>;
#size-cells = <0>;
status = "okay";
pinctrl-0 = <&spim2_miso_gpio12 &spim2_mosi_gpio11
&spim2_sclk_gpio14 &spim2_csel_gpio16>;
pinctrl-names = "default";
};
/* LCD TFT 1.14", 135x240 px, ST7789v2 */
&spi3 {
#address-cells = <1>;
#size-cells = <0>;
status = "okay";
pinctrl-0 = <&spim3_miso_gpio25 &spim3_mosi_gpio15
&spim3_sclk_gpio13 &spim3_csel_gpio5>;
pinctrl-names = "default";
};
&timer0 {
status = "okay";
};
&timer1 {
status = "okay";
};
&timer2 {
status = "okay";
};
&timer3 {
status = "okay";
};
&trng0 {
status = "okay";
};
&flash0 {
status = "okay";
partitions {
compatible = "fixed-partitions";
#address-cells = <1>;
#size-cells = <1>;
/* Reserve 60kB for the bootloader */
boot_partition: partition@1000 {
label = "mcuboot";
reg = <0x00001000 0x0000F000>;
read-only;
};
/* Reserve 1024kB for the application in slot 0 */
slot0_partition: partition@10000 {
label = "image-0";
reg = <0x00010000 0x00100000>;
};
/* Reserve 1024kB for the application in slot 1 */
slot1_partition: partition@110000 {
label = "image-1";
reg = <0x00110000 0x00100000>;
};
/* Reserve 256kB for the scratch partition */
scratch_partition: partition@210000 {
label = "image-scratch";
reg = <0x00210000 0x00040000>;
};
storage_partition: partition@250000 {
label = "storage";
reg = <0x00250000 0x00006000>;
};
};
};

View file

@ -0,0 +1,18 @@
identifier: m5stickc_plus
name: M5StickC PLUS
type: mcu
arch: xtensa
toolchain:
- zephyr
supported:
- gpio
- i2c
- spi
- watchdog
- uart
- pinmux
- nvs
testing:
ignore_tags:
- net
- bluetooth

View file

@ -0,0 +1,22 @@
# SPDX-License-Identifier: Apache-2.0
CONFIG_XTENSA_RESET_VECTOR=n
CONFIG_BOARD_M5STICKC_PLUS=y
CONFIG_SOC_ESP32=y
CONFIG_MAIN_STACK_SIZE=2048
CONFIG_CONSOLE=y
CONFIG_SERIAL=y
CONFIG_UART_CONSOLE=y
CONFIG_XTENSA_USE_CORE_CRT1=n
CONFIG_GPIO=y
CONFIG_GEN_ISR_TABLES=y
CONFIG_GEN_IRQ_VECTOR_TABLE=n
CONFIG_I2C=y
CONFIG_CLOCK_CONTROL=y

View file

@ -0,0 +1,5 @@
set ESP_RTOS none
set ESP32_ONLYCPU 1
source [find interface/ftdi/esp32_devkitj_v1.cfg]
source [find target/esp32.cfg]

View file

@ -16,4 +16,4 @@ tests:
tags: introduction tags: introduction
filter: (CONFIG_MP_MAX_NUM_CPUS > 1) filter: (CONFIG_MP_MAX_NUM_CPUS > 1)
platform_exclude: esp32 esp_wrover_kit esp32_ethernet_kit platform_exclude: esp32 esp_wrover_kit esp32_ethernet_kit
heltec_wifi_lora32_v2 odroid_go olimex_esp32_evb heltec_wifi_lora32_v2 m5stickc_plus odroid_go olimex_esp32_evb