background image

AURIX™ TC2xx Microcontroller Training
V1.0.0

GTM_TIM_Capture_1

PWM input capturing via TIM

Please read the Important Notice and Warnings at the end of this document

Summary of Contents for GTM TIM Capture 1

Page 1: ...AURIX TC2xx Microcontroller Training V1 0 0 GTM_TIM_Capture_1 PWM input capturing via TIM Please read the Important Notice and Warnings at the end of this document ...

Page 2: ...PWM signal frequency and duty cycle The TIM is used in capture mode The data from the captured PWM signal is used to calculate the PWM signal frequency and duty cycle in software The frequency and the duty cycle are then stored in variables 2 2020 01 17 Copyright Infineon Technologies AG 2020 All rights reserved ...

Page 3: ...sponsible for filtering and capturing input signals of the GTM The Clock Management Unit CMU is responsible for clock generation of the GTM The Configurable Clock Generation Subunit CFGU provides eight clock sources for the GTM submodules TIM TBU MON and ATOM GTM TIM GTM TOM 3 2020 01 17 Copyright Infineon Technologies AG 2020 All rights reserved ...

Page 4: ...t signals The Clock Management Unit CMU is responsible for clock generation of the GTM The Fixed Clock Generation FXU is one of its subunits and it provides five predefined non configurable clocks for GTM modules including the TOM GTM TOM GTM TIM 4 2020 01 17 Copyright Infineon Technologies AG 2020 All rights reserved ...

Page 5: ...s code example has been developed for the board KIT_AURIX_TC297_TFT_BC Step Connect the TIM input port pin P02 0 with the TOM output port pin P02 3 5 2020 01 17 Copyright Infineon Technologies AG 2020 All rights reserved ...

Page 6: ..._Tim_In_Config structure allows the setting of multiple parameters in order to initialize the module including the following filter inputPin Selection of the input port pin of the TIM port pin P02 0 in this example filter inputPinMode Selection of the input mode for the input port pin of the TIM IfxPort_InputMode_pulldown in this example After setting the configuration parameters the function IfxG...

Page 7: ...ure allows to set the following parameters to initialize the module tom Selection of the TOM which is counting tomChannel Selection of the channel which is driving the output port pin period Setting of the period for the PWM signal to the desired value dutyCycle Setting of the duty cycle of the PWM signal to the desired value pin outputPin Selection of the output port pin synchronousUpdateEnable E...

Page 8: ...fxGtm_Tom_Pwm_init applies the user configuration to the module Start the PWM with the function IfxGtm_Tom_Pwm_start All the functions used for the configuration of the TOM are provided by the iLLD header IfxGtm_Tom_Pwm h 8 2020 01 17 Copyright Infineon Technologies AG 2020 All rights reserved ...

Page 9: ...e to have the desired PWM frequency fPWM is calculated with the following formula 𝑃𝑒𝑟𝑖𝑜𝑑 𝑓𝑓𝑥𝑐𝑙𝑘1 𝑓𝑃𝑊𝑀 In this example 𝑃𝑒𝑟𝑖𝑜𝑑 6 250 𝑀𝐻𝑧 125 𝐻𝑧 50000 𝑡𝑖𝑐𝑘𝑠 8 𝑚𝑠 t t PWM signal Period of PWM FXU clock 1 Frequency of the clock Duty cycle of the PWM 9 2020 01 17 Copyright Infineon Technologies AG 2020 All rights reserved ...

Page 10: ...the iLLD function IfxGtm_Tim_In_update Get the PWM period in seconds with the iLLD function IfxGtm_Tim_In_getPeriodSecond Calculate the PWM frequency with the formula frequency Hz 1 period s Get the PWM duty cycle by calling the iLLD function IfxGtm_Tim_In_getDutyPercent All the iLLD functions above are provided by the iLLD header IfxGtm_Tim_In h 10 2020 01 17 Copyright Infineon Technologies AG 20...

Page 11: ... perform the following steps Add the variables g_measuredPwmFreqHz and g_measuredDutyCycle to the Watch Expressions on the debugger Suspend the program to check the value of the variables 11 2020 01 17 Copyright Infineon Technologies AG 2020 All rights reserved ...

Page 12: ... www infineon com aurix expert training AURIX Development Studio is available online https www infineon com aurixdevelopmentstudio Use the Import function to get access to more code examples For questions and support use the AURIX Forum https www infineonforums com forums 13 Aurix Forum 12 2020 01 17 Copyright Infineon Technologies AG 2020 All rights reserved ...

Page 13: ...of the product for the intended application and the completeness of the product information given in this document with respect to such application For further information on the product technology delivery terms and conditions and prices please contact your nearest Infineon Technologies office www infineon com WARNINGS Due to technical requirements products may contain dangerous substances For in...

Reviews: