Skip to content

Commit b27aaf6

Browse files
committed
boards: m5stack: cores3: Add bus_out and usb_otg fixed regulators
Add two fixed-regulator nodes on the M5Stack CoreS3 to model the load switches controlled by the AW9523B GPIO expander: - `bus_out_reg`: drives 5V output on the M-Bus/Grove connectors via the `BUS_OUT_EN` control signal. - `usb_otg_reg`: drives 5V VBUS output on the USB port via the `USB_OTG_EN` control signal, enabling USB-OTG/host-power mode. Both regulators are defined but off by default. Two new snippets (`cores3-bus-out-en` and `cores3-usb-otg-en`) are added to allow enabling these rails at build time when needed. This keeps the default power configuration unchanged while providing an opt-in mechanism for applications and shields that require external 5V output. Signed-off-by: Chen Xingyu <hi@xingrz.me>
1 parent 58c2df7 commit b27aaf6

File tree

9 files changed

+105
-0
lines changed

9 files changed

+105
-0
lines changed

boards/m5stack/m5stack_cores3/doc/index.rst

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,37 @@ M5Stack CoreS3/CoreS3 SE features consist of:
2929
- Proximity sensor LTR-553ALS-WA (Not available for CoreS3 SE)
3030
- 6-Axis IMU BMI270 (Not available for CoreS3 SE)
3131

32+
Power of M-Bus/Grove and USB-OTG
33+
================================
34+
35+
The 5V power outputs for the M-Bus/Grove connectors and the USB-OTG port are
36+
disabled by default. These rails are controlled by the ``BUS_OUT_EN`` and
37+
``USB_OTG_EN`` signals, respectively. Their behavior under different enable
38+
combinations is shown below:
39+
40+
+----------------+----------------+-----------+---------+-------------+
41+
| ``BUS_OUT_EN`` | ``USB_OTG_EN`` | Battery | USB-OTG | M-Bus/Grove |
42+
+================+================+===========+=========+=============+
43+
| 0 | 0 | Charging | Input | Input |
44+
+----------------+----------------+-----------+---------+-------------+
45+
| 1 | 0 | Charging | Input | Output |
46+
+----------------+----------------+-----------+---------+-------------+
47+
| 0 | 1 | Charging | Output | Input |
48+
+----------------+----------------+-----------+---------+-------------+
49+
| 1 | 1 | Discharge | Output | Output |
50+
+----------------+----------------+-----------+---------+-------------+
51+
52+
Two snippets are provided to enable these power outputs:
53+
54+
- :ref:`m5stack-cores3-bus-out-en`
55+
- :ref:`m5stack-cores3-usb-otg-en`
56+
57+
Example usage:
58+
59+
.. code-block:: console
60+
61+
west build -S cores3-bus-out-en [...]
62+
3263
.. include:: ../../../espressif/common/soc-esp32s3-features.rst
3364
:start-after: espressif-soc-esp32s3-features
3465

boards/m5stack/m5stack_cores3/m5stack_cores3_procpu_common.dtsi

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,18 @@
6969
regulator-name = "bus_5v";
7070
enable-gpios = <&aw9523b_gpio 15 GPIO_ACTIVE_HIGH>;
7171
};
72+
73+
bus_out_reg: bus_out {
74+
compatible = "regulator-fixed";
75+
regulator-name = "bus_out";
76+
enable-gpios = <&aw9523b_gpio 1 GPIO_ACTIVE_HIGH>;
77+
};
78+
79+
usb_otg_reg: usb_otg {
80+
compatible = "regulator-fixed";
81+
regulator-name = "usb_otg";
82+
enable-gpios = <&aw9523b_gpio 5 GPIO_ACTIVE_HIGH>;
83+
};
7284
};
7385

7486
&usb_serial {
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
.. _m5stack-cores3-bus-out-en:
2+
3+
M5Stack CoreS3: Enable BUS 5V output
4+
####################################
5+
6+
.. code-block:: console
7+
8+
west build -S cores3-bus-out-en [...]
9+
10+
This snippet enables 5V output on the M-Bus/Grove connectors of M5Stack
11+
:zephyr:board:`m5stack_cores3` board by asserting the ``BUS_OUT_EN`` control
12+
signal.
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
/*
2+
* Copyright (c) 2025 Chen Xingyu <hi@xingrz.me>
3+
* SPDX-License-Identifier: Apache-2.0
4+
*/
5+
6+
&bus_out_reg {
7+
regulator-boot-on;
8+
};
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# Copyright (c) 2025 Chen Xingyu <hi@xingrz.me>
2+
# SPDX-License-Identifier: Apache-2.0
3+
4+
name: cores3-bus-out-en
5+
append:
6+
EXTRA_DTC_OVERLAY_FILE: cores3-bus-out-en.overlay
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
.. _m5stack-cores3-usb-otg-en:
2+
3+
M5Stack CoreS3: Enable USB-OTG 5V output
4+
########################################
5+
6+
.. code-block:: console
7+
8+
west build -S cores3-usb-otg-en [...]
9+
10+
This snippet enables 5V output on the USB port of M5Stack
11+
:zephyr:board:`m5stack_cores3` board by asserting the ``USB_OTG_EN`` control
12+
signal.
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
/*
2+
* Copyright (c) 2025 Chen Xingyu <hi@xingrz.me>
3+
* SPDX-License-Identifier: Apache-2.0
4+
*/
5+
6+
&usb_otg_reg {
7+
regulator-boot-on;
8+
};
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# Copyright (c) 2025 Chen Xingyu <hi@xingrz.me>
2+
# SPDX-License-Identifier: Apache-2.0
3+
4+
name: cores3-usb-otg-en
5+
append:
6+
EXTRA_DTC_OVERLAY_FILE: cores3-usb-otg-en.overlay

snippets/m5stack/index.rst

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
.. _m5stack-snippets:
2+
3+
M5Stack snippets
4+
################
5+
6+
.. toctree::
7+
:maxdepth: 1
8+
:glob:
9+
10+
**/*

0 commit comments

Comments
 (0)