AnsweredAssumed Answered

STM32F042 PVR/Brownout Setting

Question asked by ashworth.rob.002 on May 10, 2016
Latest reply on Jun 1, 2016 by Amel N
I am having an issue with a slow supply ramp, so I have been trying to set the STM32F042 to do a software reset if the supply is under say 2.5Volts.  I've been playing around with the PVD settings, and interrupts to no avail.  Can anyone out there assist...?

This is where the PVD is configured:

/**
  * @brief  Configures the PVD resources.
  * @param  None
  * @retval None
  */
void PVD_Config(void)
{
  
  NVIC_InitTypeDef NVIC_InitStructure;
  EXTI_InitTypeDef EXTI_InitStructure;
  
  /* Enable PWR clock */
  RCC_APB1PeriphClockCmd(RCC_APB1Periph_PWR, ENABLE);
  
  /* Enable the PVD Interrupt */
  NVIC_InitStructure.NVIC_IRQChannel = PVD_IRQn;
  NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE;
  NVIC_Init(&NVIC_InitStructure);
  
  /* Configure EXTI Line16(PVD Output) to generate an interrupt on rising and
     falling edges */
  EXTI_ClearITPendingBit(EXTI_Line16);
  EXTI_InitStructure.EXTI_Line = EXTI_Line16;
  EXTI_InitStructure.EXTI_Mode = EXTI_Mode_Interrupt;
  EXTI_InitStructure.EXTI_Trigger = EXTI_Trigger_Rising_Falling;
  EXTI_InitStructure.EXTI_LineCmd = ENABLE;
  EXTI_Init(&EXTI_InitStructure);
  
  /* Configure the PVD Level to 3 (2.5V) */
  PWR_PVDLevelConfig(PWR_PVDLevel_3);
  
  /* Enable the PVD Output */
  PWR_PVDCmd(ENABLE);
  
}

Then in my interrupt handler file I have:

//Mangage a slow power on - or brownout by resetting the uC untils upply is at a sufficient level
void PVD_VDDIO2_IRQHandler(void)
{
    NVIC_SystemReset();
  
}

There appears to be few people who use this feature - or at least non of the examples seem to use it!

Outcomes