DSC eFlexPWM Edge Aligned Signed Question

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

DSC eFlexPWM Edge Aligned Signed Question

1,382 Views
Kris_Ke
Contributor III

Dear Sir, 

I use MC56F82748 of eFlexPWM.

The parameters of the VAL 4,5 for the eFlexPWM model are somewhat different from my knowledge.

I will ask you about it.

Below is my setting, 

003.PNG

And SM1INIT and SM2INIT value same as 0.

002.PNG

001.PNG

The following waveforms SM1, VAL2=20, VAL3=803, VAL4=863, VAL5=1635

PWMA works normally. but PWMB VAL4 is high with VAL2 at the same time, and when count to 863 then PWM did not change to low.

SM2's VAL1 is filled with 0x681, VAL4 is filled with 0x600, and VAL5 is filled with 0x610.

SM2 PWMB issue is same as SM1.

12345.png

Thanks, 

BR

Kris

9 Replies

1,145 Views
xiangjun_rong
NXP TechSupport
NXP TechSupport

Hi, Kris,

I think there is issue for the following code:

  for(;;)
  {
      //FMSTR1_Poll();
      

      if(switch_flag==0){
          
    setReg16(PWMA_SM2VAL5, 0x600);
    switch_flag=1;
      }
        /* load new values to PWM registers */
        setReg16Bits(PWMA_MCTRL, PWM_MCTRL_LDOK(1)); /* LDOK,load enable */
        
  }

you can NOT write any peripheral register in a for loop, as you know that the core writes a peripheral register with about 50MHz speed if you write code in this way.

You can enable reload interrupt, in the reload ISR, you can update the eFlexPWM register so that the PWM cycle changes for every cycle.

Hope it can help you

BR

Xiangjun Rong

1,145 Views
Kris_Ke
Contributor III

Hi Xiangjun

Sorry, Maybe I deleted too many things and caused your misunderstanding.

In my project, I follow the DRM172 to doing PWM update.

https://www.nxp.com/docs/en/reference-manual/DRM172.pdf 

As below picture, reload PWM value when SM0 counter over.

013.png

I move the "setReg16Bits(PWMA_MCTRL, PWM_MCTRL_LDOK(1)); /* LDOK,load enable */ " into the PWM ISR.

014.PNG

It's still have same issue.

Tek004_001.jpg

As you said, I follow you  enable reload interrupt, in the reload ISR, still have issue.

0 Kudos

1,145 Views
xiangjun_rong
NXP TechSupport
NXP TechSupport

Hi, Kris,

This is a eFlexPWM example based on PE, pls refer to it. If you still have issue, pls update the ticket.

BR

Xiangjun rong

0 Kudos

1,145 Views
Kris_Ke
Contributor III

Dear Sir

Please reference my attached file.

Kris

0 Kudos

1,145 Views
mohammad_kamil
NXP Employee
NXP Employee

Hello kris ke, can you please check if you attached the same project which you are discussing in question, as i checked i found different values and setting of PWM in your attached file.

Kamil

0 Kudos

1,145 Views
Kris_Ke
Contributor III

Hi Kamil

The PWM values different than the my question it is not affect the issue of PWM.  I removed the extra content from my project and narrowed it down to reproduce the issue.

If you stop in Step 1, And set switch_flag to a value other than 1. The PWM_SM2VAL0 = 0, PWM_SM2VAL1=0x683, PWM_SM2VAL4=0x38c, PWMA_SM2VAL5=19.

And the PWM SM2VAL45 will work normal.

01.PNG

If you let it normal run, then the The PWM_SM2VAL0 = 0, PWM_SM2VAL1=0x683, PWM_SM2VAL4=0x38c, PWMA_SM2VAL5=0x600.

It will reproduce my issue.

02.PNG

Kris

0 Kudos

1,145 Views
mohammad_kamil
NXP Employee
NXP Employee

Hello Kris Ke, did you get a chance to test xiangjun rong  code?

0 Kudos

1,145 Views
xiangjun_rong
NXP TechSupport
NXP TechSupport

Hi, Kris,

It appears that the PWM waveform of SM1_VAL45 does not match with the register configuration, pls post your project so that we can have a review and test.

BR

Xiangjun Rong

0 Kudos

1,145 Views
mohammad_kamil
NXP Employee
NXP Employee

Hello kris ke, are you getting same issue with SM0, and SM2 module, can meanwhile can you please share your code which you are testing, as well as schematic around MCU.

With Regards

Kamil

0 Kudos