Skip to content

Commit 342c737

Browse files
Jakub Novákkartben
authored andcommitted
boards: m5stack: add support for M5Stack Fire
Adds support for the M5Stack Fire. Board files are adapted from those used for the M5Stack Core2. Aside from the 2 newest revisions the device also contains a BMM150 magnetometer which is not supported. The LED strips on the sides are also not supported because Zephyr does not support fast GPIO switching, see: #11917. The IP5306 charger works by itself but doesn't have a driver written for it thus it's not able to be interfaced with. Signed-off-by: Jakub Novák <jakubnovak.cz@outlook.cz>
1 parent ff40173 commit 342c737

17 files changed

+682
-0
lines changed

boards/m5stack/m5stack_fire/Kconfig

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# Copyright (c) 2024 Espressif Systems (Shanghai) Co., Ltd.
2+
# SPDX-License-Identifier: Apache-2.0
3+
4+
config HEAP_MEM_POOL_ADD_SIZE_BOARD
5+
int
6+
default 4096 if BOARD_M5STACK_FIRE_ESP32_PROCPU
7+
default 256 if BOARD_M5STACK_FIRE_ESP32_APPCPU
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
# M5Stack Core2 board configuration
2+
# Copyright (c) 2022 AVSystem Sławomir Wolf Sp.j. (AVSystem)
3+
# Copyright (c) 2023 Martin Kiepfer <m.kiepfer@teleschirm.org>
4+
# SPDX-License-Identifier: Apache-2.0
5+
6+
if BOARD_M5STACK_FIRE_ESP32_PROCPU
7+
8+
config KERNEL_MEM_POOL
9+
default y
10+
11+
config GPIO_HOGS_INIT_PRIORITY
12+
default 70
13+
14+
config INPUT
15+
default y
16+
17+
configdefault LV_COLOR_16_SWAP
18+
default y if LVGL
19+
20+
# Increase initialization priority of MIPI DBI device, so that it initializes
21+
# after the GPIO controller
22+
if MIPI_DBI
23+
24+
config MIPI_DBI_INIT_PRIORITY
25+
default 82
26+
27+
endif # MIPI_DBI
28+
29+
endif # BOARD_M5STACK_FIRE_ESP32_PROCPU
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# M5Stack Fire board configuration
2+
3+
# Copyright (c) 2023 Martin Kiepfer <m.kiepfer@teleschirm.org>
4+
# SPDX-License-Identifier: Apache-2.0
5+
6+
config BOARD_M5STACK_FIRE
7+
select SOC_ESP32_D0WD_V3
8+
select SOC_ESP32_PROCPU if BOARD_M5STACK_FIRE_ESP32_PROCPU
9+
select SOC_ESP32_APPCPU if BOARD_M5STACK_FIRE_ESP32_APPCPU
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# SPDX-License-Identifier: Apache-2.0
2+
3+
if(NOT "${OPENOCD}" MATCHES "^${ESPRESSIF_TOOLCHAIN_PATH}/.*")
4+
set(OPENOCD OPENOCD-NOTFOUND)
5+
endif()
6+
find_program(OPENOCD openocd PATHS ${ESPRESSIF_TOOLCHAIN_PATH}/openocd-esp32/bin NO_DEFAULT_PATH)
7+
8+
include(${ZEPHYR_BASE}/boards/common/esp32.board.cmake)
9+
include(${ZEPHYR_BASE}/boards/common/openocd.board.cmake)

