Infineon GTM ATOM PWM 1 User manual

Type
User manual
AURIX™ TC2xx Microcontroller Training
V1.0.0
GTM_ATOM_PWM_1
GTM ATOM PWM generation
Please read the Important Notice and Warnings at the end of this document
Scope of work
GTM ATOM is used to generate a PWM signal, 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 ATOM timer of GTM.
2
2019-10-17 Copyright © Infineon Technologies AG 2019. All rights reserved.
Introduction
The Generic Timer Module (GTM) is a modular timer unit designed to
accommodate many timer applications.
It has an in-built Advanced Router Unit (ARU) that can be used to
exchange specific data between sub-modules without CPU interaction.
The ARU-connected Timer Output Module (ATOM), which is part of the
GTM, is able to generate complex output signals.
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.
3
2019-10-17 Copyright © Infineon Technologies AG 2019. All rights reserved.
Hardware 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
2019-10-17 Copyright © Infineon Technologies AG 2019. All rights reserved.
Implementation
Configuring the ATOM
The configuration of the ATOM is done once in the setup phase by calling the initialization
function initGtmAtomPwm() containing the following steps:
Enable the GTM by calling the function IfxGtm_enable().
Set the CMU clock 0 frequency to 1 MHz with the function
IfxGtm_Cmu_SetClkFrequency().
Enable the CMU clock 0 by calling the function IfxGtm_Cmu_enableClocks().
The function IfxGtm_Atom_Pwm_initConfig() initializes an instance of the structure
IfxGtm_Atom_Pwm_Config with its default values.
5
2019-10-17 Copyright © Infineon Technologies AG 2019. All rights reserved.
Implementation
Configuring the ATOM
The IfxGtm_Atom_Pwm_Config structure allows to set the following parameters to initialize
the module:
atom Selection of the ATOM which is counting (ATOM 2 in this example)
atomChannel Selection of the channel which is driving the LED (Channel 5 in this
example)
period Setting of the period for the PWM signal to the desired value
pin.outputPin Selection the LED as output pin
synchronousUpdateEnable Enabling of Synchronous Update of the timer
After configuration, the function IfxGtm_Atom_Pwm_init() initializes and activates the
ATOM with the user configuration.
Start the PWM with the function IfxGtm_Atom_Pwm_start().
All the functions used for the configuration of the ATOM are provided by the iLLD header
IfxGtm_Atom_Pwm.h.
6
2019-10-17 Copyright © Infineon Technologies AG 2019. All rights reserved.
Implementation
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 instance of the configuration structure to set theduty
cycle for the PWM signal to the desired value
Call the function IfxGtm_Atom_Pwm_init() to re-initialize and re-activates the ATOM with
the new configuration.
The functions IfxGtm_Atom_Pwm_init() is provided by the iLLD header
IfxGtm_Atom_Pwm.h.
Fading the LED
The fading of the LED is done in the function fadeLED() by repetitively adding or removing a
step value to the duty cycle of the PWM.
7
2019-10-17 Copyright © Infineon Technologies AG 2019. All rights reserved.
Implementation
Calculation example
The CMU clock 0 frequency (f
clk0
) is set to 1 MHz in this example. The period value to have the
desired PWM frequency (f
PWM
) is calculated with the following formula:



In this example: 

 

t
t
PWM signal
Period of PWM
CMU clock 0
Frequency of the
clock
Duty cycle of the PWM
8
2019-10-17 Copyright © Infineon Technologies AG 2019. All rights reserved.
Run and Test
After code compilation and flashing the device, observe the LED D107 (1),
which should be fading.
1
9
2019-10-17 Copyright © Infineon Technologies AG 2019. All rights reserved.
References
More code examples can be found on the GIT repository:
https://github.com/Infineon/AURIX_code_examples
For additional trainings, visit our webpage:
https://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
10
2019-10-17 Copyright © Infineon Technologies AG 2019. All rights reserved.
IMPORTANT NOTICE
The information given in this document shall in no
event be regarded as a guarantee of conditions or
characteristics (“Beschaffenheitsgarantie”) .
With respect to any examples, hints or any typical
values stated herein and/or any information
regarding the application of the product, Infineon
Technologies hereby disclaims any and all
warranties and liabilities of any kind, including
without limitation warranties of non-infringement
of intellectual property rights of any third party.
In addition, any information given in this
document is subject to customer’s compliance
with its obligations stated in this document and
any applicable legal requirements, norms and
standards concerning customer’s products and
any use of the product of Infineon Technologies in
customer’s applications.
The data contained in this document is exclusively
intended for technically trained staff. It is the
responsibility of customer’s technical
departments to evaluate the suitability 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 information
on the types in question please contact your
nearest Infineon Technologies office.
Except as otherwise explicitly approved by
Infineon Technologies in a written document
signed by authorized representatives of Infineon
Technologies, Infineon Technologies’ products
may not be used in any applications where a
failure of the product or any consequences of the
use thereof can reasonably be expected to result
in personal injury.
Edition 2019-10
Published by
Infineon Technologies AG
81726 Munich, Germany
© 2019 Infineon Technologies AG.
All Rights Reserved.
Do you have a question about this
document?
Email: erratum@infineon.com
Document reference
GTM_ATOM_PWM_1
Trademarks
All referenced product or service names and trademarks are the property of their respective owners.
  • Page 1 1
  • Page 2 2
  • Page 3 3
  • Page 4 4
  • Page 5 5
  • Page 6 6
  • Page 7 7
  • Page 8 8
  • Page 9 9
  • Page 10 10
  • Page 11 11

Infineon GTM ATOM PWM 1 User manual

Type
User manual

Ask a question and I''ll find the answer in the document

Finding information in a document is now easier with AI