Possible CubeMX I2C timing config bug (STM32L0x and other)
I try to complete standard I2C 100kHz setup for STM32L041 with 16MHz clock (I2C1CLK). Here are CubeMX setting:
Timing registry value is 0x00A03D53 which, according to RM0377, 23.7.5 Timing register (I2C_TIMINGR), translates to:
PRESC=0
SCLDEL=10
SDADEL=0
SCLH=61
SCLL=83
The problem: CubeMX calculated SDADEL value (zero) violates the first of the two conditions specified in RM0377, 23.4.5 I2C initialization - I2C timings
Practically speaking, SDADEL must always be greater than zero.
The potential problem is not limited to STM32L0x. It occurs with other newer MCUs as well.
My calculations show that similar reference settings provided in RM0377, Table 104 (SDADEL=2) do not fulfill the above mentioned SDADEL conditions as well.
CubeMX 6.3.0
STM32CubeL0 Firmware Package V1.12.1 / 16-July-2021
#STM32CubeMX #[STM32 MCUs] #I2C