Skip to main content
adithya2
Associate II
April 18, 2013
Question

Detecting Rising and Falling edges

  • April 18, 2013
  • 2 replies
  • 2087 views
Posted on April 18, 2013 at 09:21

Hi, I am using an STM32L151VB part in a custom board. Is there any way to detect if an interrupt has been caused by a rising or a falling edge. I looked around in the reference manual and didnt find anything. I need to know which edge has caused an interrupt on my GPIO pin.

    This topic has been closed for replies.

    2 replies

    j-fischer-gundlach
    Associate III
    April 18, 2013
    Posted on April 18, 2013 at 09:50

    Hey,

    i´m sure it is possible. I tried to help, but i have problems to find the reference maual.

    I >>could<< imagine, since it is a low power µC, that is not able to detect falling or rising edges, rather than edges in general because the ciruit for that is more simple and consumes thereby less power. In that case, u would have to do ''old state'' - ''new state'' compares to find rising or falling edges.

    But without RM i can´t be sure...
    John F.
    Associate III
    April 18, 2013
    Posted on April 18, 2013 at 10:11

    You could use two pins connected to your source. Program one for rising edges and one for falling edges.

    RM0038 Reference manual STM32L151xx, STM32L152xx and STM32L162xx advanced ARM-based 32-bit MCUs (ST website) says ...

    6.3.8 External interrupt/wakeup lines

    All ports have external interrupt capability. To use external interrupt lines, the port must be

    configured in input mode, refer to Section 9.2: External interrupt/event controller (EXTI) and

    Section 9.2.3: Wakeup event management.

    9.2 External interrupt/event controller (EXTI)

    The external interrupt/event controller consists of up to 23 edge detectors for generating

    event/interrupt requests. Each input line can be independently configured to select the type

    (event or interrupt) and the corresponding trigger event (rising edge, falling edge or both).

    Each line can also be masked independently. A pending register maintains the status line of

    the interrupt requests.