MCF 5213 General Purpose Timers Input Clock Config

Discussion to talk about hardware related topics only.
Post Reply
bbowden
Posts: 6
Joined: Tue Mar 23, 2010 8:58 am

MCF 5213 General Purpose Timers Input Clock Config

Post by bbowden »

I am trying to generate a pulse train using the general purpose timers on a 5213. My problem is that the maximum prescaler divider is 128 but I need a slower clock. There is a reference is the documentation under fuctional description that describes the system clock being divided by 1 or 16 yet none of the GPT registers control this value. Does anyone know how to pre-prescale the system clock by 16?

Thanks.
gavinm
Posts: 59
Joined: Wed Jun 04, 2008 4:01 pm
Location: Nottingham UK

Re: MCF 5213 General Purpose Timers Input Clock Config

Post by gavinm »

Maybe I'm mis-understanding your question?

Is it any help to use the 5213 GPT Timer 16 bit counter clocked in Pulse Accumulator Mode by a "Pulse Accumulator" Clock (PACLK) which can be System Clock /128, or this divided by 256 or 65536.

Set this mode in Pulse Accumulator Control Register (GPTPACTL). See datasheet 18.6.15.
Gavin Murray
bbowden
Posts: 6
Joined: Tue Mar 23, 2010 8:58 am

Re: MCF 5213 General Purpose Timers Input Clock Config

Post by bbowden »

Gavin,

I looked at the pulse accumulator option but my problem there is that I don't have any external signal to apply to the PAI. Obviously, I could generate one with a DIO pin but from the MOD5213 Ref Manual:

18.7.1 Prescaler
The prescaler divides the module clock by 1 or 16. The PR[2:0] bits in GPTSCR2 select the prescaler
divisor.

That first sentence is the one I'm not clear about. It seems to say that I should be able to apply a divide by 16 to the module clock which would put the clock into the right freq range for me. The reason I read it this way is that many of the other timers seem to provide this method (/16) to increase the range available with the prescaler values.

Thanks,
Brett.
gavinm
Posts: 59
Joined: Wed Jun 04, 2008 4:01 pm
Location: Nottingham UK

Re: MCF 5213 General Purpose Timers Input Clock Config

Post by gavinm »

I don't have any external signal to apply to the PAI.
I don't think you need an external signal, can't you use PA Mode (PAMOD) to select the clock signal to be the System Clock /128?
The prescaler divides the module clock by 1 or 16. The PR[2:0] bits in GPTSCR2 select the prescaler
The "1 or 16" looks like a typo error to me.
According to the block diagram in 18.3 the prescale input is always System Clock /2. Then the "PR[2:0] bits in GPTSCR2" select the prescaler. Which allows pre-scale divisors of 1,2,4,8,16,32,64,128.

Or the other alternative counter clock source is the PA.

The 5213 has a PWM functional block - could that help?
Gavin Murray
bbowden
Posts: 6
Joined: Tue Mar 23, 2010 8:58 am

Re: MCF 5213 General Purpose Timers Input Clock Config

Post by bbowden »

Gavin,

I think you are right about the typo. So I am stuck with the fsys/128 or fsys/64/ or fsys/64/256 or fsys/64/65354. And in the case of the last three, figure out if I need to provide a PAI input to make the /64 clock run.

OR:

Use the PWM module. I think I'll do some reading on PWM.

Boy, for General Purpose timers, these things aren't very flexible.

By the way, I have already shifted my input pulse reading over to the DMA timers (MUCH!!! easier to use)

Thanks for the input.

Brett.
Post Reply