Datasheet

Table Of Contents
Related Links
27. PAC - Peripheral Access Controller
53.5.9 Analog Connections
Not applicable.
53.6 Functional Description
53.6.1 Principle of Operation
The PDEC control logic can be driven by a set of three inputs signal coming from Event System channels
or I/O input pins. These three inputs can be filtered prior to down-stream processing. The input polarity,
phase definition and other factors are configurable. QDEC, HALL or COUNTER mode of operation are
supported.
Depending of the mode configuration, specific input sequences can generate:
State change
Counter increment or decrement
Interrupts
Output events
53.6.2 Basic Operation
53.6.2.1 Initialization
The following PDEC registers are enable-protected, meaning they can only be written when the PDEC is
disabled (CTRLA.ENABLE is zero):
Event Control register (EVCTRL)
Enable-protected bits in the CTRLA register can be written at the same time as CTRLA.ENABLE is
written to '1', but not at the same time as CTRLA.ENABLE is written to '0'.
Enable-protection is denoted by the 'Enable-Protected' property in the register description.
53.6.2.2 Enabling, Disabling, and Resetting
The PDEC must be configured before it is enabled by the following steps:
1. Enable the PDEC bus clock (CLK_PDEC_APB)
2. Select the mode of operation by writing the Mode bits in the Control A register (CTRLA.MODE)
3. Select the PDEC mode configuration by writing the Configuration bits in the Control A register
(CTRLA.CONF)
4. Select the PDEC event or pin input signal source by writing the Event Enable Input bit in the Event
Control register (EVCTRL.EVEI) or by the Pin Enable bit in Control A register (CTRLA.PINEN)
5. Select the angular counter length value by writing the Angular bits in the Control A register
(CTRLA.ANGULAR)
Optionally, the following configurations can be set before enabling PDEC:
The GCLK_PDEC clock can be prescaled by writing to the Prescaler register (PRESC)
A filter can be applied to the input signal by writing a corresponding value to the Filter register
(FILTER)
If the resolution of the rotary sensor is not a power of 2, an Angular period can be set
(CTRLA.PEREN and CC0 register)
SAM D5x/E5x Family Data Sheet
PDEC – Position Decoder
© 2019 Microchip Technology Inc.
Datasheet
DS60001507E-page 1949