Not getting interrupt on stm32L5
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2020-08-11 12:14 AM
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.
Solved! Go to Solution.
- Labels:
-
GPIO-EXTI
-
Interrupt
-
STM32L5 Series
Accepted Solutions
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2020-08-14 04:09 AM
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2020-08-11 05:02 AM
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2020-08-11 05:21 AM
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:
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2020-08-11 05:48 AM
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2020-08-11 06:03 AM
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2020-08-11 08:04 PM
show the EXTI register values​ (after initialization).
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2020-08-12 09:49 PM
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2020-08-14 04:09 AM
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2020-08-14 06:35 AM
Had no idea the L5 broke out routines by falling and rising. Thanks for reporting the solution.