149/313
EXTENDED FUNCTION TIMER (EFT)
EXTENDED FUNCTION TIMER (Cont’d)
10.3.4 Interrupt Management
The interrupts of the Extended Function Timer are
mapped on the eight external interrupt channels of
the microcontroller (refer to the “Interrupts” chap-
ter).
Depending on device specification, one of the fol-
lowing configurations can occur:
– The three interrupt sources are mapped on three
different interrupt channels (to use this feature,
the EFTIS bit must be reset)
– The three interrupt sources are mapped on the
same interrupt channel (to use this feature, the
EFTIS bit must be set)
Each External Interrupt Channel has:
– A trigger control bit in the EITR register (R242 -
Page 0)
– A pending bit in the EIPR register (R243 -
Page 0)
– A mask bit in the EIMR register (R244 - Page 0)
Program the interrupt priority level using the
EIPLR register (R245 - Page 0). For a description
of these registers refer to the “Interrupts” and
“DMA” chapters.
Use of three interrupt channels
To use the interrupt features, for each interrupt
channel used, perform the following sequence:
– Set the priority level of the interrupt channel(s)
used for the Extended Function Timer (EIPRL
register)
– Select the interrupt trigger edge(s) as rising edge
(set the corresponding bit(s) in the EITR register)
– Set the OCIS and/or ICIS and/or TOIS bit(s) of
the CR3 register to select the peripheral interrupt
source(s)
– Set the OCIE and/or ICIE and/or TOIE bit(s) of
the CR1 register to enable the peripheral to per-
form interrupt requests on the desiderate events
– In the EIPR register, reset the pending bit(s) of
the interrupt channels used by the peripheral in-
terrupts to avoid any spurious interrupt requests
being performed when the mask bit(s) is/are set
– Set the mask bit(s) of the interrupt channel(s)
used to enable the MCU to acknowledge the in-
terrupt requests of the peripheral.
Use of one external interrupt channel for all the
interrupts
To use the interrupt features, perform the following
sequence:
– Set the priority level of the interrupt channel used
(EIPRL register)
– Select the interrupt trigger edge as rising edge
(set the corresponding bit in the EITR register)
– Set the EFTIS bit of the CR3 register to select
the peripheral interrupt sources
– Set the OCIE and/or ICIE and/or TOIE bit(s) of
the CR1 register to enable the peripheral to per-
form interrupt requests on the wanted events
– In the EIPR register, reset the pending bit of the
interrupt channel used by the peripheral inter-
rupts to avoid any spurious interrupt requests be-
ing performed when the mask bits is set
– Set the mask bits of the interrupt channels used
to enable the MCU to acknowledge the interrupt
requests of the peripheral.
Note: In the interrupt routine, reset the related
pending bits to avoid the interrupt request that was
just acknowledged being proposed again.
Then, at the end of the interrupt routine, after re-
setting the pending bit and before the IRET in-
struction, check if the interrupt flags in the SR reg-
ister are reset; otherwise jump to the beginning of
the related interrupt routine.
If, on return from an interrupt routine, the related
pending bit is reset while one of the related inter-
rupt flags is set, no interrupt can be performed on
that channel.
This note is valid for both configurations.
WARNING: Care should be taken when using only
one of the input capture pins, as both capture in-
terrupts are enabled by the ICIE bit in the CR1 reg-
ister. If only ICAP1 is used (for example), an inter-
rupt can still be generated by the ICAP2 pin when
this pin toggles, even if it is configured as a stand-
ard output. If this case, the interrupt capture status
bits in the SR register should handled in polling
mode.
9