What state is the port pin in between GPIO MODER changes and GPIO AFR changes?
Consider: The pins are ultimately driving Power Mosfets, wherein the state of the outputs is of significant importance.
However, between the time when one changes the MODER register(s) for the appropriate pin(s) to AF and the time when one changes the AFR register(s), the pins are apparently in UNPREDICTABLE/UNCONTROLLABLE states!?
The answer seems to be to initialize the (alternate function) peripheral FIRST - putting it's 'outputs' into a known state, and THEN changing the AFR registers FIRST and then changing the MODER registers.
HOWEVER, ST documentation/code found indicates that MODER should be done BEFORE AFR ... WHY???