STM32L4xx_HAL_Driver  1.14.0
Extended specific configuration functions

Extended specific configuration functions. More...

Functions

HAL_StatusTypeDef HAL_FLASHEx_ConfigLVEPin (uint32_t ConfigLVE)
 Configuration of the LVE pin of the Flash (managed by power controller or forced to low in order to use an external SMPS) More...
 

Detailed Description

Extended specific configuration functions.

 ===============================================================================
                ##### Extended specific configuration functions #####
 ===============================================================================
    [..]
    This subsection provides a set of functions allowing to manage the Extended FLASH
    specific configurations.

Function Documentation

◆ HAL_FLASHEx_ConfigLVEPin()

HAL_StatusTypeDef HAL_FLASHEx_ConfigLVEPin ( uint32_t  ConfigLVE)

Configuration of the LVE pin of the Flash (managed by power controller or forced to low in order to use an external SMPS)

Parameters
ConfigLVEConfiguration of the LVE pin, This parameter can be one of the following values:
  • FLASH_LVE_PIN_CTRL: LVE FLASH pin controlled by power controller
  • FLASH_LVE_PIN_FORCED: LVE FLASH pin enforced to low (external SMPS used)
Note
Before enforcing the LVE pin to low, the SOC should be in low voltage range 2 and the voltage VDD12 should be higher than 1.08V and SMPS is ON.
Return values
HALStatus

Definition at line 446 of file stm32l4xx_hal_flash_ex.c.

447 {
448  HAL_StatusTypeDef status;
449 
450  /* Process Locked */
451  __HAL_LOCK(&pFlash);
452 
453  /* Check the parameters */
454  assert_param(IS_FLASH_LVE_PIN(ConfigLVE));
455 
456  /* Wait for last operation to be completed */
457  status = FLASH_WaitForLastOperation((uint32_t)FLASH_TIMEOUT_VALUE);
458 
459  if (status == HAL_OK)
460  {
461  /* Check that the voltage scaling is range 2 */
462  if (HAL_PWREx_GetVoltageRange() == PWR_REGULATOR_VOLTAGE_SCALE2)
463  {
464  /* Configure the LVEN bit */
465  MODIFY_REG(FLASH->CFGR, FLASH_CFGR_LVEN, ConfigLVE);
466 
467  /* Check that the bit has been correctly configured */
468  if (READ_BIT(FLASH->CFGR, FLASH_CFGR_LVEN) != ConfigLVE)
469  {
470  status = HAL_ERROR;
471  }
472  }
473  else
474  {
475  /* Not allow to force Flash LVE pin if not in voltage range 2 */
476  status = HAL_ERROR;
477  }
478  }
479 
480  /* Process Unlocked */
482 
483  return status;
484 }
__HAL_UNLOCK(hrtc)
__HAL_LOCK(hrtc)
return HAL_OK
HAL_StatusTypeDef FLASH_WaitForLastOperation(uint32_t Timeout)
Wait for a FLASH operation to complete.
FLASH_ProcessTypeDef pFlash
Variable used for Program/Erase sectors under interruption.
uint32_t HAL_PWREx_GetVoltageRange(void)
Return Voltage Scaling Range.
MODIFY_REG(hrtc->Instance->CR, RTC_CR_WUCKSEL,(uint32_t) WakeUpClock)
assert_param(IS_RTC_WAKEUP_CLOCK(WakeUpClock))