← index #18934PR #4711
Off-topic · high · value 0.788
QUERY · ISSUE

STM32 H563 I2C TIMINGR Add

openby vvchangningopened 2026-03-16updated 2026-03-16
enhancementport-stm32

Description

Description
The STM32H5 series (e.g., STM32H563/H573) features high-performance I2C peripherals (I2C V2 IP), which utilize the 32-bit I2C_TIMINGR register for baud rate and timing configuration (Standard-mode, Fast-mode, and Fast-mode Plus).

Currently, in ports/stm32/, the preprocessor logic for I2C_V2 and TIMINGR calculation includes families like STM32H7, STM32G0/G4, and STM32WB, but STM32H5 is notably absent. This prevents the driver from correctly initializing the I2C block on H5 hardware.

Verification & Results
I have implemented a patch to include STM32H5 in the I2C V2 logic. Local testing on a H563RI Board demonstrates that the timing calculation is accurate. I have successfully verified stable I2C communication at standard bus speeds, as well as custom configurations up to 1.5 MHz (overclocked Fast-mode Plus), which confirms the flexibility and correctness of the timing logic.

<img width="586" height="292" alt="Image" src="https://github.com/user-attachments/assets/e14a14fe-a3df-4fdb-9b7a-838631271579" />

Code Size

No response

Implementation

I hope the MicroPython maintainers or community will implement this feature

Code of Conduct

Yes, I agree

CANDIDATE · PULL REQUEST

stm32/i2c: Use timeout passed through from machine.I2C() if set, else existing default of 50ms.

closedby andrewleechopened 2019-04-23updated 2019-05-21

This PR ensure stm32 hardware i2c implementation honors the existing timeout argument on machine.I2C init commands.

Previously the stm32 i2c timeout is hard coded to 50ms which isn't guaranteed to be enough depending on the clock stretching specs of the I2C device(s) in use.

Ah, I now see timeout is an undocumented arg, not described on: https://docs.micropython.org/en/latest/library/machine.I2C.html
I'm not sure if it's implemented for any other ports at this stage.

Keyboard

j / / n
next pair
k / / p
previous pair
1 / / h
show query pane
2 / / l
show candidate pane
c
copy suggested comment
r
toggle reasoning
g i
go to index
?
show this help
esc
close overlays

press ? or esc to close

copied