Event System Configurator

The event system enables direct peripheral-to-peripheral communication and signaling. The event system consists of generators, channels, and users. A change in the peripheral’s state is referred to as an event.

An event that takes place in one peripheral (say source) can be used to trigger another event in a different peripheral (destination). The term generator refers to the event of the source peripheral and the term user refers to the event of the destination peripheral. The generator and the source are connected via an event channel. The channel section lets you configure available channels for a particular event generator source. There are two types of event channels; Synchronous and Asynchronous. Asynchronous event control enables the event input to qualify the output directly. For more details on event channels, refer the hardware manual. This document explains the event system with an example of a timer event (event generator) triggering the ADC conversion (event user) through a synchronous channel.

How to use the Event System Configurator

A typical example is to have a timer (overflow or compare match) event to start an ADC conversion. In this example, the timer (TCA) is the source, and ADC is the action. Both will be connected via an event channel.
  1. 1.Create a new project using the ATtiny817.
  2. 2. Click on Add software component to add the event system driver.
    A tab named EVENTS appears on the left side of the screen.
  3. 3. Click on the EVENTS tab.
    The GENERATORS and the USERS from the system drivers will appear by default, such as Port and PORTMUX.

Overflow Timer Event Starts an ADC Conversion

In this example, we have assumed that only the event system driver was selected earlier.
  1. 1. Click on Add software component to add the Timer driver.
    The TCA0 is added as a generator and a user. The overflow event is listed as a generator.
  2. 2. Click on Add software component to add the ADC driver.
    The ADC is added as a user.
  3. 3. Start by dragging the TCA event generator (overflow) onto an Asynchronous Event Channel 0, then try dragging this event channel onto the ADC. This does not work because we have not yet enabled STARTEI (START Event Input Enable) for the ADC. Click on the ADC0 configuration wheel, then check "STARTEI" and close. You will now see that “Trigger Conversion on Event” is present in the ADC0 as a specific event user. Now you can drag the event channel onto this event (note: ADC0 should be grayed out when no specific event users have been enabled).
  4. 4. Next, connect the TCA event with the ADC: Click and drag the Timer/Counter A0 overflow to the Synchronous Event Channel 0 channel.
    During drag and drop, only supported channels are highlighted.
    A connection is made between TCA and the event channel.
  5. 5. Click and drag the Synchronous Event Channel 0 to the ADC0.
    A connection is made between the event channel and the Trigger Conversion On Event.

This will result in the following code:

EVSYS.ASYNCUSER1 = EVSYS_ASYNCUSER1_SYNCCH0_gc /* Synchronous Event Channel 0 */ ;
EVSYS.SYNCCH0 = EVSYS_SYNCCH0_TCA0_OVF_LUNF_gc /* Timer/Counter A0 overflow */;

The event input is enabled in adc.c.

ADC0.EVCTRL = 1 << ADC_STARTEI_bp /* Start Event Input Enable: enabled */;