2021-05-26 11:10 PM
I try to capture power off timestamp by using PVD_IRQHandler(), but it doesn't work. The PVD is configured at power up at below:
void Config_PWR_PDV(void)
{
PWR_PVDTypeDef PVDSetting;
HAL_PWR_DisablePVD();
PVDSetting.Mode = PWR_PVD_MODE_IT_FALLING; //Falling edge.
PVDSetting.PVDLevel = PWR_PVDLEVEL_7; //E0; 2.9Volt
HAL_PWR_ConfigPVD(&PVDSetting);
HAL_PWR_EnablePVD();
}
The PVD_IRQ is enabled in the STMCube, it seems not trigger the interrupt when I power off the board.
From the user manual, it mention "EXTI line 16", maybe this cause the problem, but I can't setup for "EXTI 16" in STMCube.
2021-05-26 11:50 PM
Then set it up normally - in EXTI, set the required edge (probably rising) and enable the respective interrupt; enable it also in NVIC; then write an ISR with a proper name matching the name in the vector table in startup file, in which don't forget to clear the respective EXTI status flag which caused the interrupt.
JW
2021-05-27 12:34 AM
I can find this in the stm32f4XXhal_msp.c
/* PVD_IRQn interrupt configuration */
HAL_NVIC_SetPriority(PVD_IRQn, 0, 0);
HAL_NVIC_EnableIRQ(PVD_IRQn);
This is from the user manual:
this event is internally connected to the EXTI line16 and can generate an
interrupt if enabled through the EXTI registers. The PVD output interrupt can be generated
when VDD drops below the PVD threshold and/or when VDD rises above the PVD threshold
depending on EXTI line16 rising/falling edge configuration.
The problem is how to setup EXTI line 16.
I find the stm32f4xx_ll_exti.c in this directory:
C:\Users\***\STM32Cube\Repository\STM32Cube_FW_F4_V1.18.0\Drivers\STM32F4xx_HAL_Driver\Src
But it required to define "USE_FULL_LL_DRIVER", is it manually to import this file to project?
2021-05-27 12:52 AM
Why can't you simply write to EXTI registers, without use of any "library"?
JW
2021-06-09 07:43 AM
Hello @New.Fish,
I am wondering whether you have solved the issue you are facing, if yes please share with us the solution.
Otherwise, I recommend you the following:
1- Please make sure that PWR clock is enabled (__HAL_RCC_PWR_CLK_ENABLE(); )
2- If the issue is still there please share the project, allowing to reproduce it.
Chahinez.