Initial PWM output value with eFlexPWM

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

Initial PWM output value with eFlexPWM

Jump to solution
177 Views
zorrotz
Contributor III

Hi,

Working with eFlexPWM of MCXA132, I want to modify the initial value for PWM23.
For that I do next steps:


1. SM1CTRL2[PWM23_INIT] = 1

2. SM1CTRL2[FRCEN] = 1
    SM1CTRL2[FORCE] = 1    (note that SM1CTRL2[FORCE_SEL] is 000)

3. MCTRL[RUN] = 010

But first PWM cycle always starts with output at level 0.

Where can be the problem?

Thanks in advance

Labels (1)
0 Kudos
Reply
1 Solution
58 Views
zorrotz
Contributor III

Hello,

I have found my mistake.

The reference manual has this note:

"If MCTRL[LDOK] is not set, setting MCTRL[RUN] also sets the STS[RF] flag. To prevent a CPU interrupt request, clear INTEN[RIE] before setting MCTRL[RUN]."

I am using STS[RF] to end PWM cycle, but I clear STS[RF] before doing MCTRL[RUN] = 1.

 

Thanks

View solution in original post

0 Kudos
Reply
2 Replies
59 Views
zorrotz
Contributor III

Hello,

I have found my mistake.

The reference manual has this note:

"If MCTRL[LDOK] is not set, setting MCTRL[RUN] also sets the STS[RF] flag. To prevent a CPU interrupt request, clear INTEN[RIE] before setting MCTRL[RUN]."

I am using STS[RF] to end PWM cycle, but I clear STS[RF] before doing MCTRL[RUN] = 1.

 

Thanks

0 Kudos
Reply
114 Views
Alice_Yang
NXP TechSupport
NXP TechSupport

Hello @zorrotz 

 

To help us analyze the issue, could you please share your complete project with us?

Thank you.

 

BR

Alice

0 Kudos
Reply
%3CLINGO-SUB%20id%3D%22lingo-sub-2418776%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3EInitial%20PWM%20output%20value%20with%20eFlexPWM%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2418776%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3EHi%2C%3CBR%20%2F%3E%3CBR%20%2F%3EWorking%20with%20eFlexPWM%20of%20MCXA132%2C%20I%20want%20to%20modify%20the%20initial%20value%20for%20PWM23.%3CBR%20%2F%3EFor%20that%20I%20do%20next%20steps%3A%3C%2FP%3E%3CP%3E%3CBR%20%2F%3E1.%20SM1CTRL2%5BPWM23_INIT%5D%20%3D%201%3C%2FP%3E%3CP%3E2.%20SM1CTRL2%5BFRCEN%5D%20%3D%201%3CBR%20%2F%3E%26nbsp%3B%20%26nbsp%3B%20SM1CTRL2%5BFORCE%5D%20%3D%201%26nbsp%3B%20%26nbsp%3B%20(note%20that%20SM1CTRL2%5BFORCE_SEL%5D%20is%20000)%3CBR%20%2F%3E%3CBR%20%2F%3E3.%20MCTRL%5BRUN%5D%20%3D%20010%3CBR%20%2F%3E%3CBR%20%2F%3EBut%20first%20PWM%20cycle%20always%20starts%20with%20output%20at%20level%200.%3CBR%20%2F%3E%3CBR%20%2F%3EWhere%20can%20be%20the%20problem%3F%3CBR%20%2F%3E%3CBR%20%2F%3EThanks%20in%20advance%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-2418776%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CLINGO-LABEL%3EMCXA%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2419388%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%20translate%3D%22no%22%3ERe%3A%20Initial%20PWM%20output%20value%20with%20eFlexPWM%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2419388%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3EHello%26nbsp%3B%3CA%20href%3D%22https%3A%2F%2Fcommunity.nxp.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F59428%22%20target%3D%22_blank%22%3E%40zorrotz%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%0A%3CBR%20%2F%3E%0A%3CDIV%3E%0A%3CP%3ETo%20help%20us%20analyze%20the%20issue%2C%20could%20you%20please%20share%20your%20complete%20project%20with%20us%3F%3C%2FP%3E%0A%3CP%3EThank%20you.%3C%2FP%3E%0A%3CBR%20%2F%3E%0A%3CP%3EBR%3C%2FP%3E%0A%3CP%3EAlice%3C%2FP%3E%0A%3C%2FDIV%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2419748%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%20translate%3D%22no%22%3ERe%3A%20Initial%20PWM%20output%20value%20with%20eFlexPWM%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2419748%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3EHello%2C%3C%2FP%3E%3CP%3EI%20have%20found%20my%20mistake.%3C%2FP%3E%3CP%3EThe%20reference%20manual%20has%20this%20note%3A%3C%2FP%3E%3CP%3E%22If%20MCTRL%5BLDOK%5D%20is%20not%20set%2C%20setting%20MCTRL%5BRUN%5D%20also%20sets%20the%20STS%5BRF%5D%20flag.%20To%20prevent%20a%20CPU%20interrupt%20request%2C%20clear%20INTEN%5BRIE%5D%20before%20setting%20MCTRL%5BRUN%5D.%22%3C%2FP%3E%3CP%3EI%20am%20using%20STS%5BRF%5D%20to%20end%20PWM%20cycle%2C%20but%20I%20clear%20STS%5BRF%5D%20before%20doing%20MCTRL%5BRUN%5D%20%3D%201.%3C%2FP%3E%3CBR%20%2F%3E%3CP%3EThanks%3C%2FP%3E%3C%2FLINGO-BODY%3E