I2C on STM32 unable to decrease speed from 100Khz to 80Khz

I am trying to reduce the default I2C speed from 100Khz to 80Khz on a nucleo-G071RBT6 development board. I’m using Keil Studio Cloud, and MBED OS 6.17

As far as I am aware, the defaults are 100Khz, and 400Khz and the i2c.frequency() command does not allow anything other than those two parameters. Is there an override for this, or is there another way of changing the i2c frequency?


For the STM32 parts, the i2c frequency is restricted in the mbed API implementation. To bypass this you will have to use the HAL layer directly.

Wait, there is a way to change this. You just have to add to target_overrides in mbed_app.json:

"i2c_timing_value_algo": true

This enables the code that can calculate arbitrary i2c frequencies for STM32