An Overview of how PWM pins are allocated on STM32H7

Overview

This port of RRF uses a combination of Hardware and Software PWM control.

Hardware PWM

Each hardware timer can handle up to four pins. If more than one pin maps to a timer then the 2nd,3rd.4th can only use hardware PWM if the frequency matches. The hardware PWM is only allocated the first time that PWM is actually needed (so essentially the first time that an output is set to something that is not full on/off).

Software PWM

If it doesn’t use the same frequecy, it will instead be controlled as a software PWM. There are a maximum of 16 software PWM channels.
Software PWM uses a single 1MHz timer. Software PWM uses MCU resources and does not work well for higher PWM frequencies. Anything above about 4KHz will have a reduction in the resolution and there is a minium delta (which is complicated, but basically means that any pulse that has an on time or off time of less than 20uS will be set to just full off/on). This mainly impacts higher frequencies.

Current Limitations

The hardware of the STM32 MCU limits which pins can be used with which timers. At the moment, this port has a limitation that means we have to pre-allocate the pins to a timer, so basically there is only one timer for each pin. It is planned for the future that we will be able to remove that restriction, but it is there at the moment.

Pin Number Timer
A.0 Timer 2
A.1 Timer 15
A.2 Timer 15
A.3 Timer 2
A.5 Timer 8
A.6 Timer 13
A.7 Timer 14
A.15 Timer 2
B.0 Timer 3
B.1 Timer 3
B.3 Timer 2
B.4 Timer 3
B.5 Timer 3
B.6 Timer 16
B.7 Timer 17
B.8 Timer 16
B.9 Timer 17
B.10 Timer 2
B.11 Timer 2
B.14 Timer 12
B.15 Timer 12
C.6 Timer 3
C.7 Timer 8
C.8 Timer 8
C.9 Timer 8
D.12 Timer 4
D.13 Timer 4
D.14 Timer 4
D.15 Timer 4
E.4 Timer 15
E.5 Timer 15
E.6 Timer 15
F.6 Timer 16
F.7 Timer 17
F.8 Timer 13
F.9 Timer 14