-1

I want to build a project with an STM32G070.

I need a couple of PWM pins.

I look at the datasheet and user manual, and I cannot find anywhere if all pins of if only some are PWM capable and so, which one it is.

I want to know because, if I look at the BluePill, not all pins are PWM.

Can Anyone guide me ?

6
  • PWM functionality is carried out by timers on the STM32. So look at the reference manual and look at the timers. Most of them have one or more channels that can do PWM output on a pin. Commented Feb 5, 2023 at 18:26
  • 1
    Also look at table 12 in the datasheet. Check out the alternate functions of the pins. Any one that says TIMx_CHy is a pin that could be used for PWM. Commented Feb 5, 2023 at 18:29
  • Thank. I have seen about PWM into timer section but I did not understand the relation with TIMx_CHy. Also to complete information, some pin a also mark with a N ( TIM1_CH1N ). Is that PWM PWM too? Commented Feb 5, 2023 at 19:20
  • Yes, some channels have positive and negative PWM outputs. The N version is just the logical NOT of the regular version, I think. (I've never used it.) Commented Feb 5, 2023 at 19:39
  • 1
    Each pin can only have one timer channel. And each timer channel should be assigned to one pin. If you want multiple PWM outputs at the same frequency but with different duty-cycles, that is why there are multiple channels per timer. Commented Feb 6, 2023 at 7:37

1 Answer 1

0

To answer the question - no, not all pins can be configured for PWM. However, most STM32s (including the STM32G070) have multiple timers, many with multiple channels which can generate PWM signals, and these can be mapped to many pins. So it's almost guaranteed that you'll find two spare pins that are not used by other peripherals, that you can use for PWM.

As mentioned, PWM signals are generated by timers. You can consult the reference manual for the STM32G070 to see which timers are available, and which ones have channels that can generate PWM signals. And you can reference the datasheet to see which pins they can be mapped to.

If I was designing a board, I'd create (e.g. in STM32CubeIDE) the crucial peripherals first (e.g. any SPI, I2C, UARTs, etc.) Then I'd see which pins are left over that could be used for PWM. There are bound to be several.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

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

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.