Atmel Xplained Pro Evaluation Kit for the ATSAMD21J18A Microcontroller ATSAMD21-XPRO ATSAMD21-XPRO Data Sheet

Product codes
ATSAMD21-XPRO
Page of 1018
399
Atmel | SMART SAM D21 [DATASHEET]
Atmel-42181C–SAM-D21_Datasheet–07/2014
To configure a channel, the Channel register must be written in a single 32-bit write.
It is possible to read out the configuration of a channel by first selecting the channel by writing to CHANNEL.CHANNEL 
using a, 8-bit write, and then performing a read of the CHANNEL register.
Event Generators
The event generator is selected by writing to the Event Generator bit group in the Channel register (CHANNEL.EVGEN).
A full list of selectable generators can be found in the CHANNEL register description. Refer to 
The channels are not connected to any of the event generators (CHANNEL.EVGEN = 0x00) by default.
23.6.2.6  Edge Detection
When synchronous or resynchronized paths are used, edge detection must be used. The event system can perform 
edge detection in three different ways:
z
Generate an event only on the rising edge
z
Generate an event only on the falling edge
z
Generate an event on rising and falling edges.
Edge detection is selected by writing to the Edge Selection bit group in the Channel register (CHANNEL.EDGSEL).
If the generator event is a pulse, both edges cannot be selected. Use the rising edge or falling edge detection methods, 
depending on the generator event default level.
23.6.2.7  Channel Status
path is in use. There are two different status bits in CHSTATUS for each of the available channels: The Channel x Busy 
bit in the Channel Status register (CHSTATUS.CHBUSYx) is set to one if an event on the corresponding channel x has 
not been handled by all event users connected to that channel.
The CHSTATUS.USRRDYx bit is set to one if all event users connected to the corresponding channel x are ready to 
handle incoming events on that channel.
23.6.2.8  Software Event
A software event can be initiated on a channel by writing a one to the Software Event bit in the Channel register 
(CHANNEL.SWEVT) at the same time as writing the Channel bits (CHANNEL.CHANNEL). This will generate a software 
event on the selected channel.
The software event can be used for application debugging, and functions like any event generator. To use the software 
event, the event path must be configured to either a synchronous path or resynchronized path (CHANNEL.PATH = 0x0 
or 0x1), edge detection must be configured to rising-edge detection (CHANNEL.EDGSEL= 0x1) and the Generic Clock 
Request bit must be set to one (CTRL.GCLKREQ=0x1).
23.6.3 Interrupts
The EVSYS has the following interrupt sources:
z
Overrun Channel x (OVRx): this is an asynchronous interrupt and can be used to wake-up the device from any 
sleep mode.
z
Event Detected Channel x (EVDx): this is an asynchronous interrupt and can be used to wake-up the device from 
any sleep mode.
Each interrupt source has an interrupt flag associated with it. The interrupt flag in the Interrupt Flag Status and Clear 
register (INTFLAG) is set when the interrupt condition occurs. Each interrupt can be individually enabled by writing a one 
to the corresponding bit in the Interrupt Enable Set register (
), and disabled by writing a one to the 
corresponding bit in the Interrupt Enable Clear register (
). An interrupt request is generated when the interrupt 
flag is set and the corresponding interrupt is enabled. The interrupt request remains active until the interrupt flag is 
cleared, the interrupt is disabled or the EVSYS is reset.