2023-02-18 11:21 PM
Sir,
I am using the STM32L432 for my project.
How to get the PVD state ?
I want to know the power voltage that is above the level or under the level.
Thanks.
void HAL_PWR_PVDCallback(void) {
if ( __HAL_PWR_PVD_EXTI_GET_FLAG() ) {
// TODO: get PVD state
}
}
}
void PVD_Init() {
PWR_PVDTypeDef pvdStruct;
__HAL_RCC_PWR_CLK_ENABLE();
HAL_PWR_DeInit();
pvdStruct.PVDLevel = PWR_PVDLEVEL_6; // 2.9v
pvdStruct.Mode = PWR_PVD_MODE_IT_RISING_FALLING; // pvd 下�? = 電�?上�?�
HAL_PWR_ConfigPVD(&pvdStruct);
HAL_PWR_EnablePVD();
HAL_NVIC_SetPriority(PVD_PVM_IRQn, 0, 0);
HAL_NVIC_EnableIRQ(PVD_PVM_IRQn);
}
Solved! Go to Solution.
2023-02-19 12:32 AM
according to stm32l4xx_hal_pwr.h:
__HAL_PWR_GET_FLAG(PWR_FLAG_PVDO)
There are other flags too..
hth
KnarfB
2023-02-19 12:32 AM
according to stm32l4xx_hal_pwr.h:
__HAL_PWR_GET_FLAG(PWR_FLAG_PVDO)
There are other flags too..
hth
KnarfB
2023-02-19 02:03 AM
Hi KnarfB,
Thank you for your answer,
Your solution works correctly.
Best Regards,