Skip to content

esp32: ESP32-H2 board definition#19317

Open
rafal-kw wants to merge 1 commit into
micropython:masterfrom
rafal-kw:esp32h2
Open

esp32: ESP32-H2 board definition#19317
rafal-kw wants to merge 1 commit into
micropython:masterfrom
rafal-kw:esp32h2

Conversation

@rafal-kw

@rafal-kw rafal-kw commented Jun 6, 2026

Copy link
Copy Markdown

Summary

This PR adds support for the ESP32-H2 processor from Espressif in the form of two board definitions - ESP32_GENERIC_H2 and M5STACK_NANOH2.

Testing

Completed testing on the M5StackH2

  • Tested GPIO via on board LED
  • Tested ADC channels can be read
  • I2C & SPI instantiation
  • BLE packet scanner
  • run_tests.py

Generative AI

I used generative AI tools when creating this PR, but a human has checked the
code and is responsible for the code and the description above.

@github-actions

github-actions Bot commented Jun 6, 2026

Copy link
Copy Markdown

Code size report:

Reference:  samd/mphalport: Run events at least once in mp_hal_delay_ms. [af38ee1]
Comparison: esp32: Added esp32h2 port. [merge of 5ac614e]
  mpy-cross:    +0 +0.000% 
   bare-arm:    +0 +0.000% 
minimal x86:    +0 +0.000% 
   unix x64:    +0 +0.000% standard
      stm32:    +0 +0.000% PYBV10
      esp32:    +0 +0.000% ESP32_GENERIC
     mimxrt:    +0 +0.000% TEENSY40
        rp2:    +0 +0.000% RPI_PICO_W
       samd:    +0 +0.000% ADAFRUIT_ITSYBITSY_M4_EXPRESS
  qemu rv32:    +0 +0.000% VIRT_RV32

Supports ESP32_GENERIC_H2 and M5STACK_NANOH2 boards with the esp32h2.

Signed-off-by: Rafal Wadowski <rafal@wadowski.com.au>
@rafal-kw rafal-kw changed the title ESP32-H2 board definition esp32: ESP32-H2 board definition Jun 7, 2026
@@ -0,0 +1,10 @@
# Workaround for https://github.com/espressif/esp-idf/issues/14456

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this needed on the H2 ?
as it fixes an issue under high WiFi load , and as the H2 does not have WiFi ...

@Josverl

Josverl commented Jun 8, 2026

Copy link
Copy Markdown
Contributor

I can build and flash this to my no-name H2 devboard.
There are 2 hardware tests failing : 2 tests failed: extmod/machine_i2s_rate.py extmod/machine_spi_rate.py

for the I2S tests I needed to adjust the pin used in the test, I think you may need similar for the spi_rate test.

--- a/tests/extmod/machine_i2s_rate.py
+++ b/tests/extmod/machine_i2s_rate.py
@@ -29,8 +29,13 @@ elif "esp32" in sys.platform:
     try:
         i2s_instances = ((0, Pin(18), Pin(19), Pin(21), Pin(14)),)
     except ValueError:
-        # fallback to lower pin number for ESP32-C3
-        i2s_instances = ((0, Pin(6), Pin(7), Pin(10), Pin(11)),)
+        if sys.implementation._machine:
+            if "ESP32-H2" in sys.implementation._machine:
+                # fallback to lower pin number for ESP32-H2
+                i2s_instances = ((0, Pin(3), Pin(4), Pin(10), Pin(12)),)
+            else:
+                # fallback to lower pin number for ESP32-C3
+                i2s_instances = ((0, Pin(6), Pin(7), Pin(10), Pin(11)),)
     # Allow for small additional RTOS overhead
     MAX_DELTA_MS = 8

@Josverl Josverl added port-esp32 board-definition New or updated board definition files. Combine with a port- label. labels Jun 8, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

board-definition New or updated board definition files. Combine with a port- label. port-esp32

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants