cancel
Showing results for 
Search instead for 
Did you mean: 

[Issue] CubeMx Assert failed with I2C Low Layer

nicolas b
Associate III
Posted on April 25, 2018 at 10:17

We encountered a problem with CubeMx and I2C Low Layer libraray on an STM32F413RH.

The code fall in an assertion.

The initialization from CubeMx :

  I2C_InitStruct.PeripheralMode = LL_I2C_MODE_I2C;

  I2C_InitStruct.ClockSpeed = 100000;

  I2C_InitStruct.DutyCycle = LL_I2C_DUTYCYCLE_2;

  I2C_InitStruct.OwnAddress1 = 0;

  I2C_InitStruct.TypeAcknowledge = LL_I2C_ACK;

  I2C_InitStruct.OwnAddrSize = LL_I2C_OWNADDRESS1_7BIT;

  LL_I2C_Init(I2C1, &I2C_InitStruct);

The assertion in stm32f4xx_ll_i2c.c, line 173:

uint32_t LL_I2C_Init(I2C_TypeDef *I2Cx, LL_I2C_InitTypeDef *I2C_InitStruct)

{

  LL_RCC_ClocksTypeDef rcc_clocks;

  /* Check the I2C Instance I2Cx */

  assert_param(IS_I2C_ALL_INSTANCE(I2Cx));

  /* Check the I2C parameters from I2C_InitStruct */

  assert_param(IS_LL_I2C_PERIPHERAL_MODE(I2C_InitStruct->PeripheralMode));

  assert_param(IS_LL_I2C_CLOCK_SPEED(I2C_InitStruct->ClockSpeed));

  assert_param(IS_LL_I2C_DUTY_CYCLE(I2C_InitStruct->DutyCycle));

&sharpif  defined(I2C_FLTR_ANOFF)&&defined(I2C_FLTR_DNF)

  assert_param(IS_LL_I2C_ANALOG_FILTER(I2C_InitStruct->AnalogFilter)); // failed here

  assert_param(IS_LL_I2C_DIGITAL_FILTER(I2C_InitStruct->DigitalFilter));

&sharpendif

CubeMx version 4.25.0

Package STM32Cube FW_F4 V1.21.0

#cube #low-layer #lowlayer
4 REPLIES 4
Khouloud GARSI
Lead II
Posted on April 25, 2018 at 12:30

Hi Nicola,

Could you please share your ioc file. This will help us for the debug.

Thanks!

Khouloud.

Posted on April 25, 2018 at 13:53

Done.

The problem is that the AnalogFilter and DigitalFilter in the struct are not initialized, so it can contain anything.

A call to LL_I2C_StructInit should be done I think.

Houda GHABRI
ST Employee
Posted on May 02, 2018 at 15:59

nicolas.bonnec

Hi,

This issue will be fixed in CubeMX next release .

regards,

Houda

nicolas b
Associate III
Posted on July 04, 2018 at 11:23

Issue not fixed with CubeMX 4.26.0 and FW_F4 V1.21.0.