49.6.16.1 Description
The Quadrature decoder has four QDEC modules. Each QDEC involves three timer channels to perform the speed and rotation measurements. The timer combinations for each QDEC are:
QDEC : 0 ≥ TC0_channel0, TC0_channel1, TC0_channel2
QDEC : 1 ≥ TC1_channel0, TC1_channel1, TC1_channel2
QDEC : 2 ≥ TC2_channel0, TC2_channel1, TC2_channel2
QDEC : 3 ≥ TC3_channel0, TC3_channel1, TC3_channel2
The corresponding pin combination for each QDEC is:
QDEC : 0 ≥ TIOA0, TIOB0, TIOB1
QDEC : 1 ≥ TIOA3, TIOB3, TIOB4
QDEC : 2 ≥ TIOA6, TIOB6, TIOB7
QDEC : 3 ≥ TIOA9, TIOB9, TIOB10
Channel 2 can be used as a time base in case of speed measurement requirements (refer to Predefined Connection of the Quadrature Decoder with Timer Counters).
When writing a ‘0’ to TC_BMR.QDEN, the QDEC is bypassed and the IO pins are directly routed to the timer counter function.
TIOA0 and TIOB0 are to be driven by the two dedicated quadrature signals from a rotary sensor mounted on the shaft of the off-chip motor.
A third signal from the rotary sensor can be processed through pin TIOB1 and is typically dedicated to be driven by an index signal if it is provided by the sensor. This signal is not required to decode the quadrature signals PHA, PHB.
TC_CMRx.TCCLKS must be configured to select XC0 input (i.e., 0x101). Field TC0XC0S has no effect as soon as the QDEC is enabled.
Either speed or position/revolution can be measured. Position channel 0 accumulates the edges of PHA, PHB input signals giving a high accuracy on motor position whereas channel 1 accumulates the index pulses of the sensor, therefore the number of rotations. Concatenation of both values provides a high level of precision on motion system position.
In Speed mode, position cannot be measured but revolution can be measured.
Inputs from the rotary sensor can be filtered prior to downstream processing. Accommodation of input polarity, phase definition and other factors are configurable.
Interruptions can be generated on different events.
A compare function (using TC_RC) is available on channel 0 (speed/position) or channel 1 (rotation) and can generate an interrupt by means of TC_SRx.CPCS.
