Important changes to forums and questions
All forums and questions are now archived. To start a new conversation or read the latest updates go to forums.mbed.com.
9 years, 7 months ago.
What Timer is used?
Hi, It's becoming very frustrating to write programs on mbed. I really want to use it but the details of the hardware are so hidden and you have to program blindly. I feel I have no control on my uC. That is awful! For instance, when trying to use the library for "Timer", I don't see a way to know which timer I'm actually using (my uC has several timers). What if I want to use many of the timers.....I don't see a way of selecting which ones I'd like to use. Am I missing something? I browsed the site but as far as I can get is the definition of the classes.
Question relating to:
1 Answer
9 years, 7 months ago.
You can make as many Timer objects as you want, they all run on a single physical timer. While I don't think an overview per target which resources are used would be bad, one of the main ideas if of course that you don't need that.
The source code can be found here: http://developer.mbed.org/users/mbed_official/code/mbed-src/. The timer code is somewhere in targets/hal/freescale/[KLxx/KSDK]/us_ticker_api.c. And to answer it directly, The K64F uses four PIT timers for Timer/Ticker objects (Freescale MCUs aren't very efficient at implementing this, most NXP ones use a single timer for example), the KL46 uses two PIT timers and the LPTMR (PIT for Timer, LPTMR for ticker).