PWM generation and trigger on match in S32K144EVM.

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

PWM generation and trigger on match in S32K144EVM.

269 Views
Kapila
Contributor II

How does this instruction generates trigger

if (1==((FTM0->CONTROLS[0].CnSC & FTM_CnSC_CHF_MASK)>>FTM_CnSC_CHF_SHIFT))
{
/* - If chan flag is set: */
FTM0->CONTROLS[0].CnSC &= ~FTM_CnSC_CHF_MASK;  /* Clear flag: read reg then set CHF=0 */
if(  FTM0->CONTROLS[0].CnV==56250)
{
/* - If count at last value before end: */
FTM0->CONTROLS[0].CnV= 0 ;  /* Update compare value: to 0 */
}
else
{
FTM0->CONTROLS[0].CnV= FTM0->CONTROLS[0].CnV + 6250 ;
/* - else: */
/* Update compare value: add 6250 to current value */
}
 
I request some one to clarify me,
Thanks in advance
Kanakaraju
0 Kudos
1 Reply

230 Views
Robin_Shen
NXP TechSupport
NXP TechSupport

Hi 

Have you read AN5303: Features and Operation Modes of FlexTimer Module on S32K – Application Note and AN5303SW?

The code you attached just clears the flag after checking CHF and updates the value of CnV to adjust the PWM duty cycle.

If you want to understand the mechanism of CnV update, it is recommended to read chapter 4.3. Updating FTM registers of AN5303.

Best Regards,
Robin
-------------------------------------------------------------------------------
Note:
- If this post answers your question, please click the "Mark Correct" button. Thank you!

- We are following threads for 7 weeks after the last post, later replies are ignored
Please open a new thread and refer to the closed one, if you have a related question at a later point in time.
-------------------------------------------------------------------------------

0 Kudos