cancel
Showing results for 
Search instead for 
Did you mean: 

how to change an external interrupt level on its interrupt

Hossein Golshik
Associate
Posted on November 27, 2017 at 10:40

hi,

I set external interrupt 3 on cubemx to Rising edge and need to change of trigger level that on its routine.

I write this code on interrupt 3 routine, but it always trigger by rising edge (down't execute falling edge) (PLEASE: see attach image)

how can I fix this problem with HAL driver command?

void EXTI3_IRQHandler(void)

{

  /* USER CODE BEGIN EXTI3_IRQn 0 */

switch(valuee){

    case 10:

    HAL_GPIO_WritePin(RLED_GPIO_Port,RLED_Pin, GPIO_PIN_SET);

    CLEAR_BIT(EXTI->RTSR,0X03);

    SET_BIT(EXTI->FTSR,0X03);

    valuee=15;

    break;

    

    case 15:

    HAL_GPIO_WritePin(RLED_GPIO_Port,RLED_Pin, GPIO_PIN_RESET);

    CLEAR_BIT(EXTI->FTSR,0X03);

    SET_BIT(EXTI->RTSR,0X03);

    valuee=10;

    break;

}

  /* USER CODE END EXTI3_IRQn 0 */

  HAL_GPIO_EXTI_IRQHandler(GPIO_PIN_3);

  /* USER CODE BEGIN EXTI3_IRQn 1 */

  /* USER CODE END EXTI3_IRQn 1 */

}

#cubemx-4.18 #interrput #rising-edge
1 ACCEPTED SOLUTION

Accepted Solutions
Hossein Golshik
Associate
Posted on November 27, 2017 at 12:01

I use

CLEAR_BIT(EXTI->RTSR,EXTI_RTSR_TR3);

 SET_BIT(EXTI->FTSR,EXTI_FTSR_TR3);

istead of :

CLEAR_BIT(EXTI->RTSR,0X03);

SET_BIT(EXTI->FTSR,0X03);

then, my problem is solved

View solution in original post

1 REPLY 1
Hossein Golshik
Associate
Posted on November 27, 2017 at 12:01

I use

CLEAR_BIT(EXTI->RTSR,EXTI_RTSR_TR3);

 SET_BIT(EXTI->FTSR,EXTI_FTSR_TR3);

istead of :

CLEAR_BIT(EXTI->RTSR,0X03);

SET_BIT(EXTI->FTSR,0X03);

then, my problem is solved