Hi Matias
The PIT uses always the bus clock.
For 5kHz interrupt in the uTasker project:
PIT_SETUP pit_setup; // PIT interrupt configuration parameters
pit_setup.int_type = PIT_INTERRUPT;
pit_setup.int_priority = PIT0_INTERRUPT_PRIORITY;
pit_setup.int_handler = irq_pit; // irq call-back
pit_setup.count_delay = PIT_FREERUN_FREQ(5000); // 5kHz
pit_setup.mode = (PIT_PERIODIC); // periodic trigger
pit_setup.ucPIT = 0; // use PIT0
fnConfigureInterrupt((void *)&pit_setup); // configure and start PIT
static void irq_pit(void)
{
// toggle LED
}
Use the links below for complete code (runs on all Kinetis parts) and Kinetis simulation so that you can analyse the code and internal working of the PIT (and other peripherals), including its interrupt and DMA capabilities.
Regards
Mark
Kinetis: http://www.utasker.com/kinetis.html
Kinetis K64:
- http://www.utasker.com/kinetis/FRDM-K64F.html
- http://www.utasker.com/kinetis/TWR-K64F120M.html
- http://www.utasker.com/kinetis/TEENSY_3.5.html
- http://www.utasker.com/kinetis/Hexiwear-K64F.html
HW Timers: http://www.utasker.com/docs/uTasker/uTaskerHWTimers.PDF
Free Open Source solution: https://github.com/uTasker/uTasker-Kinetis
Working project in 15 minutes video: https://youtu.be/K8ScSgpgQ6M
For better, faster, cheaper product developments consider the uTasker developer's version, professional Kinetis support, one-on-one training and complete fast-track project solutions to set you apart from the herd : http://www.utasker.com/support.html