AnsweredAssumed Answered

Kinetis K66F - Periodic Interrupt Timer (PIT) is missing interrupt handlers

Question asked by Pero Peric on Jan 9, 2019
Latest reply on Jan 10, 2019 by Pero Peric

Hello everyone,

I need a little bit of help regarding my project, which should utilize Periodic Interrupt Timer (PIT).

I am trying to build 6-pulse IGBT inverter to power a three phase motor, and to control the IGBTs I need fast MCU. Search has filtered out FRDM-K66F with 180 MHz clock as possible solution.

Now I am investigating if this MCU can perform needed tasks. Algorithm for controlling six IGBTS basically consists of generating ON and OFF impulses which are routed to gate inputs of IGBTs. Generation of impulses relies on keeping precise time, and interrupts timers which have to generate ON and OFF commands. For this to happen, Periodic Interrupt Timer (PIT) could be useful.

On previous MCUs, interrupt timers work like this: you setup the timer to raise an interrupt after XY nanoseconds(yes nanoseconds)/microseconds and afterwards continue doing whatever you like to do on a MCU (let's say you want your controller to calculate first million prime numbers :) – I couldn't thing anything better than that, but it will serve for showing my point). During the calculation of prime numbers, an interrupt occurs, and CPU immediately stops calculating prime numbers and starts executing interrupt handler procedure, which in my case could be: turn ON output 15 and 16 and turn OFF output 17, and finally set new time delay value for interrupt timer, and return to calculating prime numbers. The process repeats itself indefinitely.

Now, my problem is I can't find in Kinetis SDK 2.0 API Reference Manual, found here:

... a PIT initialization function which could take for parameter my interrupt handler procedure. I can set flags, I can read flags when interrupt occurs, but I can not find a way to force CPU to stop calculating prime numbers and start executing something else by itself.

I do not wish to check if some bit in some register has switched value from 0 to 1, just to know that the "interrupt" has happened. I want it to happen automatically. Right now PIT looks to me as if it is behaving as normal timer, without, INTERRUPT ability.

Am I doing something wrong?

I found a tutorial:

...which on page 8 also manually checks for flags, but this kind of behavior is missing INTERRUPT part of PITs.