background image

Implementation

Configuring the TOM

After configuration, the function 

IfxGtm_Tom_Pwm_init()

initializes and activates the TOM with the 

user configuration.
Start the PWM with the function 

IfxGtm_Tom_Pwm_start()

.

Setting the duty cycle

The setting of the duty cycle is done by calling the function 

setDutyCycle()

, which contains the 

following steps:

Set the 

dutyCycle

parameters of the configuration structure to set the duty cycle of the PWM 

signal to the desired value

Call the function 

IfxGtm_Tom_Pwm_init()

to reconfigure the TOM with the new value of the duty 

cycle

All the functions used for the configuration of the TOM are provided by the iLLD header 

IfxGtm_Tom_Pwm.h

.

Fading the LED

The fading of the LED is done in the function 

fadeLED() 

by repeatedly adding or removing a step 

value to the duty cycle of the PWM.

6

2020-02-11

Copyright © Infineon Technologies AG 2020. All rights reserved.

Summary of Contents for GTM ATOM PWM 1

Page 1: ...AURIX TC2xx Microcontroller Training V1 0 0 GTM_TOM_PWM_1 for KIT_AURIX_TC297_TFT GTM TOM PWM generation Please read the Important Notice and Warnings at the end of this document...

Page 2: ...ignal which is driving the intensity of an LED The LED is driven by pin 0 of the port 13 The state of the pin is controlled by the PWM signal generated by the TOM timer of GTM 2 2020 02 11 Copyright I...

Page 3: ...can offer up to 16 independent channels to generate output signals The Clock Management Unit CMU is responsible for clock generation of the GTM The Fixed Clock Generation FXU is one of its subunits a...

Page 4: ...rdware setup This code example has been developed for the board KIT_AURIX_TC297_TFT_BC Step LED D107 1 is used for this example 1 4 2020 02 11 Copyright Infineon Technologies AG 2020 All rights reserv...

Page 5: ...Gtm_Tom_Pwm_Config with its default values The IfxGtm_Tom_Pwm_Config structure can be modified to set the following parameters to initialize the module tom Selection of the TOM which is counting TOM 2...

Page 6: ...t the dutyCycle parameters of the configuration structure to set the duty cycle of the PWM signal to the desired value Call the function IfxGtm_Tom_Pwm_init to reconfigure the TOM with the new value o...

Page 7: ...period value to have the desired PWM frequency fPWM is calculated with the following formula 0 In this example 100 2 50000 t t PWM signal Period of PWM CMU clock 0 Frequency of the clock Duty cycle o...

Page 8: ...Run and Test After code compilation and flashing the device observe the LED D107 1 which should be fading 1 8 2020 02 11 Copyright Infineon Technologies AG 2020 All rights reserved...

Page 9: ...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 questi...

Page 10: ...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...

Reviews: