MC_PMSM :: /* initial value of the FTM counter */

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

MC_PMSM :: /* initial value of the FTM counter */

454 Views
amerzater
Contributor III

Can I ask what is the meaning of the minus operator (-)at defining the initial value of FTM0 for generating 3phase PWM signals at MC_PMSM library?

what does it mean?

Simply, the initial value of FTM0 should be assigned to  ui16PwmModulo / 2 ...not to (-ui16PwmModulo / 2 )

/* initial value of the FTM counter */
FTM0->CNTIN = (uint32_t)(-g_sClockSetup.ui16PwmModulo / 2);

1 Reply

374 Views
Hui_Ma
NXP TechSupport
NXP TechSupport

Hi,

I debug the PMSM demo with FRDM-KV10Z board and get below result:

pastedImage_1.png

The FTM0 CnV registers value is:

pastedImage_2.png

You could find the function of  '-' is to bit inversion of variable value.

0xF8AE is bit inversion of 0x752 of 16 bit variable.

Wish it helps.


Have a great day,
Mike

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------