Skip to main content
Visitor II
October 17, 2019
Question

long press problem

  • October 17, 2019
  • 3 replies
  • 677 views
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

    This topic has been closed for replies.

    3 replies

    Visitor II
    October 17, 2019

    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.​

    Visitor II
    October 17, 2019

    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?

    Visitor II
    October 17, 2019

    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.​

    Visitor II
    October 17, 2019

    0690X00000AqTr8QAF.png

    the falling edge one