For OS tick time which is better :-System Timer Module (STM) or Periodic Interrupt Timer (PIT)

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

For OS tick time which is better :-System Timer Module (STM) or Periodic Interrupt Timer (PIT)

3,465 Views
goranivan
Contributor II

I am using MPC5606B micro , i am using the schedulers, My OS tick time is 1msec , with 32mHz system clock generated by external 8Mhz clock. For every 1msec interrupt i call the scheduler. I want to know which one is better, whether STM or PIT. If you have a example code please share, it will be every helpful for my reference.

 

Best regards

Goran

Labels (1)
4 Replies

2,846 Views
martin_kovar
NXP Employee
NXP Employee

Hello Goran,

from my point of view, PIT is much more better than STM. PIT timer counts down from set value (LDVAL register) to 0. After zero is reached Timer Interrupt Flag is set and timer counter (CVAL register) is reset to original set value (in LDVAL register) and process is repeated. This is pretty simple and it perfectly fits for your task.

STM works different. There is compare register you set and timer counts from 0 to FFFFFFFF. After compare register is reached, Timer Interrupt Flag is set, but timer continue with counting up. So in every interrupt, you have to stop counter and reset it's CNT register to 0 and enable counter again. In this case, timing is not as accurate as in case of PIT timer.

Hope it helps.

Regards,

Martin

2,846 Views
goranivan
Contributor II

Hello Martin

Ya this information was very helpful.

If you have codes(PIT and STM) of same please share.

Thanks and regards

goran

0 Kudos
Reply

2,845 Views
martin_kovar
NXP Employee
NXP Employee

Hello,

for PIT configuration, please see following example:

Example MPC5607B PinToggleStationery CW210 

I am attaching simple example for STM (example is created for MPC5604P, but you can use it for MPC5606B) directly to this post.

Regards,

Martin

2,845 Views
goranivan
Contributor II

Hello Martin

Thank you for your valuable help.

Best regards

Goran