cancel
Showing results for 
Search instead for 
Did you mean: 

STM32H5: PVD interrupt not triggered

jowakar122
Senior

I am using STM32H573 and I have tried to enable PVD some what like this:

void PVD_Init()
{
	PWR_PVDTypeDef pvdconfig;

	HAL_NVIC_SetPriority(PVD_AVD_IRQn, 5, 0);
	HAL_NVIC_EnableIRQ(PVD_AVD_IRQn);

	pvdconfig.Mode = PWR_PVD_MODE_IT_RISING_FALLING;
	pvdconfig.PVDLevel = PWR_PVDLEVEL_7;

	HAL_PWR_ConfigPVD(&pvdconfig);
	HAL_PWR_EnablePVD();
}

void HAL_PWR_PVDCallback()
{
//	HAL_GPIO_WritePin(GPIOC, LED_1_Pin, GPIO_PIN_SET);
	printf("\rBefore RESET COUNT: %.2f\n", counter);
	EEPROM_Write_NUM(0, 0, counter);
}

Someone might say to enable the clock but for this module I don't think we need to manually enable the clock. I have looked into it and am pretty sure about it. If anyone else have some other theories please let me know. Also made sure that EXTI 16 is connected internally. 

3 REPLIES 3
MHoll.2
Senior III

Do You have the "low level" IRQ Function (PVD_AVD_IRQHandler()) calling the HAL IRQ Handler (HAL_PWR_PVD_IRQHandler)?

void PVD_AVD_IRQHandler(void)
{
    HAL_PWR_PVD_IRQHandler();
}

@MHoll.2 

If you are referring to this then I have added this in stm32h5xx_it.c file

Yes, exactly, so this should work. If You never hit a brakepoint in this function, then you have to dig into this with the debugger (Trigger the Event by changing the Voltage on VDD, an then check the PVDO Bit in PWR_VMSR  register to see if Voltage drop was registered, then check if it is register in EXTI and so on).

I only noticed now that you are using PWR_PVDLEVEL_7 this will connect the comparator to the PVD_IN pin (PB15). So You have to move the Voltage on PB15, not VDD.