AnsweredAssumed Answered

PIT hw boo-boo. Read if you need accurate PIT (CF)

Question asked by MrBean on Oct 7, 2010
Latest reply on Aug 10, 2013 by TomE

In short:  Do not use the PIT presaler !  (if you want an accurate PIT)

 

 

 

I noticed a small but precise offset between my PIT and RTC (both running from Fsys).

 

We have a 60MHz Fsys.

The prescaler was at 4 (2^4=16), PMR at 1875-1=1874. RLD bit set.

This should yield 1.000000ms. It doesnt, 1.00006666667ms is real.

 

 

Why ?  :

 

There is a hit in the ref. manual stating that the prescaler counter is reset at PCNT reload.

It is not reset to 0 but to all 1's. (Mind: the prescaler-counter, you cannot reach that, you can just select an output of it.)

 

This makes the PIT count to 1875.125 in our case.

After a PCNT reload from PMR the prescaler is reset, so the PIT-counter clock is 1/8th more (in this case) of what one would expect, just in one of the 1875 clocks.

This is always 2* 1/(Fsys/2) (aka 2 busclock cycles). I guess it is the reload itself.

 

The only way to correct it is to adjust PMR with 1/(2^(PRE[3:0])).

If PRE>0 you would need to adjust PMR with a fraction, so that can only be done with PRE=0

 

This renders the prescaler useless.

A shame because with PRE=4 we save 2mA because the PIT counter is not running at 30Mhz.

 

PS: for clarity: In our case we need to have PRE=0 and PMR=29998  to get 1.000000ms exactly.

 

To my knowledge this boo-boo is present in all MCF52223 and MCF52235

But, i expect it to be present in all ColdFires with a PIT.

Outcomes