cancel
Showing results for 
Search instead for 
Did you mean: 

STM32F042 PVR/Brownout Setting

rob2399
Associate II
Posted on May 10, 2016 at 12:47

I am having an issue with a slow supply ramp, so I have been trying to set theSTM32F042 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!
1 REPLY 1
Amel NASRI
ST Employee
Posted on June 01, 2016 at 13:06

Hi ashworth.rob.002,

I don't see an issue based on the code you provided.

To identify the root cause of your problem, I recommend you to test the example STM32F0xx_StdPeriph_Lib\Projects\STM32F0xx_StdPeriph_Examples\SYSCFG\SYSCFG_PVD. If it works as expected, you can then make the updates you need depending on your application.

-Mayla-

To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.