Implementation
Configuring the CCU6 Input Capture Unit
For the configuration of the channel, an instance of the structure
IfxCcu6_Icu_ChannelConfig
is created and default values are assigned to the configuration with the function
IfxCcu6_Icu_initChannelConfig()
. Then, the following changes to the default configuration are
required:
›
channelld
– Select the channel of timer T12. In this example, channel 0 is selected
›
channelMode
– Select the operating mode for the channel. In this example, the rising and
falling edges of an external signal are captured using the double register capture mode
›
Interrupt1
structure
– Configure an interrupt by selecting the source, the service request
output, its priority and the service provider. In this example, the CCU6 service request 0 is
configured to trigger an interrupt on every rising edge at the input pin of capture/compare
channel 0 (CC60). To calculate the duty cycle, a shadow register filled when a falling edge
occurs, is used. Therefore, no interrupt is required for the falling edge.
›
Interrupt2
structure
– Configure another interrupt similar with the previous, where the CCU6
service request 1 is configured to trigger an interrupt on every period match (match of the
timer T12 counter value with the period value)
Note:
An interrupt is needed to capture the PWM frequency, while the other counts the number
of timer overflows (for more details, see
6
2020-01-17
Copyright © Infineon Technologies AG 2020. All rights reserved.