Page 1 of 1

MCF 5213 General Purpose Timers Input Clock Config

Posted: Tue Mar 23, 2010 9:05 am
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.

Re: MCF 5213 General Purpose Timers Input Clock Config

Posted: Tue Mar 23, 2010 9:54 am
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.

Re: MCF 5213 General Purpose Timers Input Clock Config

Posted: Tue Mar 23, 2010 10:02 am
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.

Re: MCF 5213 General Purpose Timers Input Clock Config

Posted: Tue Mar 23, 2010 10:32 am
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?

Re: MCF 5213 General Purpose Timers Input Clock Config

Posted: Tue Mar 23, 2010 11:04 am
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.