AnsweredAssumed Answered

CubeMX Bug Report: HAL for STM32L0 series

Question asked by dost.markus on Jul 20, 2016
Latest reply on Jan 19, 2017 by Imen D
Hi,

in the last time I played with the power modes of the STM32L0 and discovered an issue with the GPIO-HAL driver.

The used version of the HAL is 1.7.0 with a STM32L053 nucleo board.

I discovered that the initialization of USART-TX and -RX pins will increase the power consumption in STOP mode considerably. So I tried to deinitialize the pins to their reset state with the function HAL_GPIO_DeInit() before going into STOP mode.
But the consumption remains the same so I looked into the DeInit-function and recognized the line where the I/O mode is changed (line 327 in stm32l0xx_hal_gpio.c):

GPIOx->MODER &= ~(GPIO_MODER_MODE0 << (position * 2U));

The I/O mode is changed to "input" but the reference manual for the controller (RM0367) says in chapter 9.4.1 that the reset state for the I/O mode is "Analog" .

According to this I changed the line 327 to

GPIOx->MODER |= (GPIO_MODER_MODE0 << (position * 2U));

and the power consumption get decreased as expected.

Best regards,
Markus

Outcomes