In Kinetis FTM module, it has only one counter that serves multiple timer input or output. In RT, the 4 counters in a QTMR are independent. Is there a way to clear other 3 counters when the master (say counter0) is reset (i.e. reload) upon capture event?
The equivalent code for Kinetis FTM is here:
FTM0->CONTROLS[ 0 ].CnSC = FTM_CnSC_ELSA_MASK + FTM_CnSC_ICRST_MASK; // MSB:MSA=00=input capture; ELSB:ELSA=01=rising edge; CNT reset on edge
FTM0->CONTROLS[ 1 ].CnSC = FTM_CnSC_ELSA_MASK; // MSB:MSA=00=input capture; ELSB:ELSA=01=rising edge
FTM0->CONTROLS[ 2 ].CnSC = FTM_CnSC_ELSA_MASK; // MSB:MSA=00=input capture; ELSB:ELSA=01=rising edge
FTM0->SC = FTM_SC_CLKS( 1 ); // Enable FTM @ 40MHz BUS_CLK; PS=div1
The behavior of above code is...
Thanks!!
Hi Jeremy,
I would hope that you reflect my issue back to the team, first verify my finding, then when proving true, update RT family's Reference Manual.
Regards,
Jei
Hi Jeremy,
Thanks for prompt reply. But the reset counters applies only to Compare event. What I am looking for is the Capture event. I haven't done exhausted testing yet. But thus far, it doesn't work for Capture event.
Any other thoughts?
Jei
Hi Jei Chou,
Thank you for your reply.
I'm afraid that QTMR doesn't support to initialize all four counter/timer upon the capture event happens.
Hope this is clear.
Have a great day,
TIC
-------------------------------------------------------------------------------
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.
-------------------------------------------------------------------------------
Jeremy,
After experimenting some more, the counter reset by Master seems to work!
Attached is the changes to example project of iled_blinky. I feed external 5KHz square waves to inputs of QTMR3. Each input has different delay (leading or lagging) to Master.
The debug output shows reasonable captures:
Enter any key => 1
15180, 14799, 14421, 378
Hi Jei Chou,
Thanks for the sharing:smileyhappy:.
Have a great day,
TIC
-------------------------------------------------------------------------------
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 Jei Chou,
Thank you for your interest in NXP Semiconductor products and for the opportunity to serve you.
Q1) Is there a way to clear other 3 counters when the master (say counter0) is reset (i.e. reload) upon capture event?
-- It's able to clear other 3 counters when the master encounters a compare event if enabling the COINIT feature.
Have a great day,
TIC
-------------------------------------------------------------------------------
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.
-------------------------------------------------------------------------------