cancel
Showing results for 
Search instead for 
Did you mean: 

Variable not initialized in STM32 LL MX_GPIO_Init()

Jalon Wong
Associate II
Posted on April 13, 2018 at 09:24

STM32CubeMX v4.0

STM32CubeF1 Firmware Package v1.6.1

The following is the code generated by STM32CubeMX.

void MX_GPIO_Init(void)
{
 LL_GPIO_InitTypeDef GPIO_InitStruct; 
 // ... 
 GPIO_InitStruct.Mode = LL_GPIO_MODE_OUTPUT; 
 GPIO_InitStruct.Speed = LL_GPIO_SPEED_FREQ_LOW; 
 GPIO_InitStruct.OutputType = LL_GPIO_OUTPUT_PUSHPULL; 
 LL_GPIO_Init(GPIOC, &GPIO_InitStruct); 
 //... 
}
ErrorStatus LL_GPIO_Init(GPIO_TypeDef *GPIOx, LL_GPIO_InitTypeDef *GPIO_InitStruct) 
{
 //... 
 assert_param(IS_LL_GPIO_PULL(GPIO_InitStruct->Pull)); 
 //... 
}�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?

The memberPullis notinitialized that leads to the program may be blocked atassert_param().

Hope to improve.Thanks !

#ll-gpio
2 REPLIES 2
Imen.D
ST Employee
Posted on April 16, 2018 at 11:59

Hello,

Your reported issue is raised internally to CubeMx team for check.

Best Regards,

Imen

When your question is answered, please close this topic by clicking "Accept as Solution".
Thanks
Imen
Jim Frederick_2
Associate III
Posted on April 16, 2018 at 13:36

I've seen the same problem for years.

One work-around is to modify the code to initialize the struct to zero e.g.,

LL_GPIO_InitTypeDef GPIO_InitStruct = {0};

When re-generating code, merge the new file (probably main.c in this case) with a backup of the old file using a code-merging utility and keep your changes.