feat: add M5Stack Core2 board support#91
Merged
ThomasFarstrike merged 2 commits intoMicroPythonOS:mainfrom Mar 28, 2026
Merged
Conversation
Add hardware support for M5Stack Core2 (ESP32-D0WDQ6-V3): New files: - drivers/power/axp192.py: AXP192 power management IC driver handling voltage regulation (DCDC1/3, LDO2/3), GPIO control (LCD/touch reset, speaker enable), battery monitoring via ADC, and charging control. - mpos/board/m5stack_core2.py: Board initialization including ILI9342C display (SPI), FT6336U capacitive touch (I2C), NS4168 I2S speaker, SPM1423 PDM microphone, MPU6886 IMU, and AXP192-based battery voltage reading. Modified files: - mpos/main.py: Add Core2 detection via AXP192 I2C probe (0x34) in detect_board(). Guard ESP32-S3 specific GPIO probes (pins 10/11, 39/38, 48/47) with chip variant check to prevent WDT reset on ESP32. Hardware peripherals supported: - Display: ILI9342C 320x240 via SPI (SCLK=18, MOSI=23, DC=15, CS=5) - Touch: FT6336U via shared I2C host 0 (SDA=21, SCL=22, addr=0x38) - Power: AXP192 via shared I2C host 0 (addr=0x34) - Audio: NS4168 speaker (I2S: BCLK=12, LRCK=0, DATA=2) - Mic: SPM1423 (PDM: CLK=0, DATA=34) - IMU: MPU6886 via shared I2C host 0 (addr=0x68) - Battery: Read via AXP192 ADC (no dedicated ADC pin needed) All I2C devices share a single hardware I2C(0) controller. LCD reset and backlight are controlled via AXP192 GPIO4 and DCDC3 respectively. Tested on M5Stack Core2 (original version). Signed-off-by: imliubo <imliubo@makingfun.xyz>
Contributor
Author
Contributor
|
Super cool! Awesome to see another board support land, looks good!
Nice touch! In general, the whole board detect should be reworked to be more modular (not in main.py but in each board's file) but that's out of the scope of this pull request. |
Contributor
|
There was a conflict with the T-HMI board support and I did the merge in a hurry in the browser so hopefully it's fine. Separating the board detecting ESP32 vs ESP32S3 is a good move to narrow it down! |
jedie
pushed a commit
to jedie/MicroPythonOS
that referenced
this pull request
Mar 28, 2026
Add hardware support for M5Stack Core2 (ESP32-D0WDQ6-V3): New files: - drivers/power/axp192.py: AXP192 power management IC driver handling voltage regulation (DCDC1/3, LDO2/3), GPIO control (LCD/touch reset, speaker enable), battery monitoring via ADC, and charging control. - mpos/board/m5stack_core2.py: Board initialization including ILI9342C display (SPI), FT6336U capacitive touch (I2C), NS4168 I2S speaker, SPM1423 PDM microphone, MPU6886 IMU, and AXP192-based battery voltage reading. Modified files: - mpos/main.py: Add Core2 detection via AXP192 I2C probe (0x34) in detect_board(). Guard ESP32-S3 specific GPIO probes (pins 10/11, 39/38, 48/47) with chip variant check to prevent WDT reset on ESP32. Hardware peripherals supported: - Display: ILI9342C 320x240 via SPI (SCLK=18, MOSI=23, DC=15, CS=5) - Touch: FT6336U via shared I2C host 0 (SDA=21, SCL=22, addr=0x38) - Power: AXP192 via shared I2C host 0 (addr=0x34) - Audio: NS4168 speaker (I2S: BCLK=12, LRCK=0, DATA=2) - Mic: SPM1423 (PDM: CLK=0, DATA=34) - IMU: MPU6886 via shared I2C host 0 (addr=0x68) - Battery: Read via AXP192 ADC (no dedicated ADC pin needed) All I2C devices share a single hardware I2C(0) controller. LCD reset and backlight are controlled via AXP192 GPIO4 and DCDC3 respectively. Tested on M5Stack Core2 (original version). Signed-off-by: imliubo <imliubo@makingfun.xyz> Co-authored-by: Thomas Farstrike <111072251+ThomasFarstrike@users.noreply.github.com>
Contributor
Author
|
Thx! |
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.


Summary
Add board support for M5Stack Core2, including AXP192 power management driver
and full hardware initialization (display, touch, audio, IMU, battery).
Changes
drivers/power/axp192.py- AXP192 PMU drivermpos/board/m5stack_core2.py- Core2 board initializationmpos/main.py- Board detection for Core2 + ESP32 GPIO safety fixHardware Tested
Notes
with chip variant check to prevent WDT reset on plain ESP32