-
Notifications
You must be signed in to change notification settings - Fork 6.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
shield: m5stack m5dial #80778
Closed
MrMarteng
wants to merge
2
commits into
zephyrproject-rtos:main
from
MrMarteng:shield_m5stack_m5dial
Closed
shield: m5stack m5dial #80778
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
# M5Stack M5Dial shield configuration | ||
# Copyright (c) 2023 Martin Kiepfer <mrmarteng@teleschirm.org> | ||
# SPDX-License-Identifier: Apache-2.0 | ||
|
||
if SHIELD_M5STACK_M5DIAL | ||
|
||
config INPUT | ||
default y | ||
|
||
config INPUT_FT5336_INTERRUPT | ||
default y if INPUT | ||
|
||
config LV_COLOR_16_SWAP | ||
default y if LVGL | ||
|
||
config PWM | ||
default y | ||
|
||
config REGULATOR | ||
default y | ||
|
||
endif # SHIELD_M5STACK_M5DIAL |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
# M5Stack M5Dial board configuration | ||
|
||
# Copyright (c) 2023 Martin Kiepfer <mrmarteng@teleschirm.org> | ||
# SPDX-License-Identifier: Apache-2.0 | ||
|
||
config SHIELD_M5STACK_M5DIAL | ||
def_bool $(shields_list_contains,m5stack_m5dial) |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,207 @@ | ||
.. _m5stack_m5dial: | ||
|
||
M5Stack M5Dial | ||
############## | ||
|
||
Overview | ||
******** | ||
|
||
M5Dial is an ESP32-based development board from M5Stack. | ||
The device features an embedded ``m5stack_stamps3`` module that runs | ||
the ESP32-S3 microcontroller. | ||
|
||
.. figure:: img/m5stack_m5dial.webp | ||
:align: center | ||
:alt: M5Stack M5Dial | ||
|
||
M5Stack M5Dial | ||
|
||
Key components | ||
============== | ||
|
||
The Zephyr ``m5stack_m5dial`` shield configuration supports the following key components: | ||
|
||
+------------------------+-----------------------------------------------------------------------+------------+ | ||
| Key Component | Description | Status | | ||
+========================+=======================================================================+============+ | ||
| LCD IPS round display | 240x240 pixel display features GC9A01A display controller interfaced | supported | | ||
| (240x240 pixel) | via SPI | | | ||
+------------------------+-----------------------------------------------------------------------+------------+ | ||
| WS1850S NFC | Wisesun NFC reader IC interfaced via I2C. | todo | | ||
+------------------------+-----------------------------------------------------------------------+------------+ | ||
| RTC8563 RTC | Real-Time clock interfaced via I2C. | supported | | ||
+------------------------+-----------------------------------------------------------------------+------------+ | ||
| Rotary encoder | Round rotary button (``INPUT_KEY_LEFT`` and ``INPUT_KEY_RIGHT`` | supported | | ||
| | events). | | | ||
+------------------------+-----------------------------------------------------------------------+------------+ | ||
| Reset button | Directly interconnected to EN signal of StampS3 module. | supported | | ||
+------------------------+-----------------------------------------------------------------------+------------+ | ||
| User-button | Custom user button. | supported | | ||
+------------------------+-----------------------------------------------------------------------+------------+ | ||
| Builtin Beeper/Buzzer | PWM controller beeper, properly operating between 200Hz and 2kHz | supported | | ||
+------------------------+-----------------------------------------------------------------------+------------+ | ||
|
||
M5Stack M5Dial features 2 external grove ports (A and B) | ||
|
||
Grove header A | ||
--------------- | ||
|
||
Functionality is accessible via ``grove_headerA`` | ||
|
||
+-----+----------------------------+---------------------------+ | ||
| Pin | ``m5stack_stamps3_header`` | Function | | ||
+=====+============================+===========================+ | ||
| 1 | 16 | I2C-SCL (``groveA_i2c```) | | ||
+-----+----------------------------+---------------------------+ | ||
| 2 | 14 | I2C-SDL (``groveA_i2c``) | | ||
+-----+----------------------------+---------------------------+ | ||
| 3 | | 5V-Output | | ||
+-----+----------------------------+---------------------------+ | ||
| 4 | | GND | | ||
+-----+----------------------------+---------------------------+ | ||
|
||
|
||
Grove header B | ||
--------------- | ||
|
||
Functionality is accessible via ``grove_headerB`` | ||
|
||
+-----+----------------------------+-----------+ | ||
| Pin | ``m5stack_stamps3_header`` | Function | | ||
+=====+============================+===========+ | ||
| 1 | 0 | In | | ||
+-----+----------------------------+-----------+ | ||
| 2 | 1 | Out | | ||
+-----+----------------------------+-----------+ | ||
| 3 | | 5V-Output | | ||
+-----+----------------------------+-----------+ | ||
| 4 | | GND | | ||
+-----+----------------------------+-----------+ | ||
|
||
|
||
Battery-Support | ||
--------------- | ||
|
||
Although ``m5stack_m5dial`` does not natively come with a battery, it features | ||
support for connecting a battery to it. The battery connector is underneath the | ||
StampS3 module. | ||
|
||
To keep the module running on the battery only, without an external supply, an | ||
internal power-hold signal must be activated. This can be controlled via regulator | ||
``battery_hold``, which is activated by default. | ||
|
||
Pin Mapping | ||
=========== | ||
|
||
M5Dial is utilizing the :dtcompatible:`m5stack,stamps3-header` header. | ||
Following table shows the pin mapping, the interconnection to the | ||
M5Stack-StampS3 module and its according function. | ||
|
||
+----------+--------------------------------+---------+-----------+-----------------------------------+ | ||
| StampS3 | stamps3-header | M5Dial | M5Dial | Description | | ||
| pin | | pin | signal | | | ||
+----------+--------------------------------+---------+-----------+-----------------------------------+ | ||
| M1-1 | ``m5stack_stamps3_header:0`` | J2.1 | GI | Grove-B In | | ||
+----------+--------------------------------+---------+-----------+-----------------------------------+ | ||
| M1-2 | ``m5stack_stamps3_header:1`` | J2-2 | GO | Grove-B Out | | ||
+----------+--------------------------------+---------+-----------+-----------------------------------+ | ||
| M1-3 | ``m5stack_stamps3_clkout0:2`` | | Beep | Beeper | | ||
+----------+--------------------------------+---------+-----------+-----------------------------------+ | ||
| M1-4 | ``m5stack_stamps3_header:3`` | | LCD_RS | LCD Cmd/Data | | ||
+----------+--------------------------------+---------+-----------+-----------------------------------+ | ||
| M1-5 | ``m5stack_stamps3_spilcd`` | | LCD_MOSI | LCD SPI-MOSI | | ||
+----------+--------------------------------+---------+-----------+-----------------------------------+ | ||
| M1-6 | ``m5stack_stamps3_spilcd`` | | LCD_SCK | LCD SPI-CLK | | ||
+----------+--------------------------------+---------+-----------+-----------------------------------+ | ||
| M1-7 | ``m5stack_stamps3_spilcd`` | | LCD_CS | LCD SPI-CS | | ||
+----------+--------------------------------+---------+-----------+-----------------------------------+ | ||
| M1-8 | ``m5stack_stamps3_header:7`` | | LCD_RESET | LCD Reset (active-low) | | ||
+----------+--------------------------------+---------+-----------+-----------------------------------+ | ||
| M1-9 | ``m5stack_stamps3_clkout0:0`` | | LCD_BL | LCD Backlight | | ||
| | | | | (PWM controlled MOSFET) | | ||
+----------+--------------------------------+---------+-----------+-----------------------------------+ | ||
| M1-10 | ``m5stack_stamps3_header:9`` | | RC522_INT | NFC Interrupt | | ||
+----------+--------------------------------+---------+-----------+-----------------------------------+ | ||
| M1-11 | **GND** | Ground | | ||
+----------+--------------------------------+---------+-----------+-----------------------------------+ | ||
| M1-12 | ``m5stack_stamps3_i2c1`` | | TP_SDA | Internal I2C-SDA | | ||
| | | | | (Touch, NFC and RTC) | | ||
+----------+--------------------------------+---------+-----------+-----------------------------------+ | ||
| M1-13 | **VIN_5V** | 5V Input voltage | | ||
| | | (via USB-C connector of StampS3) | | ||
+----------+--------------------------------+---------+-----------+-----------------------------------+ | ||
| M1-14 | ``m5stack_stamps3_i2c1`` | | TP_SCL | Internal I2C-SCL | | ||
| | | | | (Touch, NFC and RTC) | | ||
+----------+--------------------------------+---------+-----------+-----------------------------------+ | ||
| M1-15 | ``m5stack_stamps3_i2c0`` | J3-2 | SDA | Grove-A I2C-SDA | | ||
+----------+--------------------------------+---------+-----------+-----------------------------------+ | ||
| M1-16 | ``m5stack_stamps3_header:15`` | | TP_INT | Touch Interrupt | | ||
+----------+--------------------------------+---------+-----------+-----------------------------------+ | ||
| M1-17 | ``m5stack_stamps3_i2c0`` | J3-1 | SCL | Grove-A I2C-SCL | | ||
+----------+--------------------------------+---------+-----------+-----------------------------------+ | ||
| M1-18 | **GND** | Ground | | ||
+----------+--------------------------------+---------+-----------+-----------------------------------+ | ||
| M1-19 | | | MTCK | | | ||
+----------+--------------------------------+---------+-----------+-----------------------------------+ | ||
| M1-20 | | | Boot | | | ||
+----------+--------------------------------+---------+-----------+-----------------------------------+ | ||
| M1-21 | ``m5stack_stamps3_header:20`` | | B | Rotary left key | | ||
+----------+--------------------------------+---------+-----------+-----------------------------------+ | ||
| M1-22 | | | EN | Enable signal for 3V3 | | ||
+----------+--------------------------------+---------+-----------+-----------------------------------+ | ||
| M1-23 | ``m5stack_stamps3_header:22`` | | A | Rotary right key | | ||
+----------+--------------------------------+---------+-----------+-----------------------------------+ | ||
| M1-24 | | | RX | | | ||
+----------+--------------------------------+---------+-----------+-----------------------------------+ | ||
| M1-25 | ``m5stack_stamps3_header:24`` | | WAKE | User-Button | | ||
+----------+--------------------------------+---------+-----------+-----------------------------------+ | ||
| M1-26 | | | TX | | | ||
+----------+--------------------------------+---------+-----------+-----------------------------------+ | ||
| M1-27 | ``m5stack_stamps3_header:26`` | | HOLD | Battery-hold signal | | ||
+----------+--------------------------------+---------+-----------+-----------------------------------+ | ||
| M1-28 | **3_3V** | 3.3V main output | | ||
| | | (via StampS3 DCDC) | | ||
+----------+--------------------------------+---------+-----------+-----------------------------------+ | ||
|
||
Start Application Development | ||
***************************** | ||
|
||
Before powering up your M5Stack M5Dial, please make sure that the board is in good | ||
condition with no obvious signs of damage. | ||
|
||
Building & Flashing | ||
=================== | ||
|
||
M5Dial is based on ``m5stack_stamps3``. | ||
You may build and flash applications for M5Stack StampS3 as usual (see | ||
:ref:`build_an_application` and :ref:`application_run` for more details), and | ||
include this shield as an overlay. | ||
|
||
A good first example to test is :zephyr:code-sample:`lvgl`: | ||
|
||
.. zephyr-app-commands:: | ||
:zephyr-app: samples/subsys/display/lvgl | ||
:board: m5stack_stamps3 | ||
:shield: m5stack_m5dial | ||
:goals: build 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``). | ||
|
||
.. note:: | ||
Because there currently is missing automatic PWM control or an external backlight | ||
driver, the display backlight be default is disabled. You may need to enable it | ||
in your application or by using the PWM shell. | ||
|
||
Debugging | ||
--------- | ||
|
||
M5Stack M5Dial debugging is not supported due to pinout limitations. | ||
|
||
Related Documents | ||
***************** | ||
|
||
- `M5Stack M5Dial schematic <https://m5stack.oss-cn-shenzhen.aliyuncs.com/resource/docs/products/core/M5Dial/Sch_M5Dial.pdf>`_ | ||
- `M5Stack M5Dial documentation <https://docs.m5stack.com/en/core/M5Dial>`_ | ||
- `ESP32S3 Datasheet <https://www.espressif.com/sites/default/files/documentation/esp32-s3_datasheet_en.pdf>`_ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,139 @@ | ||
/* | ||
* Copyright (c) 2023 Martin Kiepfer <mrmarteng@teleschirm.org> | ||
* | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
#include <zephyr/dt-bindings/pwm/pwm.h> | ||
#include <zephyr/dt-bindings/display/panel.h> | ||
#include <zephyr/dt-bindings/input/input-event-codes.h> | ||
#include <zephyr/dt-bindings/mipi_dbi/mipi_dbi.h> | ||
|
||
/ { | ||
chosen { | ||
zephyr,display = &gc9x01x_lcd; | ||
zephyr,display-backlight = &backlight_pwm; | ||
zephyr,rtc = &pfc8563_rtc; | ||
}; | ||
|
||
aliases { | ||
sw0 = &user_button_1; /* overwrite StampS3 user button */ | ||
}; | ||
|
||
gpio_keys { | ||
compatible = "gpio-keys"; | ||
|
||
user_button_1: button_1 { | ||
label = "User button 1"; | ||
gpios = <&m5stack_stamps3_header 24 GPIO_ACTIVE_LOW>; | ||
zephyr,code = <INPUT_KEY_0>; | ||
}; | ||
|
||
rotary_left: rotary_left { | ||
label = "rotary left"; | ||
gpios = <&m5stack_stamps3_header 20 GPIO_ACTIVE_LOW>; | ||
zephyr,code = <INPUT_KEY_LEFT>; | ||
}; | ||
|
||
rotary_right: rotary_right { | ||
label = "rotary right"; | ||
gpios = <&m5stack_stamps3_header 22 GPIO_ACTIVE_LOW>; | ||
zephyr,code = <INPUT_KEY_RIGHT>; | ||
}; | ||
}; | ||
|
||
mipi_dbi_gc9x01x_240x240 { | ||
compatible = "zephyr,mipi-dbi-spi"; | ||
spi-dev = <&m5stack_stamps3_spilcd>; | ||
dc-gpios = <&m5stack_stamps3_header 3 GPIO_ACTIVE_HIGH>; | ||
reset-gpios = <&m5stack_stamps3_header 7 GPIO_ACTIVE_LOW>; | ||
write-only; | ||
#address-cells = <1>; | ||
#size-cells = <0>; | ||
|
||
gc9x01x_lcd: gc9x01x_lcd@0 { | ||
compatible = "galaxycore,gc9x01x"; | ||
reg = <0>; | ||
mipi-max-frequency = <100000000>; | ||
display-inversion; | ||
pixel-format = <PANEL_PIXEL_FORMAT_RGB_565>; | ||
|
||
width = <240>; | ||
height = <240>; | ||
|
||
mipi-mode = <MIPI_DBI_MODE_SPI_4WIRE>; | ||
}; | ||
}; | ||
|
||
backlight_pwm: backlight_pwm { | ||
status = "okay"; | ||
compatible = "pwm-clock"; | ||
#clock-cells = <1>; | ||
pwms = <&m5stack_stamps3_clkout0 0 PWM_MSEC(5) PWM_POLARITY_NORMAL>; | ||
}; | ||
|
||
beeper_pwm: beeper_pwm { | ||
status = "okay"; | ||
compatible = "pwm-clock"; | ||
#clock-cells = <1>; | ||
pwms = <&m5stack_stamps3_clkout0 2 PWM_USEC(1500) PWM_POLARITY_NORMAL>; | ||
}; | ||
|
||
battery_hold { | ||
compatible = "regulator-fixed"; | ||
regulator-name = "battery_hold"; | ||
enable-gpios = <&m5stack_stamps3_header 26 GPIO_ACTIVE_HIGH>; | ||
regulator-boot-on; | ||
}; | ||
|
||
grove_headerA: grove_headerA { | ||
compatible = "grove-header"; | ||
#gpio-cells = <2>; | ||
gpio-map-mask = <0xffffffff 0xffffffc0>; | ||
gpio-map-pass-thru = <0 0x3f>; | ||
gpio-map = <0 0 &m5stack_stamps3_header 16 0>, | ||
<1 0 &m5stack_stamps3_header 14 0>; | ||
}; | ||
|
||
grove_headerB: grove_headerB { | ||
compatible = "grove-header"; | ||
#gpio-cells = <2>; | ||
gpio-map-mask = <0xffffffff 0xffffffc0>; | ||
gpio-map-pass-thru = <0 0x3f>; | ||
gpio-map = <0 0 &m5stack_stamps3_header 0 0>, | ||
<1 0 &m5stack_stamps3_header 1 0>; | ||
}; | ||
|
||
lvgl_pointer { | ||
compatible = "zephyr,lvgl-pointer-input"; | ||
input = <&ft5267_touch>; | ||
swap-xy; | ||
}; | ||
|
||
}; | ||
&m5stack_stamps3_clkout0 { | ||
status = "okay"; | ||
|
||
}; | ||
|
||
&m5stack_stamps3_i2c1 { | ||
status = "okay"; | ||
|
||
ft5267_touch: ft3267@38 { | ||
compatible = "focaltech,ft5336"; | ||
reg = <0x38>; | ||
int-gpios = <&m5stack_stamps3_header 15 0>; | ||
}; | ||
|
||
pfc8563_rtc: pfc8563@51 { | ||
compatible = "nxp,pcf8563"; | ||
reg = <0x51>; | ||
status = "okay"; | ||
}; | ||
}; | ||
|
||
&m5stack_stamps3_spilcd { | ||
status = "okay"; | ||
dma-enabled; | ||
}; | ||
|
||
groveA_i2c: &m5stack_stamps3_i2c0 {}; |
3 changes: 3 additions & 0 deletions
3
samples/subsys/display/lvgl/boards/m5stack_stamps3_procpu.conf
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
# SPDX-License-Identifier: Apache-2.0 | ||
|
||
CONFIG_MAIN_STACK_SIZE=4096 |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
#67253 (comment) this still applies