Ameba-D User Manual
User Manual All information provided in this document is subject to legal disclaimers. © REALTEK 2019. All rights reserved.
62
Fig 8-4 Interrupt RTL block diagram
Two interrupt request connection schemes are supported, and one scheme is chosen during configuration. The simplest connection scheme is
where the combined interrupt gpio_intr_flag is generated by ORing together the bits of the gpio_intr bus. When only the combined interrupt
request is used, then the gpio_status register must be read in the interrupt service routine (ISR) to find the source of the interrupt. When the
individual interrupts lines are connected directly to the interrupt controller, then the gpio_status register does not have to be read by the ISR.
For edge-detected interrupts, the ISR can clear the interrupt by writing a 1 to the gpio_porta_eoi register for the corresponding bit to disable
the interrupt. This write also clears the interrupt status and raw status registers. It is recommended that the interrupt source be cleared prior
to writing to the gpio_porta_eoi register. Writing to the gpio_porta_eoi register has no effect on level-sensitive interrupts.
If level-sensitive interrupts cause the processor to interrupt, then the ISR can poll the gpio_rawint status register until the interrupt source
disappears, or it can write to the gpio_intmask register to mask the interrupt before exiting the ISR. If the ISR exits without masking or disabling
the interrupt prior to exiting, then the level-sensitive interrupt repeatedly requests an interrupt until the interrupt is cleared at the source.
If the gpio_intr_flag connection scheme is used and the interrupt service routine reads the gpio_intr_status register to find multiple pending
interrupt requests, then it is up to the processor to prioritize these pending interrupt requests. There are no restrictions on the number of
edge-detected interrupts that can be cleared simultaneously by writing multiple 1’s to the gpio_porta_eoi register.
8.2.2.1
Debounce Operation
If the user has configured Port A to include the interrupt feature, GPIO can be configured to either include or exclude a debounce capability
using the GPIO_DEBOUNCE parameter.
The external signal can be debounced to remove any spurious glitches that are less than one period of the external debouncing clock.
Fig 8-5 shows an RTL diagram of the debounce circuitry. The timing diagram shows an active-high input signal on gpio_ext_porta
N
. The polarity
of the input signal detection is controlled by the memory-mapped signal, gpio_int_polarity. For a falling-edge or active-low-sensitive input, the
input is then inverted and the same debounce logic is used as for rising-edge or active-high level-sensitive interrupts.
Fig 8-5 Debounce RTL diagram
The document authorized to
SZ99iot
2019-05-15 10:08:03