custom timer

27 Nov 2010

I want to make my own timer that runs at a specific frequency that I specify. How can I do this?

27 Nov 2010

Or would it be possible to change the frequency at which the Timer and RTC run at?

27 Nov 2010

Maybe you could explain in a little more detail what you are tring to do. One line descriptions doesn't really tell us what we need to give an answer

27 Nov 2010 . Edited: 27 Nov 2010

I just want to run a timer to count the amount of microseconds that have passed since the mbed's last reset and I want to know exactly how to set the frequency of the timer to be 72MHz.

27 Nov 2010

if you want to know the "time since" with a resolution to the microsecond why do you need the timer to run at 72MHz? The standard Mbed library Timer will give you time since to microsecond level up to 30mins.

Since the CPU clock is 96MHz and the PCLK provided to peripherals is a division of this, 1, 2, 4 or 8, I'm not sure you can clock a timer at exactly 72MHz without some sort of external clock and using a timer as a counter. However, from the manual:-

When Counter Mode is chosen as a mode of operation, the CAP input (selected by the
CTCR bits 3:2) is sampled on every rising edge of the PCLK clock. After comparing two
consecutive samples of this CAP input, one of the following four events is recognized:
rising edge, falling edge, either of edges or no changes in the level of the selected CAP
input. Only if the identified event occurs and the event corresponds to the one selected by
bits 1:0 in the CTCR register, will the Timer Counter register be incremented.

Given that the input is sampled at the PCLK frequency I can't see how you are going to clock it at that speed. Maybe someone else can step up and confirm that (or correct it).





29 Nov 2010

Thanks, but there has to be some way to run it at 72MHz. Also, how exactly does the timer count in microseconds? When I use a timer it counts way faster than microseconds.