2019-10-16 08:53 PM
void main(void)
{
/* Infinite loop */
CLK_SYSCLKDivConfig(CLK_SYSCLKDiv_8);
GPIO_Init(GPIOE, GPIO_Pin_7, GPIO_Mode_In_PU_IT);
EXTI_setup();
halt(); // first active
#if 0
while(1)
{
halt();
delay_ms(1000);
if(GPIO_ReadInputDataBit(GPIOE, GPIO_Pin_7) == 0)
{
//i++;
//if(i == 25)
break;
}
}
#endif
usart_setup();
USART_SendData8(USART1, 'a');
USART_SendData8(USART1, 'b');
while (1)
{
}
}
void EXTI_setup(void)
{
ITC_DeInit();
ITC_SetSoftwarePriority(EXTI7_IRQn, ITC_PriorityLevel_1);
EXTI_DeInit();
EXTI_SetPinSensitivity(GPIO_Pin_7, EXTI_Trigger_Falling);
//EXTI_SetPinSensitivity(GPIO_Pin_7, EXTI_Trigger_Rising);
//EXTI_SetTLISensitivity(EXTI_TLISENSITIVITY_FALL_ONLY);
enableInterrupts();
}
when in long press, it does not wakeup.
until release , then wakeup
2019-10-16 09:10 PM
EXTI_SetPinSensitivity(GPIO_Pin_7, EXTI_Trigger_Rising);
Change the trigger for that interrupt to rising edge instead of falling edge, then it should wake up instantly.
2019-10-17 12:23 AM
debug long time, falling edge can not
when change to rising edge , configure pe7 to floating input with it , and gpio connect to gnd directly?
2019-10-17 12:39 AM
Can you post the schematic how the button is connected?
For rising edge to work, the io should be pulled down, and button then connects it to VCC.
For falling edge to work, IO should be pulled to VCC, button then grounds it.
Based on your initial proplem description i assume the IO is pulled low(gnd) and the button connects to vcc, which would result to behaviour you observe, which is that mcu wakeups when the button is released.
2019-10-17 02:46 AM
the falling edge one