Skip to main content
Manoj Hiwarkar
Associate III
February 24, 2022
Question

Two leds based on one interrupt line

  • February 24, 2022
  • 6 replies
  • 1521 views

Dear sir,

I am using STM32F769NI microcontroller. I want to glow to different Leds on one external interrupt line i.e. Led1 on rising edge and Led2 on falling edge. Can you please suggest me the solution.

Regards,

Manoj

This topic has been closed for replies.

6 replies

waclawek.jan
Super User
February 24, 2022

You can set interrupt on both edges in EXTI, and by reading the current state of pin from GPIO_IDR you can determine which was the last edge.

JW

Manoj Hiwarkar
Associate III
February 24, 2022

Ok. But in my case the level 0 appears in two cases first when logic 0 is applied and second when the line is disconnected. So what shall I do in this situation?

waclawek.jan
Super User
February 24, 2022

What is "line disconnected"? Elaborate.

JW

Manoj Hiwarkar
Associate III
February 24, 2022

@Community member​  line disconnected means open.

LCE
Principal II
February 24, 2022

Use a pull-up resistor.

Manoj Hiwarkar
Associate III
February 24, 2022

So the last state will be always '1' if I use the pull up resistor.

waclawek.jan
Super User
February 24, 2022

There is no magic way to distinguish 3 states.

In software, periodically switch between pullup and pulldown, and sample input. If input follows the pullup/pulldown pattern, it's open; otherwise it's connected and you know its polarity.

JW