cancel
Showing results for 
Search instead for 
Did you mean: 

Not getting interrupt on stm32L5

Neel
Associate III

Hi ST Team,

I have used STM32L562-edk EVK for code development. I have configured gpio as a interrupt pin. When Interrupt is generated I have not getting interrupt in ISR routine. I have validated pin using read the gpio and get as expected behavior. I have implemented below ISR.

void HAL_GPIO_EXTI_Callback(uint16_t GPIO_Pin)

{

// Toggle LED

}

Please help me to debug this issue.

1 ACCEPTED SOLUTION

Accepted Solutions
Neel
Associate III

Hi All,

Thanks for the quick response. Issue has been resolved. 

I haven't got an interrupt because I have used HAL_GPIO_EXTI_Callback instead of HAL_GPIO_EXTI_Falling_Callback.

 Thanks

View solution in original post

8 REPLIES 8
TDK
Guru

You're likely getting something incorrect in the initialization. HAL_GPIO_EXTI_Callback is called by the EXTIx_IRQHandler routine, but only if it's generated correctly. If the interrupt routine is empty, nothing is going to happen. Are you using CubeMX to generate this code? Show your code.

If you feel a post has answered your question, please click "Accept as Solution".
Neel
Associate III

Hi,

Thanks for quick reply.

Below is ISR details:

uint8_t flag = 0;

void HAL_GPIO_EXTI_Callback(uint16_t GPIO_Pin)

{

flag = 1;

}

Default task:

void StartDefaultTask(void *argument)

{

for(;;)

 {

Printf("%d\n", flag); // Every time i have getting zero value only

//READ GPIO Pin

printf("%d\n",HAL_GPIO_ReadPin(INT_EXTI5_GPIO_Port, INT_EXTI5_Pin)); // I have getting 1 and 0

osDelay(3000);

 }

}

I have used stm32cubeide software for generate and flashing code.

stm32cubeide version: 1.4.0

Attached STM32L5 NVIC configuration:

KnarfB
Principal III

In the generated file stm32l5xx_it.c should be an EXTI interrupt handler generated dispatching control to your callback. You can set a breakpoint there and step through. What pin is your button? The default USER_BUTTON is PC13 not 5.

Neel
Associate III

Hi KnarfB,

Thanks for quick reply.

I have connected I2C slave and PF5 pin is used for getting the interrupt from slave.

So, I have read PF5 gpio pin for checking the MCU getting the interrupt or not.

Below are code line.

printf("%d\n",HAL_GPIO_ReadPin(INT_EXTI5_GPIO_Port, INT_EXTI5_Pin)); // I have getting 1 and 0

So, I have get High(1) and low(0) status on this gpio pin but not getting the interrupt in ISR.

Flag value is always zero.

Thanks

prain
Senior III

show the EXTI register values​ (after initialization).

Neel
Associate III

Hi prain,

Below are the details of EXTI registers.

RTSR1 = 26e

FTSR1 = 220

SWIER1 = 0

RTSR2 = 0

FTSR2 = 0

IMR1 = ff9e026e

EMR1 = 0

SWIER2 = 0

EXTICR = 4002f460

Thanks

Neel
Associate III

Hi All,

Thanks for the quick response. Issue has been resolved. 

I haven't got an interrupt because I have used HAL_GPIO_EXTI_Callback instead of HAL_GPIO_EXTI_Falling_Callback.

 Thanks

Had no idea the L5 broke out routines by falling and rising. Thanks for reporting the solution.

If you feel a post has answered your question, please click "Accept as Solution".