cancel
Showing results for 
Search instead for 
Did you mean: 

Possible CubeMX I2C timing config bug (STM32L0x and other)

TDJ
Lead

I try to complete standard I2C 100kHz setup for STM32L041 with 16MHz clock (I2C1CLK). Here are CubeMX setting:

0693W00000Dq1KcQAJ.pngTiming 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

0693W00000Dq1LpQAJ.pngPractically 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​ 

2 REPLIES 2
TDJ
Lead

 @Houda GHABRI​ Today I had to configure I2C for Nucleo-H7A3ZI. CubeMX generated timing (I2C clk=16MHz) 10911E24 translates to:

PRESC=1

SCLDEL=9

SDADEL=1

SCLH=30

SCLL=36

I am showing that for this config min SDADEL = 4.5, max SDADEL = 24.8 and min SCLDEL = 11 and CubeMX generated timings are out of range.

Luckily, Custom Timing is available - but why it disables Digital Filter? Someone using "custom timing" needs to know well what he/she is doing.

0693W00000DluwMQAR.png

TDJ
Lead

@Houda GHABRI​ @Imen DAHMEN​ 

And yet another, perhaps the last comment. Why CubeMX I2C "Custom Timings" are not available for small-factor boards like Nucleo-F303K8 or Nucleo-L031K6?

Is that the results of the assumption that simple boards are used by less experienced enthusiasts?