2024-11-12 10:44 PM - last edited on 2024-11-13 05:58 AM by SofLit
Hello, I'm using H723 Nucleo. I set 5 ext interrupt pins: PA0, PA1, PA4, PC2_C, and PC13 as EXTI to 5 switches, enabled NVIC interrupt, GPIO pull-up, interrupt with rising edge triggered, and tied these 5 pins to switches with the other end to ground. The code is working fine, but I observe that only 1 interrupt (either 1 of the 5 switches) can work at any one time, and all 5 interrupts cannot work together at any instance... is this interrupt conflict on H7? Anyone can advise?
if (GPIO_Pin == GPIO_PIN_0)
{
// on LED1
}
Solved! Go to Solution.
2024-11-13 05:56 AM - edited 2024-11-13 06:05 AM
Hello @HMSEdinburge ,
First, I have remarks regarding the info you provided:
@HMSEdinburge wrote:
enabled NVIC interrupt, GPIO pull-up, interrupt with rising edge triggered,
-> You set pull up and you set the EXTI edge to rising which is not correct. You need either to set pull-up resistor and set the edge to falling or set pull-down resistor and set the edge to rising.
@HMSEdinburge wrote:
Hello, I'm using H723 Nucleo. I set 5 ext interrupt pins: PA0, PA1, PA4, PC2_C, and PC13
PA1 is connected to the ETH PHY RMII_REF_CLK pin on the board. need to select another pin. PC13 is used by the user button which has already an external pull-down resistor. So no need to set pull up/down internal resistor.
Now regarding the code, this is how it could be managed:
void HAL_GPIO_EXTI_Callback(uint16_t GPIO_Pin)
{
switch(GPIO_Pin)
{
case GPIO_PIN_0: exti_source = 1; break; // PA0
case GPIO_PIN_3: exti_source = 2; break; // PA3 instead of PA1
case GPIO_PIN_4: exti_source = 3; break; // PA4
case GPIO_PIN_2: exti_source = 4; break; // PC2_C
case GPIO_PIN_13: exti_source = 5; break; // PC13
default: exti_source= 0; break;
}
}
I've attached a project running on NUCLEO-H723 that uses all these EXTIs (just replaced PA1 by PA3) . Put exti_source in live watch and you can see the value that changes according to the EXTI event triggered.
Hope that answers your question.
2024-11-13 01:19 AM
Hello @HMSEdinburge,
Make sure that each EXTI line is configured for the respective GPIO pins, each pin should be assigned to a unique EXTI
Also, could share some code?
To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.
2024-11-13 05:39 AM
Hi i had checked and re-check the Pins assignment as screenshot and code below:
void HAL_GPIO_EXTI_Callback(uint16_t GPIO_Pin)
{
if (GPIO_Pin == Btn1_Pin) // PIN_0
{
// LED1 on
}
else if (GPIO_Pin == GPIO_PIN_1)
{
// LED2 ON
}
else if (GPIO_Pin == Btn2_Pin)
{
// LED 3 ON
}
else if (GPIO_Pin == Btn3_Pin)
{
// LED3 ON;
}
else if (GPIO_Pin == GPIO_PIN_13)
{
// LED 4 ON
}
}
below,
2024-11-13 05:56 AM - edited 2024-11-13 06:05 AM
Hello @HMSEdinburge ,
First, I have remarks regarding the info you provided:
@HMSEdinburge wrote:
enabled NVIC interrupt, GPIO pull-up, interrupt with rising edge triggered,
-> You set pull up and you set the EXTI edge to rising which is not correct. You need either to set pull-up resistor and set the edge to falling or set pull-down resistor and set the edge to rising.
@HMSEdinburge wrote:
Hello, I'm using H723 Nucleo. I set 5 ext interrupt pins: PA0, PA1, PA4, PC2_C, and PC13
PA1 is connected to the ETH PHY RMII_REF_CLK pin on the board. need to select another pin. PC13 is used by the user button which has already an external pull-down resistor. So no need to set pull up/down internal resistor.
Now regarding the code, this is how it could be managed:
void HAL_GPIO_EXTI_Callback(uint16_t GPIO_Pin)
{
switch(GPIO_Pin)
{
case GPIO_PIN_0: exti_source = 1; break; // PA0
case GPIO_PIN_3: exti_source = 2; break; // PA3 instead of PA1
case GPIO_PIN_4: exti_source = 3; break; // PA4
case GPIO_PIN_2: exti_source = 4; break; // PC2_C
case GPIO_PIN_13: exti_source = 5; break; // PC13
default: exti_source= 0; break;
}
}
I've attached a project running on NUCLEO-H723 that uses all these EXTIs (just replaced PA1 by PA3) . Put exti_source in live watch and you can see the value that changes according to the EXTI event triggered.
Hope that answers your question.
2024-11-13 05:05 PM
yes, i m using PC13 on-board switch, I'll try your code and suggestion...