Skip to content

The STM32F4 Discovery port

Jean-Luc Béchennec edited this page Dec 17, 2015 · 1 revision

Interrupts

Interrupts sources on the STM32F407VGT6 are listed below.

SysTick

The SysTick used for the SystemCounter. The SystemCounter is a default counter on which alarms are connected. The SysTick is programmed within the StartOS service so that an interrupt is triggered every millisecond. Currently it is not possible to change the period but it is considered in the future.

External interrupts

The STM32F407VGT6 has 23 external interrupt line but only lines 0 et 15 correspond to a pin of the micro-controller. Lines 16 to 23 are used for peripherals interrupts.

7 sources are provided : EXTI0_IRQ, EXTI1_IRQ, EXTI2_IRQ, EXTI3_IRQ, EXTI4_IRQ, EXTI9_5_IRQ and EXTI15_10_IRQ. So the last 2 are shared by lines 5 to 9 and 10 to 15 respectively.

Each line corresponds to a bit in one of the GPIO port. Line 0 corresponds to bit 0, line 1 to bit one and so on. So only bits 0 to 15 of the GPIO ports may be used as an external interrupt trigger. GPIO ports are ports A, B, C, D, E, F, G, H and I. In ports A to H, bits 0 to 15 may be used but in ports I, only bit 0 to 11 may be used.

An ISR or a COUNTER may be connected to a external interrupt by any of the 7 sources. In which case the pin used has to be specified with subattributes, TRIGGER and PULL giving the behavior.

ISR quad_encoder {
  PRIORITY = 1;
  CATEGORY = 1;
  SOURCE = EXTI0_IRQ {
    PIN = PB0 {
      TRIGGER = RISING;
      PULL = NONE;
    };
  };
};

Available PIN depend on the source.

  • EXTI0_IRQ: Px0 with x being in the range A-I
  • EXTI1_IRQ: Px1 with x being in the range A-I
  • EXTI2_IRQ: Px2 with x being in the range A-I
  • EXTI3_IRQ: Px3 with x being in the range A-I
  • EXTI4_IRQ: Px4 with x being in the range A-I

For the EXTI9_5_IRQ, there are 5 pins available: PINON5, PINON6, PINON7, PINON8 and PINON9:

  • PINON5: Px5 with x being in range A-I
  • PINON6: Px6 with x being in range A-I
  • PINON7: Px7 with x being in range A-I
  • PINON8: Px8 with x being in range A-I
  • PINON9: Px9 with x being in range A-I

For the EXTI15_10_IRQ: there are 6 pins available: PINON10, PINON11, PINON12, PINON13, PINON14 and PINON15:

  • PINON10: Px10 with x being in range A-I
  • PINON11: Px11 with x being in range A-I
  • PINON12: Px12 with x being in range A-H
  • PINON13: Px13 with x being in range A-H
  • PINON14: Px14 with x being in range A-H
  • PINON15: Px15 with x being in range A-H

TRIGGER may be:

  • RISING: the interrupt is triggered on rising edges of the signal;
  • FALLING: the interrupt is triggered on falling edges of the signal;
  • BOTH: the interrupt is triggered on rising and falling edges of the signal.

PULLmay be:

  • UP: the pull-up resistor is activated on this pin;
  • DOWN: the pull-down resistor is activated on this pin;
  • NONE: the pin is floating.