PWM PHASE DELAY

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
Tanaya
Level 1
Level 1
First reply posted First question asked Welcome!

I need a phase delay of some nano seconds between two pulses of the top legs.I am using aurix 233 and using TOM module.Even though i am getting perfect inverter pulses with deadtime for pulses of opposite leg i am not able to achieve phase delay between same top or bottom legs.

I used the function below

waitTime(IfxStm_getTicksFromMilliseconds(BSP_DEFAULT_TIMER, WAIT_TIME));

but its not working for me.Can i get some help regarding this?

0 Likes
2 Replies
Aiswarya_A
Moderator
Moderator
Moderator
25 likes received 250 sign-ins 50 solutions authored

Hi,

Are you using an ADS based example or a custom code? Could you please share the code snippet?
Could you also share the expected waveform and current waveform?

Regards,
Aiswarya.

0 Likes

Hi Aishwarya,

No i am not using any sample code.I am using TOM module for getting the pulses.Here is the code snippet of .c file.

uint8 Conv_UpdateDutyCycle(uint64 SwitchingFrequency, uint16 ucDutyCycle_TA)
{
uint8 FrequencyUpdation = RESET;


IfxGtm_Tom_Timer *stTimer = &g_stat_GtmTom0.drivers.timer;
IfxGtm_Tom_PwmHl *stPwmHl = &g_stat_GtmTom0.drivers.pwm;
// uint32 ulnShiftTime[CONV_MAX_TOM_CHANNEL] = {MIN_PHASE_SHIFT, MIN_PHASE_SHIFT};
Ifx_TimerValue ulnShiftTime[CONV_MAX_TOM_CHANNEL] = {MIN_PHASE_SHIFT,MIN_PHASE_SHIFT};
Ifx_TimerValue ulnTonTime[CONV_MAX_TOM_CHANNEL];
// uint32 ActualDutyCycle=RESET, DutyCycle_TA=RESET;
DutyCycle_TA=(uint32)ucDutyCycle_TA;
FrequencyUpdation = IfxGtm_Tom_Timer_setFrequency(stTimer,(float32)SwitchingFrequency);
stPwmHl->base.maxPulse=stTimer->base.period-stPwmHl->base.minPulse;
ActualDutyCycle=stTimer->base.period/PERCENTAGE_FACTOR;
g_stat_ulnTomDutyCycle_TA = ActualDutyCycle*DutyCycle_TA;

ulnTonTime[0] = g_stat_ulnTomDutyCycle_TA; /*Channel 1 st_aCcx,Cout DutyCycle*/
waitTime(IfxStm_getTicksFromMilliseconds(BSP_DEFAULT_TIMER, WAIT_TIME));
//IfxStm_waitTicks(BSP_DEFAULT_TIMER, IfxStm_getTicksFromMicroseconds(BSP_DEFAULT_TIMER, TLF_INIT_DELAY_TIME_US));
ulnTonTime[1] = g_stat_ulnTomDutyCycle_TA;
//waitTime(IfxStm_getTicksFromMilliseconds(BSP_DEFAULT_TIMER, WAIT_TIME));

IfxGtm_Tom_Timer_disableUpdate(stTimer); /*Stop Data Updation from Shadow Register to CM0 and CM1*/
IfxGtm_Tom_PwmHl_setOnTimeAndShift(stPwmHl,&ulnTonTime[CONV_MAX_TOM_CHANNEL], &ulnShiftTime[CONV_MAX_TOM_CHANNEL]);
IfxGtm_Tom_PwmHl_setOnTime(stPwmHl, &ulnTonTime[0]); /*Update DutyCycle in Shadow Register*/

IfxGtm_Tom_Timer_applyUpdate(stTimer); /*Enable Data Updation from Shadow Register to CM0 and CM1*/
return FrequencyUpdation;
}

I am getting a perfect inverted pulses for the pins of same leg but for top and bottom leg i need some phase delay which i am not getting!

0 Likes