45.7.1 Control A

Table 45-1. Register Bit Attribute Legend
SymbolDescriptionSymbolDescriptionSymbolDescription
RReadable bitHCCleared by Hardware(Grey cell)Unimplemented
WWritable bitHSSet by HardwareXBit is unknown at Reset
KWrite to clearSSoftware settable bit
Name: CTRLA
Offset: 0x00
Reset: 0x00000000
Property: PAC Write-Protection, Enable-Protected Bits, Write-Synchronized Bits

Bit 3130292827262524 
 MAXCMP[3:0] ANGULAR[2:0] 
Access RWRWRWRWRWRWRW 
Reset 0000000 
Bit 2322212019181716 
  PINVEN2PINVEN1PINVEN0 PINEN2PINEN1PINEN0 
Access RWRWRWRWRWRW 
Reset 000000 
Bit 15141312111098 
 PERENSWAP  ALOCKCONF[2:0] 
Access RWRWRWRWRWRW 
Reset 000000 
Bit 76543210 
  RUNSTDBY  MODE[1:0]ENABLESWRST 
Access RWRWRWRWW 
Reset 00000 

Bits 31:28 – MAXCMP[3:0] Maximum Consecutive Missing Pulses

These bits define the threshold for the maximum consecutive missing pulses in AUTOC configuration of the QDEC mode.

Outside of AUTOC configuration of QDEC mode, these bits have no effect.

Note: This bit field is enable-protected. This bit field is not synchronized.

Bits 26:24 – ANGULAR[2:0] Angular Counter Length

In QDEC mode, these bits define the size of the Angular counter within COUNT. Angular counter size is equal to CTRLA.ANGULAR+9. The remaining MSB of the COUNTER register are used for counting revolutions.

For example, CTRLA.ANGULAR=0 defines the 9 LSB of COUNT as Angular counter and the residual 7 MSB of COUNT as Revolution counter. CTRLA.ANGULAR=7 will define a 16-bit Angular counter and no Revolution counter.

Outside of QDEC mode, these bits have no effect.
Note: This bit field is enable-protected. This bit field is not synchronized.
Table 45-2. Angular and Revolution Counters in COUNTER Register
ANGULAR[2:0]Angular counterRevolution counter
0x0COUNTER[0:8]COUNTER[9:15]
0x1COUNTER[0:9]COUNTER[10:15]
0x2COUNTER[0:10]COUNTER[11:15]
0x3COUNTER[0:11]COUNTER[12:15]
0x4COUNTER[0:12]COUNTER[13:15]
0x5COUNTER[0:13]COUNTER[14:15]
0x6COUNTER[0:14]COUNTER[15]
0x7COUNTER[0:15]no revolution counter

Bits 20, 21, 22 – PINVENx IO Pin x Invert Enable [x = 2..0]

When this bit is written to '1', the corresponding input pin active level is inverted. This bit has no effect if PINENx bit is zero.

In COUNTER mode only PINVEN[0] is significant.

Note: This bit is enable-protected. This bit is not synchronized.
ValueDescription
0Pin active level is not inverted.
1Pin active level is inverted.

Bits 16, 17, 18 – PINENx PDEC Input From Pin x Enable [x = 2..0]

This bit enables the IO pin x as signal input.

In COUNTER mode, only PINEN[0] is significant.

Note: This bit is enable-protected. This bit is not synchronized.
ValueDescription
0Event line is the signal input.
1I/O pin is the signal input.

Bit 15 – PEREN Period Enable

This bit is used to enable the CC0 register as counter period.

Note: This bit is enable-protected. This bit is not synchronized.
ValueDescription
0Period register function is disabled.
1CC0 is acting as counter period register.

Bit 14 – SWAP PDEC Phase A and B Swap

This bit is used to swap input source of signal 0 and 1.

In COUNTER mode this bit has no effect.

Note: This bit is enable-protected. This bit is not synchronized.
ValueDescription
0The input sources of signal 0 and 1 are not swapped.
1The input sources of signal 0 and 1 are swapped.

Bit 11 – ALOCK Auto Lock

When this bit is set, the Lock Update bit in Control B register (CTRLB.LUPD) is set by hardware when an UPDATE condition is detected.

Note: This bit is enable-protected. This bit is not synchronized.
ValueDescription
0Auto Lock is disabled.
1Auto Lock is enabled.

Bits 10:8 – CONF[2:0] PDEC Configuration

These bits define the PDEC configuration.

Outside of QDEC mode, these bits have no effect.

Note: This bit field is enable-protected. This bit field is not synchronized.
ValueNameDescription
0X4Quadrature decoder direction
1X4SSecure Quadrature decoder direction
2X2Decoder direction
3X2SSecure decoder direction
4AUTOCAuto correction mode

Bit 6 – RUNSTDBY Run in Standby

This bit is used to keep the PDEC running in standby mode.

Note: This bit is enable-protected. This bit is not synchronized.
ValueDescription
0The PDEC is halted in standby.
1The PDEC continues to run in standby.

Bits 3:2 – MODE[1:0] Operation Mode

These bits select one of the QDEC, HALL, COUNTER modes.

Note: This bit field is enable-protected. This bit field is not synchronized.
ValueNameDescription
0x0QDECQDEC operating mode
0x1HALLHALL operating mode
0x2COUNTERCOUNTER operating mode

Bit 1 – ENABLE Enable

Note:
  1. This bit is write-synchronized: SYNCBUSY.ENABLE must be checked to ensure the CTRLA.ENABLE synchronization is complete.
  2. This bit is not enable-protected.
ValueDescription
0The peripheral is disabled.
1The peripheral is enabled.

Bit 0 – SWRST Software Reset

Write a ‘1’ to this bit to reset the SFR registers in PDEC (except DBGCTRL) to their initial state, and PDEC will be disabled. The bit stays high until reset completes. Setting this bit also sets the SYNCBUSY.SWRST to 1. SYNCBUSY.SWRST stays 1 until reset sequence completes.

Note:
  1. When the CTRLA.SWRST is written, the user should poll the SYNCB.SWRST bit to know when the reset operation is complete.
  2. During a SWRST, access to registers/bits without SWRST are disallowed until the SYNCBUSY.SWRST is cleared by the hardware.

ValueDescription
0There is no Reset operation ongoing.
1A Reset operation is ongoing.