infineon4engi@twitter infineon4engineers infineon@linkedin infineon@youtube
twitter Facebook Linkedin Youtube

TC4xx promo banner Banner_Aurix_Competition Banner_AURIX_Security-Solution Banner_AURIX_Safety_Products ShieldBuddy TC275 Banner_AURIX_DevelopmentStudio

+ Reply to Thread
Results 1 to 1 of 1

Thread: PWM not working

  1. #1
    Intermediate Intermediate Lukas_G is on a distinguished road
    Join Date
    Apr 2019

    PWM not working

    I recently implemented PWMhl module on my device (Tc222L) . Pwm init without any failures, but it does not works at all. It means it works, but completely different as I configure it.
    First issue is that, setting 1000Hz base timer frequency results Is 100Hz output pwm signal ( for clock divider 16 -IfxGtm_Tom_Ch_ClkSrc_cmuFxc0) .
    Or frequency is changing between 700 – 1300Hz(for clock divider 1 -IfxGtm_Tom_Ch_ClkSrc_cmuFxclk0 )
    Moreover PWM level cannot be changed. Setting pwm value do not change anything, pwm always stays on 10% duty.
    What can pe possible fixes ?

    my code:
    #include "Gtm/Tom/PwmHl/IfxGtm_Tom_PwmHl.h"
    static IfxGtm_Tom_PwmHl pwm_1;
    static IfxGtm_Tom_Timer pwm_tom_1_timer;
    static void init_pwm(void){
       IfxGtm_Tom_Timer_Config timer_config;
       IfxGtm_Tom_PwmHl_Config pwm_config;
       IfxGtm_Tom_Timer_initConfig(&timer_config, &MODULE_GTM);
       timer_config.base.frequency                  = 1000;
       timer_config.base.minResolution              = (1.0 / timer_config.base.frequency) / 1000;
       timer_config.tom                             = IfxGtm_Tom_1;
       timer_config.timerChannel                    = IfxGtm_Tom_Ch_6;
       timer_config.clock                           = IfxGtm_Tom_Ch_ClkSrc_cmuFxc0;
       timer_config.triggerOut                      = &IfxGtm_TOM1_6_TOUT5_P02_5_OUT;
       timer_config.base.trigger.outputEnabled      = TRUE;
       timer_config.base.trigger.enabled            = TRUE;
       timer_config.base.trigger.triggerPoint       = 500;
       timer_config.base.trigger.risingEdgeAtPeriod = TRUE;
       IfxGtm_Tom_Timer_init(&pwm_tom_1_timer, &timer_config);
       IfxGtm_Tom_ToutMapP ccx[1]   = {&IfxGtm_TOM1_6_TOUT5_P02_5_OUT};
       IfxGtm_Tom_ToutMapP coutx[1] = {&IfxGtm_TOM1_6_TOUT5_P02_5_OUT};
       pwm_config.timer                 = &pwm_tom_1_timer;
       pwm_config.tom                   = IfxGtm_Tom_1;
       pwm_config.base.deadtime         = 2e-6;
       pwm_config.base.minPulse         = 1e-6;
       pwm_config.base.channelCount     = 1;
       pwm_config.base.emergencyEnabled = FALSE;
       pwm_config.base.outputMode       = IfxPort_OutputMode_pushPull;
       pwm_config.base.outputDriver     = IfxPort_PadDriver_cmosAutomotiveSpeed4;
       pwm_config.base.ccxActiveState   = Ifx_ActiveState_low;
       pwm_config.base.coutxActiveState = Ifx_ActiveState_low;
       pwm_config.ccx                   = ccx;
       pwm_config.coutx                 = coutx;
       //pins were initialized earlier
       pwm_config.initPins              = FALSE;
       IfxGtm_Tom_PwmHl_init(&pwm_1, &pwm_config);
    void set_pwm( uint8 pwm_percent_value){
    	IfxGtm_Tom_PwmHl *pwm_hi = &pwm_1;
        IfxGtm_Tom_Timer *timer = &pwm_tom_1_timer;
    	Ifx_TimerValue period = IfxGtm_Tom_Timer_getPeriod(timer);
        Ifx_TimerValue pwm_value = (uint32)((float32)period *((float32)pwm_percent_value)/ 100.0);
        IfxGtm_Tom_PwmHl_setOnTime(pwm_hi, &pwm_value);
    Last edited by Lukas_G; Oct 29th, 2020 at 08:38 AM.

+ Reply to Thread

All content and materials on this site are provided “as is“. Infineon makes no warranties or representations with regard to this content and these materials of any kind, whether express or implied, including without limitation, warranties or representations of merchantability, fitness for a particular purpose, title and non-infringement of any third party intellectual property right. No license, whether express or implied, is granted by Infineon. Use of the information on this site may require a license from a third party, or a license from Infineon.

Infineon accepts no liability for the content and materials on this site being accurate, complete or up- to-date or for the contents of external links. Infineon distances itself expressly from the contents of the linked pages, over the structure of which Infineon has no control.

Content on this site may contain or be subject to specific guidelines or limitations on use. All postings and use of the content on this site are subject to the Usage Terms of the site; third parties using this content agree to abide by any limitations or guidelines and to comply with the Usage Terms of this site. Infineon reserves the right to make corrections, deletions, modifications, enhancements, improvements and other changes to the content and materials, its products, programs and services at any time or to move or discontinue any content, products, programs, or services without notice.