5
\$\begingroup\$

As I understand, the internal timer clock source on the STM32(F4) microcontrollers can be either APB1 or APB2. However, I can't find which timers get which clock.

I already found ST AN4013, which explains almost everything about the timers, but not their respective internal clock source.

Does anyone know, or have a source for, exactly which clock each timer uses?

\$\endgroup\$
8
  • 4
    \$\begingroup\$ The timer mappings are clearly shown in the STM32F4 data sheet in the block diagram. \$\endgroup\$
    – Majenko
    Jun 15, 2014 at 13:47
  • \$\begingroup\$ Why, thank you, I had the feeling I've seen this before but didn't think to look in the data sheet :) \$\endgroup\$
    – Pezo
    Jun 15, 2014 at 13:54
  • 1
    \$\begingroup\$ First port of call should always be the device data sheet. If it can't be found there it'll probably tell you where to look. \$\endgroup\$
    – Majenko
    Jun 15, 2014 at 13:55
  • 1
    \$\begingroup\$ I usually know that, but I just forgot about it because all programming related things are in the reference manual, not the data sheet. \$\endgroup\$
    – Pezo
    Jun 15, 2014 at 14:00
  • 1
    \$\begingroup\$ It's not really a programming thing though is it? The internal connections of the chip are a chip specific thing, but the workings of the peripherals themselves is a family thing. Same timers in different chips could be connected differently, but the programming of them remains the same. \$\endgroup\$
    – Majenko
    Jun 15, 2014 at 14:02

2 Answers 2

3
\$\begingroup\$

The ST's Application Note you linked is just a generic description, not everything. The hardware detail is differ from each MCU models. ANs will only tell you overall idea. So you need to look at documents specifically written for each MCU model.

As the comments mentioned, when you work with peripherals of STM32 you will mostly need to look at two documents (as you didn't specified the MCU model I will give you example of STM32F407):

  1. Datasheet

It is a brief description of the hardware. Since APB1 and APB2 are related with bus, the things you want is described in memory map section (aka. section 4 Memory Mapping)

  1. Reference Manual

It is very detailed (1749 pages!) description of the MCU. When you look at Timers in this manual you will realize there is a lot more stuff than the AN. Anyway this document also desribes memory map. (Section 2.3)

Note) Even though STM32 HAL API abstracts hardware detail you still need to know which APBs are connected to Timers you are using. For example, all peripherals shares common APB bus clocks. This means that if you change a clock setting of APB1, clocks of all peripherals connected to APB1, including Timers, will be changed as well. This might lead to unexpected timing changes of other unexpected Timers.

\$\endgroup\$
-2
\$\begingroup\$

For example: MCU STM32F412 Document RM0090 "Memory and bus architecture" page 64 Table 1. STM32F4xx register boundary addresses

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.