S32K146 - not match in Output Compare Mode - FTM

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

S32K146 - not match in Output Compare Mode - FTM

Jump to solution
414 Views
demian91
Contributor III

Hi, I'm trying to start an Output Compare match on the channel 1 with a period of interrupt.

void FTM0_Ch0_Ch1_IRQHandler(void)
{
	if (1==((FTM0->CONTROLS[1].CnSC & FTM_CnSC_CHF_MASK)>>FTM_CnSC_CHF_SHIFT))
	{
		FTM0->CONTROLS[1].CnSC &= ~(FTM_CnSC_CHF_MASK);
		FTM0->CONTROLS[1].CnV = (uint16_t)FTM0->CNT + (uint16_t)1000;
	}
}

When i clear the flag and then write the CnV value, it doesn't works it seems that the value CnV is not loaded. But if invert the sentences setting the CnV value and then clear the flag it works fine.

i cant understand why is a problem to clear the flag before.

0 Kudos
1 Solution
365 Views
Robin_Shen
NXP TechSupport
NXP TechSupport

Hi 

Please refer to 47.4.3.6 Channel (n) Value (C0V - C7V) S32K1xx MCU Family - Reference Manual.
In output modes, writes to the CnV register are done on its write buffer. The CnV register is updated with its write buffer value according to Registers updated from write buffers.
If FTMEN = 0, a write to CnSC register resets manually this write coherency mechanism.

Check the value of FTMEN.
FTM0->CONTROLS[1].CnSC &= ~(FTM_CnSC_CHF_MASK); seems reset the mechanism.

If FTMEN = 0, a write to CnSC register resets manually this write coherency mechanism..jpg


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.
-------------------------------------------------------------------------------

View solution in original post

1 Reply
366 Views
Robin_Shen
NXP TechSupport
NXP TechSupport

Hi 

Please refer to 47.4.3.6 Channel (n) Value (C0V - C7V) S32K1xx MCU Family - Reference Manual.
In output modes, writes to the CnV register are done on its write buffer. The CnV register is updated with its write buffer value according to Registers updated from write buffers.
If FTMEN = 0, a write to CnSC register resets manually this write coherency mechanism.

Check the value of FTMEN.
FTM0->CONTROLS[1].CnSC &= ~(FTM_CnSC_CHF_MASK); seems reset the mechanism.

If FTMEN = 0, a write to CnSC register resets manually this write coherency mechanism..jpg


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.
-------------------------------------------------------------------------------