STM32F103C8T6 External Interrupt Problem

Post here first, or if you can't find a relevant section!
Post Reply
hyur
Posts: 36
Joined: Fri May 27, 2022 7:42 am
Answers: 2

STM32F103C8T6 External Interrupt Problem

Post by hyur »

Currently, I am writing a code that operates the interrupt function when a falling edge occurs by connecting 3 buttons to the STM32duino by pull-up.

Interrupt registration looks like this:

Code: Select all

attachInterrupt(digitalPinToInterrupt(PA0), button_ISR1, FALLING);
attachInterrupt(digitalPinToInterrupt(PA1), button_ISR2, FALLING);
attachInterrupt(digitalPinToInterrupt(PA2), button_ISR3, FALLING);

void button_ISR1()
{
  if (prevBTN[0] == HIGH)
  {
    Serial.println("ISR R"); //Just Test Line
    button1_time_check = false;
    button1_Interrupt_flag = true;
  }
}

void button_ISR2()
{
  if (prevBTN[1] == HIGH)
  {
    Serial.println("ISR G"); //Just Test Line
    button2_time_check = false;
    button2_Interrupt_flag = true;
  }
}

void button_ISR3()
{
  if (prevBTN[2] == HIGH)
  {
    Serial.println("ISR B"); //Just Test Line
    button3_time_check = false;
    button3_Interrupt_flag = true;
  }
}
There are 3 buttons, and when the button connected to PA0 is pressed, only the interrupt connected to PA0 should operate. But intermittently, all interrupts registered as PA0, PA1, PA2 are enabled.

I want to know the reason.
by hyur » Mon May 30, 2022 1:19 am
I solved the problem.
The cause was a circuit configuration problem.

Thank you.
Go to full post
Last edited by hyur on Mon May 30, 2022 1:19 am, edited 1 time in total.
User avatar
fpiSTM
Posts: 1738
Joined: Wed Dec 11, 2019 7:11 pm
Answers: 91
Location: Le Mans
Contact:

Re: STM32F103C8T6 External Interrupt Problem

Post by fpiSTM »

Could you tell us which core you used and version?
Also, share your full sketch.
hyur
Posts: 36
Joined: Fri May 27, 2022 7:42 am
Answers: 2

Re: STM32F103C8T6 External Interrupt Problem

Post by hyur »

I solved the problem.
The cause was a circuit configuration problem.

Thank you.
Post Reply

Return to “General discussion”