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.
解決済! 解決策の投稿を見る。
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.
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.
-------------------------------------------------------------------------------
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.
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.
-------------------------------------------------------------------------------