MicroPython v1.26

machine.I2CTarget, the float-accuracy overhaul, native emitter wins, plus STM32N6 and ESP32-C2.

Released August 9, 2025

🔌
machine.I2CTarget
Python responds on I2C
🎯
Float accuracy
98.5% repr-reversibility
Native emitter
Tighter code on every arch
🚀
Counter / Encoder
Hardware pulse counting
0 Contributors
0 Timezones
0 New Boards
Float and language demos on this page run real MicroPython in your browser. MicroPython is compiled to WebAssembly via PyScript and executes live as the page loads — no server required.
New

machine.I2CTarget — Your MCU Answers, Not Just Asks

MicroPython has supported I2C as a controller for years. v1.26 inverts the relationship: your MicroPython board can now be an I2C device, responding to reads and writes from another controller. Bind a bytearray as a register file for the simple case, or hook into IRQ callbacks to implement arbitrary protocols.

Interactive Demo — I2C Target on a Bus
SDA SCL Host (controller) I2C(0) MicroPython (target, addr 0x10) I2CTarget(0)
Target memory: buf = bytearray(16)
main.py — on the target board
from machine import Pin, I2CTarget

# Buffer mode — an I2C register/memory device backed by a bytearray
buf = bytearray(16)
target = I2CTarget(0, scl=Pin(1), sda=Pin(0),
                   addr=0x10, mem=buf)

# A controller on another board can now read/write this bytearray over I2C:
#   i2c.writeto_mem(0x10, 0x05, b'\x42')   -> buf[5] becomes 0x42
#   i2c.readfrom_mem(0x10, 0x05, 1)        -> b'\x42'

I2CTarget Port Support

All ports gaining machine.I2CTarget in v1.26.

alif
esp32
mimxrt
rp2
samd
stm32
zephyr
Improved

Float Accuracy — repr Round-Trips for Real

Before v1.26, only ~28% of single-precision floats round-tripped correctly through reprfloat → original value. v1.26 rewrites float printing and formatting; that number is now 98.5%. Double precision improved from 38% to 99.8%. The same fix means floats survive a save/load cycle through .mpy files.

Single precision
v1.25 — 0%
v1.26 — 0%
Double precision
v1.25 — 0%
v1.26 — 0%

Percentage of randomly-generated floats whose repr(x) output, when passed back through float(), recovers the original value exactly.

Live demo PyScript

Edit and run real MicroPython below. The output you see is generated by the same improved float-printing routines that ship in v1.26.

Loading MicroPython…

v1.26 also folds float constants at compile time: const(2 * math.pi) now evaluates in the compiler, not at runtime. And in object representation C (where floats are stored within the immediate object value, losing the bottom two bits), a heuristic now reconstructs those bits to reduce the bias toward zero.

Improved

Native & Viper Emitters — Every Architecture Got a Tune-Up

The native code emitters now produce more compact loads and stores across ARM, Thumb, Xtensa, RISC-V 32, x86 and x64. Thumb v1 (RP2040) gains long jumps greater than 12 bits, allowing larger Python functions to compile native. The inline Xtensa assembler now implements most of the LX3 opcode set.

ARM
Thumb
Thumb v1 / RP2040
Xtensa
RISC-V 32
x86
x64
Long jumps on Thumb v1
Larger functions decorated with @micropython.native now compile on RP2040 boards that previously hit branch-range limits. Inline Xtensa (@micropython.asm_xtensa) gains addx2, subx2, ssl, ssr, and most other LX3 opcodes — bringing the inline assembler much closer to feature-parity with hand-written ESP32 firmware.
New — esp32 only

machine.Counter & machine.Encoder — Hardware Pulse Counting

A new esp32.PCNT class wraps the ESP32 hardware pulse-counter peripheral, and ships with cross-port-style APIs machine.Counter (single-channel) and machine.Encoder (quadrature). Drag the dial below to feel how a quadrature encoder works.

Interactive Demo — Quadrature Encoder

Drag the dial to rotate

count
0
direction
·
Channel A
Channel B
main.py
from machine import Pin, Encoder

enc = Encoder(0, phase_a=Pin(4), phase_b=Pin(5))
while True:
    print(enc.value())   # signed count, sign indicates direction
esp32 only in v1.26
The Counter and Encoder classes live under machine.* but are currently implemented only on the esp32 port (via esp32.PCNT). The same pattern — introducing a feature on one port and standardising it across all of them later — is exactly what v1.28 did with machine.PWM and machine.CAN.
New

Python Language Tweaks

Five small core-language additions in v1.26. Pick one from the dropdown to load the example into the editor, then run it live.

Live demo PyScript
Loading MicroPython…

New MCUs

STM32N6 & ESP32-C2

Two new microcontrollers added in v1.26 — one chasing high-end ML inference on the edge, the other chasing low-cost RISC-V wireless.

STM32N6

