Download Print this page
Infineon GPT12 Training

Infineon GPT12 Training

Pwm generation 1 for kit_aurix_tc297_tft
Hide thumbs Also See for GPT12:

Advertisement

Quick Links

GPT12_PWM_Generation_1
for KIT_AURIX_TC297_TFT
Generation of PWM via GPT12
AURIX™ TC2xx Microcontroller Training
V1.0.0
Please read the Important Notice and Warnings at the end of this document

Advertisement

loading

Summary of Contents for Infineon GPT12

  • Page 1 GPT12_PWM_Generation_1 for KIT_AURIX_TC297_TFT Generation of PWM via GPT12 AURIX™ TC2xx Microcontroller Training V1.0.0 Please read the Important Notice and Warnings at the end of this document...
  • Page 2: Scope Of Work

    Latch (T3OTL) is toggled and the value of timer T2 or T4 is transferred into timer T3 depending on T3OTL value. The state of an LED is toggled in an interrupt service routine which is triggered by the timer T3. 2020-06-05 Copyright © Infineon Technologies AG 2020. All rights reserved.
  • Page 3 Introduction › The General Purpose Timer Unit (GPT12) is made of two GPT blocks (GPT1 and GPT2). › Each block has a multifunctional timer structure which incorporates several 16-bit timers. › Block GPT1 contains three timers: the core timer T3 and two auxiliary timers T2 and T4.
  • Page 4: Hardware Setup

    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. 2020-06-05 Copyright © Infineon Technologies AG 2020. All rights reserved.
  • Page 5 Configure the timer T3 mode, direction and starting value › Configure the two auxiliary timers (timer mode, reload input mode and reload values) to reload the timer T3 The above steps are detailed in the following slides. 2020-06-05 Copyright © Infineon Technologies AG 2020. All rights reserved.
  • Page 6 Implementation Configure the GPT12 Module Configuration of the GPT12 is done once in the function initGpt12PWM() by the following steps: › Enable GPT12 module by calling the iLLD function IfxGpt12_enableModule() › Set GPT1 prescaler with the iLLD function IfxGpt12_setGpt1BlockPrescaler() ›...
  • Page 7 32 ������ › Calculate dutyUpTime and dutyDownTime with the following formulas: ������������������ ������������������ �� × 1 − �� × ���������� ���������� �������������������� = ������������������������ = �� �� 2020-06-05 Copyright © Infineon Technologies AG 2020. All rights reserved.
  • Page 8 Starting timer T3 Finally, starting the timer T3 is done in the function runGpt12PWM() by calling the iLLD function IfxGpt12_T3_run(). The above functions are provided by the iLLD header IfxGpt12.h. 2020-06-05 Copyright © Infineon Technologies AG 2020. All rights reserved.
  • Page 9 Get the address of timer T3 service request with the iLLD function IfxGpt12_T3_getSrc() › Initialize GPT12 interrupt by calling IfxSrc_init() with a pointer to the address of the timer T3 service request, the interrupt provider and the interrupt priority number as parameters ›...
  • Page 10 On underflow of timer T3, the Output Toggle Latch (T3OTL) is toggled and the value of timer T2 or T4 is transferred into timer T3 depending on T3OTL value. Both functions are provided by the iLLD header IfxPort.h. 2020-06-05 Copyright © Infineon Technologies AG 2020. All rights reserved.
  • Page 11 Run and Test After code compilation and flashing the device, observe the LED D107 (1), which should be blinking 2 times in a second. 2020-06-05 Copyright © Infineon Technologies AG 2020. All rights reserved.
  • Page 12 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 › For questions and support, use the AURIX™ Forum: › https://www.infineonforums.com/forums/13-Aurix-Forum 2020-06-05 Copyright © Infineon Technologies AG 2020. All rights reserved.
  • Page 13 Infineon Technologies in in personal injury. customer’s applications. The data contained in this document is exclusively intended for technically trained staff.