PWM SM3 Register not getting updated

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

PWM SM3 Register not getting updated

773 Views
narenchandra401
Contributor III

Hello Community People ,

We are using PWM module in one of our application 

configured these pins as PWM

GPIO_EMC_28 as FLEXPWM2_A3
GPIO_EMC_29 as FLEXPWM2_B3

We are operating the PWM with 1KHz 

As known the submodule 3 is a independent module which includes A3 and B3 , when we are trying to change the duty cycle of A3 and B3 in back to back instructions i am not able to see the update on B3 

if we do it this way ,

change Duty cycle of B3 first by writing VAL4,VAL5 and in next instruction we change the duty if A3 by writing VAL2 and VAL3 we are not able to see update on A3 and this is vice versa 

When we give a 1 ms delay between both instructions we are able to see the change as required , 

can someone explain what could be the problem , is there any minimum time delay we need to give to access the same register ?

here is a sample code 

 

Case 1:  First change B3 and next A3 , A3 not getting updated 

PWM_Setup(PWM2,kPWM_PwmB,kPWM_Module_3,pwmFrequencyInHz,dutyCyclePercent); PWM_SetPwmLdok(PWM2, kPWM_Control_Module_3 , true);
PWM_StartTimer(PWM2, kPWM_Control_Module_3 );

PWM_Setup(PWM2,kPWM_PwmA,kPWM_Module_3,pwmFrequencyInHz,dutyCyclePercent);

PWM_SetPwmLdok(PWM2, kPWM_Control_Module_3 , true);
PWM_StartTimer(PWM2, kPWM_Control_Module_3 );

 

Case 2:  First change A3 and next B3 , B3 not getting updated 

PWM_Setup(PWM2,kPWM_PwmA,kPWM_Module_3,pwmFrequencyInHz,dutyCyclePercent); PWM_SetPwmLdok(PWM2, kPWM_Control_Module_3 , true);
PWM_StartTimer(PWM2, kPWM_Control_Module_3 );

PWM_Setup(PWM2,kPWM_PwmB,kPWM_Module_3,pwmFrequencyInHz,dutyCyclePercent);

PWM_SetPwmLdok(PWM2, kPWM_Control_Module_3 , true);
PWM_StartTimer(PWM2, kPWM_Control_Module_3 );

 

Working condition: When delay of 1 ms is added between these updates both are getting updated 

PWM_Setup(PWM2,kPWM_PwmA,kPWM_Module_3,pwmFrequencyInHz,dutyCyclePercent); PWM_SetPwmLdok(PWM2, kPWM_Control_Module_3 , true);
PWM_StartTimer(PWM2, kPWM_Control_Module_3 );

Delay_ms(1);

PWM_Setup(PWM2,kPWM_PwmB,kPWM_Module_3,pwmFrequencyInHz,dutyCyclePercent);

PWM_SetPwmLdok(PWM2, kPWM_Control_Module_3 , true);
PWM_StartTimer(PWM2, kPWM_Control_Module_3 );

 

Is there any minimum time we need to provide before the update to same register ?

Anticipating a quick reply 

Regards ,

Naren

 

1 Reply

756 Views
victorjimenez
NXP TechSupport
NXP TechSupport

Hello Naren, 

To provide you better support, could you please tell me which RT are you using? 

In the PWM example that we provide within the SDK, we update the duty cycle of three signals without problems. But we use the function PWM_UpdatePwmDutycycle, could you please use this function to update the duty cycle in your application? When using this function, do you see the same behavior? 

Regards,

Victor 

 

0 Kudos
Reply