800 MHz
800 MHz
ML accel
XSPI XIP flash

STMicroelectronics' new high-performance MCU with built-in machine-learning accelerators. v1.26 supports USB, XSPI memory-mapped external flash, a filesystem, basic peripherals and deep sleep.

NUCLEO_N657X0 OPENMV_N6

ESP32-C2 (ESP8684)

RISC-V
RV32 core
WiFi + BLE
low cost

Espressif's small, low-cost RISC-V MCU with WiFi and BLE. MicroPython on the C2 supports a REPL, filesystem, GPIO, I2C, ADC, PWM, timers, WiFi and BLE.

ESP32_GENERIC_C2 / FLASH_2M

Highlights

Other notable improvements in v1.26.

🔒

DTLS server support

The mbedTLS backend now handles HelloVerify and Anti Replay protection, enabling proper DTLS servers.

tls
📧

lwIP UDP queue

Multiple incoming UDP and raw packets can now be queued, replacing the previous single-packet buffer. More robust UDP protocols.

lwIP
📄

framebuf ROM blits

FrameBuffer.blit() now accepts read-only data, so custom fonts and bitmaps can live in flash instead of RAM.

framebuf

time module range standardised

time(), localtime() and mktime() now cover at least 1970–2099 on every platform, regardless of the underlying epoch.

all ports
📊

VM avoids slice allocations

buf[a:b] = c on bytearrays/memoryviews no longer heap-allocates the slice — works inside hard IRQs and reduces GC churn.

core
🔎

mpremote fs tree

New mpremote fs tree command (with -s/-h for sizes), and df now uses no-arg vfs.mount() for a much better mount summary.

mpremote
🛡

Compressed error messages on rp2

Enabled by default, saving ~3 kB of firmware on RP2040 / RP2350 builds.

rp2
🪚

sys.implementation._thread

New attribute reports the threading model in use — either GIL or unsafe/no-GIL — so portable code can adapt.

sys

nrf enable_irq() — breaking change

Signature is now enable_irq(state) matching all other ports. Previously enable_irq(). Affects nrf boards only.

nrf
🔬

Zephyr v4.0.0 + new peripherals

PWM support added; UARTs gain ring-buffered IRQ-driven I/O; SoftI2C/SoftSPI enabled; boot.py/main.py now run at startup.

zephyr
🌐

WebAssembly FFI improvements

JsProxy equality, better has/get proxying, correct self-binding for JavaScript methods, and reuse of proxy references for stable identity on the Python side.

webassembly
📝

__all__ in star imports

from mod import * now respects a module-level __all__. PEP 487 __set_name__ is also supported.

core

New Boards

10 new board definitions across 4 ports.

By the Numbers

v1.26 in numbers. esp32 grew most, driven by ESP-IDF v5.4.2 plus the new I2CTarget.

0
Contributors
0
Timezones
0
New Boards

Code size delta vs v1.25 (.text section, bytes)

esp32
+1.12% — IDF 5.4.2 + I2CTarget
+19064 B
stm32
+0.97% — I2CTarget, float accuracy, native emitter
+3776 B
mimxrt
+0.97% — I2CTarget, float accuracy
+3600 B
esp8266
+0.50% — LX3 opcodes, LittleFS v2.11
+3484 B
samd
+1.23% — I2CTarget, float accuracy
+3296 B
rp2 (PICO_W)
+0.25% — I2CTarget + DTLS Anti Replay
+2252 B
renesas-ra
+0.21% — float accuracy, native emitter
+1296 B
nrf
+0.61% — float accuracy, IOBase
+1140 B
rp2 (PICO)
+0.25% — offset by -3kB compressed errors
+556 B
cc3200
+0.21% — IOBase at core feature level
+392 B
unix x64
-0.05% — bss reduction (was: DTLS additions)
-376 B
minimal x86
-0.11% — integer var-arg handling
-207 B
bare-arm
-0.17% — integer var-arg handling
-96 B
Alessandro Gatti, Andrea Giammarchi, Andrew Leech, Angus Gratton, Anson Mansfield, Anton Blanchard, Ayush Singh, Chris Webb, Christian Lang, Damien George, Daniel Campora, Daniël van de Giessen, David Schneider, David Yang, Detlev Zundel, Dryw Wade, dubiousjim, Elvis Pfutzenreuter, ennyKey, Garatronic, Herwin Grobben, iabdalkader, IhorNehrutsa, Jeff Epler, Jim Mussared, Jonathan Hogg, Jos Verlinde, Koudai Aono, Malcolm McKellips, Matt Trentini, Maureen Helm, Meir Armon, Patrick Joy, Peter Harper, Phil Howard, purewack, Rick Sorensen, robert-hh, root, SiZiOUS, stijn, TianShuang Ke, Vdragon, Yanfeng Liu, Yoctopuce dev, Yuuki NAGAO.