AnsweredAssumed Answered

[Bug Report] CubeMX generated I2C init has flaw

Question asked by Dave Jones on Apr 17, 2018
Latest reply on Apr 23, 2018 by Nawres GHARBI

I don't know if there's a non-forum place to send CubeMX bug reports, so I'm putting it here.

 

I found this when generating a CubeMX project for the STM32L452 with the I2C ports created using LL code..

 

In the I2C initialization code, at the end of the MX_I2Cx_Init() function (where "x" is the I2C port number) there is a line: LL_I2C_EnableClockStretching(I2Cx); (or presumably similar with "disable" if that's your choice within CubeMX). The flaw is that, according to both the RM and the comments inside the code where that function is defined, the clock stretching bit can not be changed when the I2C port is enabled. But the init code enables the port several lines previous to changing that bit.

Outcomes