tongcc 发表于 2017-12-18 22:41:52

stm32f103 无法进入PVD中断

使用STD标准库配置,能够进入PVD掉电检测中断。但使用HAL库进行配置,则无法进入中断。配置例程来自官方HAL例程。如下
static void PVD_Config(void)
{
PWR_PVDTypeDef sConfigPVD;
/*##-1- Enable Power Clock #################################################*/
__HAL_RCC_PWR_CLK_ENABLE();
/*##-2- Configure the NVIC for PVD #########################################*/
HAL_NVIC_SetPriority(PVD_IRQn, 0, 0);
HAL_NVIC_EnableIRQ(PVD_IRQn);

/* Configure the PVD Level to 3 and generate an interrupt on rising and falling
   edges(PVD detection level set to 2.5V, refer to the electrical characteristics
   of you device datasheet for more details) */
sConfigPVD.PVDLevel = PWR_PVDLEVEL_5;
sConfigPVD.Mode = PWR_PVD_MODE_EVENT_RISING_FALLING;
HAL_PWR_ConfigPVD(&sConfigPVD);

/* Enable the PVD Output */
HAL_PWR_EnablePVD();
}


void HAL_PWR_PVDCallback(void)
{
        HAL_GPIO_WritePin(LED_Error_GPIO_Port,LED_Error_Pin,0);
}


实在不知道什么地方出了问题

tongcc 发表于 2017-12-18 22:42:31

STD配置能够进入中断,说明硬件没有问题

Pyramid1208 发表于 2017-12-27 15:40:01

配置成中断模式,不要配置成事件模式。

摘星揽月111 发表于 2018-6-10 13:49:54

楼主问题怎么解决的。我的貌似也进不去
页: [1]
查看完整版本: stm32f103 无法进入PVD中断