The actual I2C frequency is faster than specified one and it may exceededs I2C's specification for Fast mode.
Also, pyb.I2C initialize with baudrate=400000 (I2C Fast mode) by default but actual frequency of SCL is faster than 400KHz.
The frequency of SCL should be less than or equal to 400KHz in Fast mode.
This PR fixes following issue.
The actual I2C frequency is faster than specified one and it may exceededs I2C's specification for Fast mode. Also, pyb.I2C initialize with baudrate=400000 (I2C Fast mode) by default but actual frequency of SCL is faster than 400KHz. The frequency of SCL should be less than or equal to 400KHz in Fast mode.
How to reproduce
Execute this code
MicroPython Version
v1.19.1
Environment
NUCLEO-F446RE
Detail of changes
I2C is initialized by https://github.com/micropython/micropython/blob/0e8c2204da377e95b5000a3c708891d98cdeb69c/ports/stm32/pyb_i2c.c#L254-L257 but I think current stm32lib has a bug that the frequency is faster than specified one. This bug is fixed at least v1.24.1 but I couldn't find a release note about this fix. I backport it from v1.27.1.
After applying this PR, the frequency of SCL is less than 400KHz.