Skip to content

BluePill PWM Generation Example Code Not Working #891

Answered by chris-durand
StevenMacias asked this question in Q&A
Discussion options

You must be logged in to vote

It was totally non-obvious for me at first but I think I have found it after digging through the reference manual and the modm GPIO source code. My first suspicion was right that this has to do with the odd F1 pin remapping design.

On all STM32 devices except F1 there is only one alternate function mode for both inputs and outputs. The pin direction is controlled by the peripheral.

On STM32F1 you have to manually select whether your alternate function pin is an input or output:

For input alternate functions standard input mode has to be selected.

In case of the timer the modm API has no way to tell which one you want by writing Timer4::connect<GpioB7::Ch2>(); since the timer pin can be e…

Replies: 6 comments

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Answer selected by StevenMacias
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
3 participants
Converted from issue

This discussion was converted from issue #888 on July 26, 2022 14:57.