cancel
Showing results for 
Search instead for 
Did you mean: 

on mapping gpio to EXTI on stm32f479xx

PDatt.1
Associate II

Hello,

I'm maintaining an RTOS application. It apparently has some GPIOs configured as input interrupts and its startup assembler code has some references to EXTI interrupt lines and handlers like this.

...

 .word   EXTI0_IRQHandler         /* EXTI Line0          */             

 .word   EXTI1_IRQHandler         /* EXTI Line1          */              

 .word   EXTI2_IRQHandler         /* EXTI Line2          */  

...

  .weak   EXTI0_IRQHandler     

  .thumb_set EXTI0_IRQHandler,Default_Handler

          

  .weak   EXTI1_IRQHandler     

  .thumb_set EXTI1_IRQHandler,Default_Handler

...

But what I don't understand is that no part of the GPIO/even the whole project code has a mapping from GPIO (bank, port no) to the EXTI line. I'm wondering where this is configured and how it works? The gpio code has some references to configure some parms of these EXTI lines like these, but not the mapping.

GPIO_InitStructure.Mode = GPIO_MODE_IT_FALLING;

GPIO_InitStructure.Pin = SensorDef.pin;

HAL_GPIO_Init(SensorDef.bank, &GPIO_InitStructure);

/* Enable and set EXTI line 0 Interrupt to the lowest priority */

HAL_NVIC_SetPriority(EXTI0_IRQn, 2, 0);

HAL_NVIC_EnableIRQ(EXTI0_IRQn);

Please explain briefly how this mapping works (Can multiple gpios be sent a single EXTI line?) and configured. I searched in the forum and there are references to this API something like this

  1. /* Connect EXTI Line3 to PA3 pin */
  2. SYSCFG_EXTILineConfig(EXTI_PortSourceGPIOA, EXTI_PinSource3);

But my code does not have this API and somehow still works. I'm wondering if this mapping is set in bootloader or somewhere else.

Thx

4 REPLIES 4

 > my code does not have this API

Then read the documentation to the API you are using.

Cube/HAL is open source, so you can instead read the sources of functions you are using, after having read the relevant portions of the RM (GPIO, Interrupts/EXTI, SYSCFG).

JW

There is no API used for this mapping in my application code (i'm using atollic studio), hence I'm wondering, where the mapping is done?

Could swear it is managed in the HAL_GPIO_Init, check the source.

The pin number on the bank associates with the EXTI number, some of the higher ones collect a range of pins which you must later decode/separate in the IRQ Handler.​

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
TDK
Guru

> but not the mapping.

The mapping from an interrupt on PA0 (for example) to EXTI0_IRQHandler is something internal to the hardware. PA0 can never trigger other IRQ handlers, so it's not something that needs configured.

SYSCFG_EXTILineConfig is a function in the old SPL library. Its functionality is replaced within HAL_GPIO_Init. In general, HAL and SPL shouldn't be used together.

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