S32K146 - not match in Output Compare Mode - FTM

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 
已解决

S32K146 - not match in Output Compare Mode - FTM

跳至解决方案
770 次查看
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.

标记 (5)
0 项奖励
回复
1 解答
721 次查看
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.
-------------------------------------------------------------------------------

在原帖中查看解决方案

1 回复
722 次查看
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.
-------------------------------------------------------------------------------