1.. zephyr:board:: m5stack_core2
2
3Overview
4********
5
6M5Stack Core2 is an ESP32-based development board from M5Stack. It is the successor for the Core module.
7
8M5Stack Core2 features the following integrated components:
9
10- ESP32-D0WDQ6-V3 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- Touch screen (FT6336U)
15- PMU AXP192
16- Audio NS4168 amplifier (1W-092 speaker)
17- Vibration motor
18- RTC BM8563
19- USB CP2104
20- SD-Card slot
21- Grove connector
22- IMO 6-axis IMU MPU6886
23- MIC SPM1423
24- Battery 390mAh 3,7V
25
26Functional Description
27**********************
28
29The following table below describes the key components, interfaces, and controls
30of the M5Stack Core2 board.
31
32.. _M5Core2 Schematic: https://m5stack.oss-cn-shenzhen.aliyuncs.com/resource/docs/schematic/Core/CORE2_V1.0_SCH.pdf
33.. _MPU-ESP32: https://m5stack.oss-cn-shenzhen.aliyuncs.com/resource/docs/datasheet/core/esp32_datasheet_en_v3.9.pdf
34.. _TOUCH-FT6336U: https://m5stack.oss-cn-shenzhen.aliyuncs.com/resource/docs/datasheet/core/Ft6336GU_Firmware%20外部寄存器_20151112-%20EN.xlsx
35.. _SND-NS4168: https://m5stack.oss-cn-shenzhen.aliyuncs.com/resource/docs/datasheet/core/NS4168_CN_datasheet.pdf
36.. _MPU-6886: https://m5stack.oss-cn-shenzhen.aliyuncs.com/resource/docs/datasheet/core/MPU-6886-000193%2Bv1.1_GHIC_en.pdf
37.. _LCD-ILI9342C: https://m5stack.oss-cn-shenzhen.aliyuncs.com/resource/docs/datasheet/core/ILI9342C-ILITEK.pdf
38.. _SPM-1423: https://m5stack.oss-cn-shenzhen.aliyuncs.com/resource/docs/datasheet/core/SPM1423HM4H-B_datasheet_en.pdf
39.. _RTC-BM8563: https://m5stack.oss-cn-shenzhen.aliyuncs.com/resource/docs/datasheet/core/BM8563_V1.1_cn.pdf
40.. _SY7088: https://m5stack.oss-cn-shenzhen.aliyuncs.com/resource/docs/datasheet/core/SY7088-Silergy.pdf
41.. _PMU-AXP192: https://m5stack.oss-cn-shenzhen.aliyuncs.com/resource/docs/datasheet/core/AXP192_datasheet_en.pdf
42.. _VIB-1072_RFN01: https://m5stack.oss-cn-shenzhen.aliyuncs.com/resource/docs/datasheet/core/1027RFN01-33d.pdf
43
44+------------------+--------------------------------------------------------------------------+-----------+
45| Key Component    | Description                                                              | Status    |
46+==================+==========================================================================+===========+
47| ESP32-D0WDQ6-V2  | This `MPU-ESP32`_ module provides complete Wi-Fi and Bluetooth           | supported |
48| module           | functionalities and integrates a 16-MB SPI flash.                        |           |
49+------------------+--------------------------------------------------------------------------+-----------+
50| 32.768 kHz RTC   | External precision 32.768 kHz crystal oscillator serves as a clock with  | supported |
51|                  | low-power consumption while the chip is in Deep-sleep mode.              |           |
52+------------------+--------------------------------------------------------------------------+-----------+
53| Status LED       | One user LED connected to the GPIO pin.                                  | supported |
54+------------------+--------------------------------------------------------------------------+-----------+
55| USB Port         | USB interface. Power supply for the board as well as the                 | supported |
56|                  | communication interface between a computer and the board.                |           |
57|                  | Contains: TypeC x 1, GROVE(I2C+I/O+UART) x 1                             |           |
58+------------------+--------------------------------------------------------------------------+-----------+
59| Reset button     | Reset button                                                             | supported |
60+------------------+--------------------------------------------------------------------------+-----------+
61| Power Switch     | Power on/off button.                                                     | supported |
62+------------------+--------------------------------------------------------------------------+-----------+
63| LCD screen       | Built-in LCD TFT display \(`LCD-ILI9342C`_, 2", 320x240 px\)             | supported |
64|                  | controlled via SPI interface                                             |           |
65+------------------+--------------------------------------------------------------------------+-----------+
66| SD-Card slot     | SD-Card connection via SPI-mode.                                         | supported |
67+------------------+--------------------------------------------------------------------------+-----------+
68| 6-axis IMU       | The `MPU-6886`_ is a 6-axis motion tracker (6DOF IMU) device that        | supported |
69| MPU6886          | combines a 3-axis gyroscope and a 3-axis accelerometer.                  |           |
70|                  | For details please refer to :ref:`m5stack_core2_ext`                     |           |
71+------------------+--------------------------------------------------------------------------+-----------+
72| Grove port       | Note: Grove port requires 5V to be enabled via ``bus_5v`` regulator      | supported |
73+------------------+--------------------------------------------------------------------------+-----------+
74| Built-in         | The `SPM-1423`_ I2S driven microphone.                                   | todo      |
75| microphone       |                                                                          |           |
76+------------------+--------------------------------------------------------------------------+-----------+
77| Built-in speaker | 1W speaker for audio output via I2S interface.                           | todo      |
78+------------------+--------------------------------------------------------------------------+-----------+
79| Battery-support  | Power supply via battery is supported automatically. But there is no     | todo      |
80|                  | possibility to query current battery status.                             |           |
81+------------------+--------------------------------------------------------------------------+-----------+
82
83Power supply
84============
85M5Stack Core2 module is equipped with the feature-rich power management IC
86(:dtcompatible:`x-powers,axp192-regulator`).
87Following regulators are utilized on this module:
88
89- **vdd_mcu**:
90  Main power supply for the MCU.
91- **lcd_bg**:
92  Display backlight voltage.
93- **v_peri**:
94  Periphal supply. This regulator controls supply for the display, SD-Card.
95- **vib_motor**:
96  Vibration motor regulator.
97- **bus_5v**
98  BUS_5V supply for Grove port.
99  Note: This fixed regulator supply is disabled by default.
100
101
102These voltages can be controlled via regulator api.
103
104Supported Features
105==================
106
107The Zephyr m5stack_core2 board configuration supports the following hardware features:
108
109+-----------+------------+-------------------------------------+
110| Interface | Controller | Driver/Component                    |
111+===========+============+=====================================+
112| NVIC      | on-chip    | nested vector interrupt controller  |
113+-----------+------------+-------------------------------------+
114| UART      | on-chip    | serial port-polling;                |
115|           |            | serial port-interrupt               |
116+-----------+------------+-------------------------------------+
117| PINMUX    | on-chip    | pinmux                              |
118+-----------+------------+-------------------------------------+
119| GPIO      | on-chip    | gpio                                |
120+-----------+------------+-------------------------------------+
121| I2C       | on-chip    | i2c                                 |
122+-----------+------------+-------------------------------------+
123| SPI       | on-chip    | spi                                 |
124+-----------+------------+-------------------------------------+
125| CLOCK     | on-chip    | reset and clock control             |
126+-----------+------------+-------------------------------------+
127| COUNTER   | on-chip    | rtc                                 |
128+-----------+------------+-------------------------------------+
129| WATCHDOG  | on-chip    | independent watchdog                |
130+-----------+------------+-------------------------------------+
131| PWM       | on-chip    | pwm                                 |
132+-----------+------------+-------------------------------------+
133| ADC       | on-chip    | adc                                 |
134+-----------+------------+-------------------------------------+
135| DAC       | on-chip    | dac                                 |
136+-----------+------------+-------------------------------------+
137| die-temp  | on-chip    | die temperature sensor              |
138+-----------+------------+-------------------------------------+
139
140
141Start Application Development
142*****************************
143
144Before powering up your M5Stack Core2, please make sure that the board is in good
145condition with no obvious signs of damage.
146
147System requirements
148===================
149
150Prerequisites
151-------------
152
153Espressif HAL requires WiFi and Bluetooth binary blobs in order work. Run the command
154below to retrieve those files.
155
156.. code-block:: console
157
158   west blobs fetch hal_espressif
159
160.. note::
161
162   It is recommended running the command above after :file:`west update`.
163
164Building & Flashing
165-------------------
166
167Build and flash applications as usual (see :ref:`build_an_application` and
168:ref:`application_run` for more details).
169
170.. zephyr-app-commands::
171   :zephyr-app: samples/hello_world
172   :board: m5stack_core2/esp32/procpu
173   :goals: build
174
175The usual ``flash`` target will work with the ``m5stack_core2`` board
176configuration. Here is an example for the :zephyr:code-sample:`hello_world`
177application.
178
179.. zephyr-app-commands::
180   :zephyr-app: samples/hello_world
181   :board: m5stack_core2/esp32/procpu
182   :goals: flash
183
184The baud rate of 921600bps is set by default. If experiencing issues when flashing,
185try using different values by using ``--esp-baud-rate <BAUD>`` option during
186``west flash`` (e.g. ``west flash --esp-baud-rate 115200``).
187
188You can also open the serial monitor using the following command:
189
190.. code-block:: shell
191
192   west espressif monitor
193
194After the board has automatically reset and booted, you should see the following
195message in the monitor:
196
197.. code-block:: console
198
199   ***** Booting Zephyr OS vx.x.x-xxx-gxxxxxxxxxxxx *****
200   Hello World! m5stack_core2
201
202Debugging
203---------
204
205M5Stack Core2 debugging is not supported due to pinout limitations.
206
207Related Documents
208*****************
209
210- `M5Stack-Core2 schematic <https://m5stack.oss-cn-shenzhen.aliyuncs.com/resource/docs/schematic/Core/CORE2_V1.0_SCH.pdf>`_ (PDF)
211- `ESP32-PICO-D4 Datasheet <https://www.espressif.com/sites/default/files/documentation/esp32-pico-d4_datasheet_en.pdf>`_ (PDF)
212- `M5Stack-Core2 docs <https://docs.m5stack.com/en/core/core2>`_
213- `ESP32 Datasheet <https://www.espressif.com/sites/default/files/documentation/esp32_datasheet_en.pdf>`_ (PDF)
214- `ESP32 Hardware Reference <https://docs.espressif.com/projects/esp-idf/en/latest/esp32/hw-reference/index.html>`_
215