boards/m5stack/m5stack_fire/board.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
board:
2+
name: m5stack_fire
3+
full_name: Fire
4+
vendor: m5stack
5+
socs:
6+
- name: esp32
Binary file not shown.
Lines changed: 151 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,151 @@
1+
.. zephyr:board:: m5stack_fire
2+
3+
Overview
4+
********
5+
6+
M5Stack Fire is an ESP32-based development board from M5Stack.
7+
8+
M5Stack Fire features the following integrated components:
9+
10+
- ESP32-D0WDQ6 chip (240MHz dual core, 600 DMIPS, 520KB SRAM, Wi-Fi)
11+
- PSRAM 8MB
12+
- Flash 16MB
13+
- LCD IPS TFT 2", 320x240 px screen (ILI9342C)
14+
- Charger IP5306
15+
- Audio NS4148 amplifier (1W-092 speaker)
16+
- USB CH9102F
17+
- SD-Card slot
18+
- Grove connector
19+
- IMO 6-axis IMU MPU6886
20+
- MIC BSE3729
21+
- Battery 500mAh 3,7V
22+
- Three physical buttons
23+
- LED strips
24+
25+
Functional Description
26+
**********************
27+
28+
The following table below describes the key components, interfaces, and controls
29+
of the M5Stack Core2 board.
30+
31+
.. _M5Core2 Schematic: https://m5stack-doc.oss-cn-shenzhen.aliyuncs.com/480/M5-Core-Schematic_20171206.pdf
32+
.. _MPU-ESP32: https://m5stack.oss-cn-shenzhen.aliyuncs.com/resource/docs/datasheet/core/esp32_datasheet_en_v3.9.pdf
33+
.. _MPU-6886: https://m5stack.oss-cn-shenzhen.aliyuncs.com/resource/docs/datasheet/core/MPU-6886-000193%2Bv1.1_GHIC_en.pdf
34+
.. _LCD-ILI9342C: https://m5stack.oss-cn-shenzhen.aliyuncs.com/resource/docs/datasheet/core/ILI9342C-ILITEK.pdf
35+
.. _IP5306: https://m5stack.oss-cn-shenzhen.aliyuncs.com/resource/docs/datasheet/core/IIC_IP5306_REG_V1.4_cn.pdf
36+
37+
+------------------+------------------------------------------------------------------------+-----------+
38+
| Key Component | Description | Status |
39+
+==================+========================================================================+===========+
40+
| ESP32-D0WDQ6-V2 | This `MPU-ESP32`_ module provides complete Wi-Fi and Bluetooth | supported |
41+
| module | functionalities and integrates a 16-MB SPI flash. | |
42+
+------------------+------------------------------------------------------------------------+-----------+
43+
| USB Port | USB interface. Power supply for the board as well as the | supported |
44+
| | communication interface between a computer and the board. | |
45+
+------------------+------------------------------------------------------------------------+-----------+
46+
| Power Switch | Power on/off button. | supported |
47+
+------------------+------------------------------------------------------------------------+-----------+
48+
| General purpose | Three buttons on the front face of the device accesible using the GPIO | supported |
49+
| buttons | interface. | |
50+
+------------------+------------------------------------------------------------------------+-----------+
51+
| LCD screen | Built-in LCD TFT display \(`LCD-ILI9342C`_, 2", 320x240 px\) | supported |
52+
| | controlled via SPI interface | |
53+
+------------------+------------------------------------------------------------------------+-----------+
54+
| SD-Card slot | SD-Card connection via SPI-mode. | supported |
55+
+------------------+------------------------------------------------------------------------+-----------+
56+
| 6-axis IMU | The `MPU-6886`_ is a 6-axis motion tracker (6DOF IMU) device that | supported |
57+
| MPU6886 | combines a 3-axis gyroscope and a 3-axis accelerometer. | |
58+
+------------------+------------------------------------------------------------------------+-----------+
59+
| Grove port | Used to interface with the many available modules and sensors. | supported |
60+
+------------------+------------------------------------------------------------------------+-----------+
61+
| Built-in speaker | 1W speaker for analog audio output. | supported |
62+
+------------------+------------------------------------------------------------------------+-----------+
63+
| Built-in | The BSE3729 analog microphone. | todo |
64+
| microphone | | |
65+
+------------------+------------------------------------------------------------------------+-----------+
66+
| LED strip | LED strips on the side of the device. | todo |
67+
+------------------+------------------------------------------------------------------------+-----------+
68+
| Battery-support | Charging is supported automatically via the `IP5306`_. But there is no | todo |
69+
| | possibility to query current battery status. | |
70+
+------------------+------------------------------------------------------------------------+-----------+
71+
72+
Supported Features
73+
==================
74+
75+
.. zephyr:board-supported-hw::
76+
77+
Start Application Development
78+
*****************************
79+
80+
Before powering up your M5Stack Fire, please make sure that the board is in good
81+
condition with no obvious signs of damage.
82+
83+
System requirements
84+
===================
85+
86+
Prerequisites
87+
-------------
88+
89+
Espressif HAL requires WiFi and Bluetooth binary blobs in order work. Run the command
90+
below to retrieve those files.
91+
92+
.. code-block:: console
93+
94+
west blobs fetch hal_espressif
95+
96+
.. note::
97+
98+
It is recommended running the command above after :file:`west update`.
99+
100+
Building & Flashing
101+
-------------------
102+
103+
.. zephyr:board-supported-runners::
104+
105+
Build and flash applications as usual (see :ref:`build_an_application` and
106+
:ref:`application_run` for more details).
107+
108+
.. zephyr-app-commands::
109+
:zephyr-app: samples/hello_world
110+
:board: m5stack_fire/esp32/procpu
111+
:goals: build
112+
113+
The usual ``flash`` target will work with the ``m5stack_fire`` board
114+
configuration. Here is an example for the :zephyr:code-sample:`hello_world`
115+
application.
116+
117+
.. zephyr-app-commands::
118+
:zephyr-app: samples/hello_world
119+
:board: m5stack_fire/esp32/procpu
120+
:goals: flash
121+
122+
The baud rate of 921600bps is set by default. If experiencing issues when flashing,
123+
try using different values by using ``--esp-baud-rate <BAUD>`` option during
124+
``west flash`` (e.g. ``west flash --esp-baud-rate 115200``).
125+
126+
You can also open the serial monitor using the following command:
127+
128+
.. code-block:: shell
129+
130+
west espressif monitor
131+
132+
After the board has automatically reset and booted, you should see the following
133+
message in the monitor:
134+
135+
.. code-block:: console
136+
137+
***** Booting Zephyr OS vx.x.x-xxx-gxxxxxxxxxxxx *****
138+
Hello World! m5stack_fire
139+
140+
Debugging
141+
---------
142+
143+
M5Stack Fire debugging is not supported due to pinout limitations.
144+
145+
Related Documents
146+
*****************
147+
148+
- `M5Stack-Fire schematic <https://m5stack-doc.oss-cn-shenzhen.aliyuncs.com/480/M5-Core-Schematic_20171206.pdf>`_ (PDF)
149+
- `M5Stack-Fire docs <https://docs.m5stack.com/en/core/fire_v2.7>`_
150+
- `ESP32 Datasheet <https://www.espressif.com/sites/default/files/documentation/esp32_datasheet_en.pdf>`_ (PDF)
151+
- `ESP32 Hardware Reference <https://docs.espressif.com/projects/esp-idf/en/latest/esp32/hw-reference/index.html>`_
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
/*
2+
* Copyright (c) 2023 Joel Guittet
3+
* Copyright (c) 2023 Martin Kiepfer
4+
* Copyright (c) 2025 Jakub Novák
5+
*
6+
* SPDX-License-Identifier: Apache-2.0
7+
*/
8+
9+
/ {
10+
grove_header_a: grove_header_a {
11+
compatible = "grove-header";
12+
#gpio-cells = <2>;
13+
gpio-map-mask = <0xffffffff 0xffffffc0>;
14+
gpio-map-pass-thru = <0 0x3f>;
15+
gpio-map = <0 0 &gpio0 22 0>, /* D0/SCL/RX */
16+
<1 0 &gpio1 21 0>; /* D1/SDA/TX */
17+
};
18+
19+
grove_header_b: grove_header_b {
20+
compatible = "grove-header";
21+
#gpio-cells = <2>;
22+
gpio-map-mask = <0xffffffff 0xffffffc0>;
23+
gpio-map-pass-thru = <0 0x3f>;
24+
gpio-map = <0 0 &gpio1 5 0>, /* D0/SCL/RX */
25+
<1 0 &gpio0 26 0>; /* D1/SDA/TX */
26+
};
27+
28+
grove_header_c: grove_header_c {
29+
compatible = "grove-header";
30+
#gpio-cells = <2>;
31+
gpio-map-mask = <0xffffffff 0xffffffc0>;
32+
gpio-map-pass-thru = <0 0x3f>;
33+
gpio-map = <0 0 &gpio0 17 0>, /* D0/SCL/RX */
34+
<1 0 &gpio0 16 0>; /* D1/SDA/TX */
35+
};
36+
};
37+
38+
grove_uart: &uart1 {};
Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
/*
2+
* Copyright (c) 2022 AVSystem Sławomir Wolf Sp.j. (AVSystem)
3+
* Copyright (c) 2023 Martin Kiepfer <m.kiepfer@teleschrim.org>
4+
* Copyright (c) 2025 Jakub Novák <jakubnovak.cz@outlook.cz>
5+
*
6+
* SPDX-License-Identifier: Apache-2.0
7+
*/
8+
9+
#include <zephyr/dt-bindings/pinctrl/esp-pinctrl-common.h>
10+
#include <dt-bindings/pinctrl/esp32-pinctrl.h>
11+
#include <zephyr/dt-bindings/pinctrl/esp32-gpio-sigmap.h>
12+
13+
&pinctrl {
14+
15+
uart0_tx_gpio1: uart0_tx_gpio1 {
16+
pinmux = <UART0_TX_GPIO1>;
17+
};
18+
19+
uart0_rx_gpio3: uart0_rx_gpio3 {
20+
pinmux = <UART0_RX_GPIO3>;
21+
bias-pull-up;
22+
};
23+
24+
uart1_rx_gpio33: uart1_rx_gpio33 {
25+
pinmux = <UART1_RX_GPIO33>;
26+
};
27+
28+
uart2_rx_gpio13: uart2_rx_gpio13 {
29+
pinmux = <UART2_RX_GPIO13>;
30+
};
31+
32+
uart2_tx_gpio14: uart2_rx_gpio14 {
33+
pinmux = <UART2_TX_GPIO14>;
34+
};
35+
36+
uart1_tx_gpio32: uart1_tx_gpio32 {
37+
pinmux = <UART1_TX_GPIO32>;
38+
};
39+
40+
spim3_default: spim3_default {
41+
group1 {
42+
pinmux = <SPIM3_MISO_GPIO23>,
43+
<SPIM3_SCLK_GPIO18>;
44+
};
45+
46+
group2 {
47+
pinmux = <SPIM3_MOSI_GPIO23>, <SPIM3_SCLK_GPIO18>;
48+
output-low;
49+
};
50+
};
51+
52+
i2c0_default: i2c0_default {
53+
group1 {
54+
pinmux = <I2C0_SDA_GPIO21>,
55+
<I2C0_SCL_GPIO22>;
56+
drive-open-drain;
57+
output-high;
58+
};
59+
};
60+
61+
ledc0_default: ledc0_default {
62+
group1 {
63+
pinmux = <LEDC_CH7_GPIO32>;
64+
output-enable;
65+
};
66+
67+
group2 {
68+
pinmux = <LEDC_CH8_GPIO25>;
69+
output-enable;
70+
};
71+
};
72+
};
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
/*
2+
* Copyright (c) 2023 Espressif Systems (Shanghai) Co., Ltd.
3+
*
4+
* SPDX-License-Identifier: Apache-2.0
5+
*/
6+
/dts-v1/;
7+
8+
#include <espressif/esp32/esp32_appcpu.dtsi>
9+
#include <espressif/partitions_0x1000_amp.dtsi>
10+
11+
/ {
12+
model = "M5Stack Fire APPCPU";
13+
compatible = "espressif,esp32";
14+
15+
chosen {
16+
zephyr,sram = &sram1;
17+
zephyr,ipc_shm = &shm0;
18+
zephyr,ipc = &ipm0;
19+
zephyr,flash = &flash0;
20+
zephyr,code-partition = &slot0_appcpu_partition;
21+
};
22+
};
23+
24+
&ipm0 {
25+
status = "okay";
26+
};
27+
28+
&trng0 {
29+
status = "okay";
30+
};

0 commit comments

Comments
 (0)