This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Cant get Adj to work with PWM_PFC2PhiL

Other Parts Discussed in Thread: CONTROLSUITE

Hi folks,

I'm using the F2802x DPLib (v3.4) and have the ISR and sveral other macros working fine (2P2Z, PWM_1ch, ADC, etc).

I am trying to use the PWM_PFC2PhiL macro to output two complementary pulses with some deadtime on ePWM1 on an F28027.

I can get complementary pulses out no problem but not with any deadtime. Altering the PWM_PFC2PhiL_Adj variable does seem to alter the EPWM1.CMPB value as expected (e.g. if I set a duty of 0.25 and an Adj of 0.25 the CMPA is equal to a quarter of the period amd CMPB is equal to the period minus a quarter). However the pulse that is output on the pin never changes, the pulse trains stay exactly complementary.

Im using the TI supplied CNF C and macro asm files and all values seem to be correct and in the required registers.... just no change in pulse?? :\ 

I have the period set to 231 for ~260kHz pulse on a 60MHz SYSCLKOUT, and the PWM is also generating an ADC SOC on every second zero event and the interrupt for the  DPL ISR on every second period event.

Is there something I'm missing?

  • Please check the following:

    1. With period of 231, for this symmetric PWM mode your frequency is 260kHz. Do you see a 260kHz PWM output?

    2. For duty=0.25, CMPA = 0.25*231/2=29. Pls check the Register value for CMPA and verify that it is 29

    3. For duty=0.25 and Adj=0.25, CMPB = (1-0.25-0.25)*231/2 = 58. Pls check the register value for CMPB and verify that it is 58

    Also, pls review the documentation in ControlSUITE on how this macro is implemented.

    Shamim

  • Arrgh, looking at your steps I realised the TBPRD register had the 231 value in it instead of 115... My code was still calling a previously used CNF function!! Even though I'd removed the link to its file, PWM_2CHUPCNT_CNF() was still being called during setup instead of the correct PWM_PFC2PHIL_CNF() and the compiler hadn't thrown an error about calling a missing function for some reason.

    D'oh!

    Thanks for your help Shamim :)