AURIX™ MCU: Hardware Peripherals used to capture the PWM period and duty cycle - KBA235237
Timer Input Module (TIM) in General Timer Module (GTM):
Few capture modes can be configured in TIM. One of the modes is TIM PWM Measurement Mode (TPWM), commonly used for measuring the period and duty cycle with 24-bit resolutions. GPR0 register contains the duty cycle count and the GPR1 register contains the period count.
Compare Capture Unit 6 (CCU6x):
Select Capture Mode 1 in CCU6x. At the falling edge of input, 16-bits T12 value will be captured into Shadow registers CC6xSR. At the rising edge, the T12 value will be captured into CC6xR registers.
The period is calculated as the difference between the current and previous CC6xSR (or CC6xR) value. The duty cycle value is calculated as the difference between CC6xSR and CC6xR registers.
Note: Additional software overhead is needed if using CCU6x.
For details, see the “Generic Timer Module (GTM)” and “Capture/Compare Unit 6 (CCU6)” sections of the User’s manual.
Note: This KBA applies to the following series of AURIX™ MCUs:
- AURIX™ TC2xx series
- AURIX™ TC3xx series