3
\$\begingroup\$

I've tried setting TIM5 as a timebase timer with an interrupt, when the compiler gave me the following error:

39: error: 'TIM5_IRQn' undeclared (first use in this function)

Than I though I'll search for this definition in stm32f10x.h , and I noticed this:

#ifdef STM32F10X_HD
...
TIM5_IRQn = 50,     /*!< TIM5 global Interrupt  */
...

I guess this means that my device, which is Medium Density, doesn't have a TIM5 interrupt. Does that mean the device doesn't have TIM5 peripheral at all ?

The only reference I have found about this is in the medium density datasheet "features" page which states:

"Three 16-bit timers..." - I assume these are TIM2/3/4

"16-bit, motor control pwm timer..." - I assume this is TIM1

Here is a bit from the Reference Manual (RM0008):

RM0008

This is so confusing, according to this table you'd think TIM5 and TIM8 are available.

How can I tell what other peripherals am I missing in my Medium Density device ?

\$\endgroup\$

2 Answers 2

4
\$\begingroup\$

It doesn't seem to be spelled out very well, but you can look at the STM32F103x8/STM32F103xB datasheet:

Page 11 contains a diagram showing the peripherals available.

Section 2.3.15 Timers and watchdogs shows the timers available.

You will need to consult either the diagram on page 11 or the section specific to the type of peripheral you are looking at.

TIM5 and TIM8 are not available on your device.

Timers available are TIM1, TIM2, TIM3 and TIM4.

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

RM0008 is the Reference Manual for five different families of STM32F, specifically "STM32F101xx, STM32F102xx, STM32F103xx, STM32F105xx and STM32F107xx"

It explains the features of all of the different peripherals on those families of parts. It is not definitive on the combinations of peripherals on any specific part.

The exact combination of peripherals for any part is given in the parts datasheet.

On page 10 of the STM32F103x*/STM32F103xB datasheet, there is "Table 2. STM32F103xx medium-density device features and peripheral counts".

Table 2 enumerates every peripheral on each unique part defined in the datasheet.

The basic rule is, for identical peripherals, the numbering of the peripherals starts at the first available peripheral. This is made more complex by using the name 'TIMn' for several distinctly different types of timer. RM0008 is slightly helpful because the title of each timer peripheral's chapter gives the names of the timers it apples to.

Table 2 shows STM32F103x8 and STM32F103xB have exactly the same set of peripherals. As Tut explained Table 4 identifies which timers are available, and their names. The datasheets for more recent STM32F families usually have that table for timers somewhere in the datasheet.

When I am comparing STM32 devices, I start with Table 2 in each datasheet. That seems to be reliable.

However simply knowing that a device has a peripheral is not enough. It is common for peripherals to be available on more than one group of pins. But it is possible, on parts with a small number of pins, that all of the peripherals I need are not all available on pins. It is possible that their is enough conflict between peripherals for pins that some peripherals can not be fully connected to the outside world.

When I am designing something, I compile a table of pins vs peripherals in a spreadsheet. Then I can check to see that everything I need is available.

ST do provide a tool called STM32CubeMX which claims to help select and configure peripherals. I haven't used it, but it might help make it clearer which peripherals are on board, and which features are available on pins.

However STM32F1 are not currently supported by STM32CubeMX.

\$\endgroup\$
3
  • \$\begingroup\$ Unfortunately the STM32CubeMX doesn't support the STM32F1 series. \$\endgroup\$
    – Mike
    Commented Aug 27, 2014 at 16:59
  • 1
    \$\begingroup\$ @Mike - I apologise :-( I'll update my answer to reflect that. \$\endgroup\$
    – gbulmer
    Commented Aug 27, 2014 at 17:18
  • \$\begingroup\$ And now it does :) \$\endgroup\$
    – Mike
    Commented Jan 5, 2016 at 8:05

Your Answer

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

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