Can I make a 32-bit counter from FTM?

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

Can I make a 32-bit counter from FTM?

1,159 Views
michaelschwager
Contributor III

I'm using MK60DN512VLQ10 with MQX 4.1 on a custom PCB.

Currently I have FTM0 configured as a free-running counter from FTM_CLKIN1.  I'm driving this with an external 100kHz clock.

However I'd like to have a 32-bit counter, preferably without software intervention, ie interrupts, etc.

I thought I could use FTM1 with prescaler = 65536, but the prescaler doesn't go that high.  It only goes to 128.

Can I chain two FTMs together to create a 32-bit counter?  The clock source of a given FTM doesn't appear to allow the MSB of a different FTM.

I also have the 100kHz clock going to FTM0_CH4 input, but I'm not using that for anything now.

thanks

0 Kudos
2 Replies

511 Views
Hui_Ma
NXP TechSupport
NXP TechSupport

Hi Michael,

Unfortunately, Kinetis Flextimer doesn't support chained timer.

So, customer can not chain two Flextimer as a 32-bit counter.

Customer can consider to use PIT, which is a 32-bit timer and also could support chained timer for 64-bit timer.


Wish it helps.
best regards
Ma Hui

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 Kudos

511 Views
michaelschwager
Contributor III

Thanks, this is what I discovered.

I put an interrupt every time overflow flag (TOF) goes high, then increment my variable by 0x10000;

I need this to connect to an external clock from an FPGA (I’m synchronizing multiple boards to a global 100kHz clock), so I cannot use PIT, which states “The PIT module has no external pins”.

0 Kudos