FRDM-KL03 - Create an Interrupt Driven Short Time Base

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

FRDM-KL03 - Create an Interrupt Driven Short Time Base

659 Views
aboss
Contributor I

Is there a way to create a short time base, e.g. 200-300 ns ticks using the TPM with an ISR? I have my TPM using a 48 MHz clock, with an ISR once the timer overflows, but am unable to generate time bases shorter than 2.8 us using the FRDM-KL03 tpm_simple_pwm driver example.

-Andrew

Tags (1)
0 Kudos
Reply
1 Reply

567 Views
mjbcswitzerland
Specialist V

Hi Andrew

I have tried to generate a 1us TPM interrupt period and get 1.6us with the uTasker TPM driver. This is a limitation of the processor since it can't handle these interrupts much faster than that and on top of it are GPIO access delays when measuring the interrupt duration on GPIO pins (the attached binary can be loaded the FRDM-KL03Z and toggles the red LED at this speed), plus the fact that it is running interrupt code in Flash and this is probably slower than full speed (running the ISR code in SRAM may help improve speed a little).

See also
https://www.nxp.com/docs/en/application-note/AN12078.pdf
https://community.nxp.com/thread/424714

At 48MHz the limit is around 650ns for an interrupt (interrupt latency going in and returning, plus the interrupt code itself) so 200ns..300ns is not achievable and would require a more powerful processor.

Regards

Mark

Complete Kinetis solutions, training and support: http://www.utasker.com/kinetis.html
Kinetis KL02/KL03/KL05:
- http://www.utasker.com/kinetis/FRDM-KL02Z.html
- http://www.utasker.com/kinetis/FRDM-KL03Z.html
- http://www.utasker.com/kinetis/FRDM-KL05Z.html