589
SAM4CP [DATASHEET]
43051E–ATPL–08/14
Figure 32-5.
Input Debouncing Filter Timing
32.5.10 Input Edge/Level Interrupt
The PIO Controller can be programmed to generate an interrupt when it detects an edge or a level on an I/O line. The
Input Edge/Level interrupt is controlled by writing the Interrupt Enable register (PIO_IER) and the Interrupt Disable
register (PIO_IDR), which enable and disable the input change interrupt respectively by setting and clearing the
corresponding bit in the Interrupt Mask register (PIO_IMR). As input change detection is possible only by comparing two
successive samplings of the input of the I/O line, the peripheral clock must be enabled. The Input Change interrupt is
available regardless of the configuration of the I/O line, i.e. configured as an input only, controlled by the PIO Controller
or assigned to a peripheral function.
By default, the interrupt can be generated at any time an edge is detected on the input.
Some additional interrupt modes can be enabled/disabled by writing in the Additional Interrupt Modes Enable register
(PIO_AIMER) and Additional Interrupt Modes Disable register (PIO_AIMDR). The current state of this selection can be
read through the Additional Interrupt Modes Mask register (PIO_AIMMR).
These additional modes are:
Rising edge detection.
Falling edge detection.
Low-level detection.
High-level detection.
In order to select an additional interrupt mode:
The type of event detection (edge or level) must be selected by writing in the Edge Select register (PIO_ESR) and
the Level Select Register (PIO_LSR) which select, respectively, the edge and level detection. The current status of
this selection is accessible through the Edge/Level Status register (PIO_ELSR).
The polarity of the event detection (rising/falling edge or high/low-level) must be selected by writing in the Falling
Edge/Low-Level Select register (PIO_FELLSR) and Rising Edge/High Level Select register (PIO_REHLSR) which
allow to select falling or rising edge (if edge is selected in PIO_ELSR) edge or high- or low-level detection (if level
is selected in the PIO_ELSR). The current status of this selection is accessible through the Fall/Rise - Low/High
Status register (PIO_FRLHSR).
When an input edge or level is detected on an I/O line, the corresponding bit in the Interrupt Status register (PIO_ISR) is
set. If the corresponding bit in PIO_IMR is set, the PIO Controller interrupt line is asserted.The interrupt signals of the 32
channels are ORed-wired together to generate a single interrupt signal to the interrupt controller.
When the software reads PIO_ISR, all the interrupts are automatically cleared. This signifies that all the interrupts that
are pending when PIO_ISR is read must be handled. When an Interrupt is enabled on a “l(fā)evel”, the interrupt is generated
as long as the interrupt source is not cleared, even if some read accesses in PIO_ISR are performed.
Divided Slow Clock
(div_slck)
Pin Level
PIO_PDSR
if PIO_IFSR = 0
PIO_PDSR
if PIO_IFSR = 1
1 cycle t
div_slck
up to 1.5 cycles t
div_slck
1 cycle t
div_slck
up to 2 cycles t
peripheral clock
up to 2 cycles t
peripheral clock
up to 2 cycles t
peripheral clock
up to 2 cycles t
peripheral clock
up to 1.5 cycles t
div_slck
PIO_IFCSR = 1