Module Overview
Peripherals within SAM devices can generate two types of actions in response to given stimulus; set a register flag for later intervention by the CPU (using interrupt or polling methods), or generate event signals, which can be internally routed directly to other peripherals within the device. The use of events allows for direct actions to be performed in one peripheral in response to a stimulus in another without CPU intervention. This can lower the overall power consumption of the system if the CPU is able to remain in sleep modes for longer periods (SleepWalking), and lowers the latency of the system response.
The Event System is comprised of a number of freely configurable event resources, plus a number of fixed event users. Each event resource can be configured to select the input peripheral that will generate the events signal, as well as the synchronization path and edge detection mode. The fixed-function event users, connected to peripherals within the device, can then subscribe to an event resource in a one-to-many relationship in order to receive events as they are generated. An overview of the event system chain is shown in the figure below.
There are many different events that can be routed through the device, which can then trigger many different actions. For example, an Analog Comparator module could be configured to generate an event when the input signal rises above the compare threshold, which then triggers a Timer Counter module to capture the current count value for later use.
Event Channels
The Event module in each device consists of several channels, which can be freely linked to an event generator (i.e., a peripheral within the device that is capable of generating events). Each channel can be individually configured to select the generator peripheral, signal path, and edge detection applied to the input event signal, before being passed to any event user(s).
Event channels can support multiple users within the device in a standardized manner. When an event user is linked to an event channel, the channel automatically handshakes with all attached users to ensure that all modules correctly receive and acknowledge the event.
Edge Detection
For asynchronous events, edge detection on the event input is not possible, and the event signal must be passed directly between the event generator and event user. For synchronous and re-synchronous events, the input signal from the event generator must pass through an edge detection unit so that only the rising, falling, or both edges of the event signal triggers an action in the event user.
Path Selection
The event system in SAM devices supports three signal path types from the event generator to event users: asynchronous, synchronous, and re-synchronous events.
Asynchronous Paths
Asynchronous event paths allow for an asynchronous connection between the event generator and event users when the source and destination peripherals share the same Generic Clock channel. In this mode, the event is propagated between the source and destination directly to reduce the event latency, thus no edge detection is possible. The asynchronous event chain is shown in the figure below.
Identically shaped borders in the diagram indicate a shared Generic Clock channel.
Synchronous Paths
The synchronous event path should be used when edge detection or interrupts from the event channel are required, and the source event generator and the event channel share the same Generic Clock channel. The synchronous event chain is shown in the figure below.
Not all peripherals support synchronous event paths; refer to the device datasheet for more information.
Identically shaped borders in the diagram indicate a shared generic clock channel.
Re-synchronous Paths
Re-synchronous event paths are a special form of synchronous events, where edge detection or interrupts from the event channel are required, but the event generator and the event channel use different generic clock channels. The re-synchronous path allows the Event System to synchronize the incoming event signal from the Event Generator to the clock of the Event System module to avoid missed events at the cost of a higher latency due to the re-synchronization process. The re-synchronous event chain is shown in the figure below.
Not all peripherals support re-synchronous event paths. Refer to the device datasheet for more information.
Identically shaped borders in the diagram indicate a shared generic clock channel.
Physical Connection
The figure below shows how this module is interconnected within the device.