[STM32F401CE/G30TH] alt functions

Discussion and questions about boards that can run MicroPython but don't have a dedicated forum.
Target audience: Everyone interested in running MicroPython on other hardware.
Post Reply
User avatar
jgriessen
Posts: 191
Joined: Mon Sep 29, 2014 4:20 pm
Contact:

[STM32F401CE/G30TH] alt functions

Post by jgriessen » Sat Nov 18, 2017 9:31 pm

I'm reading the ref manual, datasheet and programming manual of STM32F401CE and run across this:
GPIO port mode register (GPIOx_MODER) (x = A..E and H) ------------------------------------------> A..E and H correspond to ports not pins, right?

and

Bits 2y:2y+1 MODERy[1:0]: Port x configuration bits (y = 0..15)
These bits are written by software to configure the I/O direction mode. ------------------------------------------> this also suggests a per port function, where each port has this range of registers.

So, when I am planning which pins to use as alt functions, Ineed to consider that all of the ppins for a port range change to one alt function, not individually, right?

Thanks for confirming my reading of the manuals.
John Griessen blog.kitmatic.com

User avatar
dhylands
Posts: 3821
Joined: Mon Jan 06, 2014 6:08 pm
Location: Peachland, BC, Canada
Contact:

Re: [STM32F401CE/G30TH] alt functions

Post by dhylands » Mon Nov 20, 2017 6:52 pm

Each port has a separate GPIO_MODER register. A single MODER register can change the mode for each of the pins associated with that port. So each pin is independent.

The GPIOx_AFRL/GPIOx_AFRH registers (also available for each port) control the alternate function for each pin, when the GPIOx_MODER for a pin is set to alternate function mode.

So each pin on a port can have individual alternate functions.

Post Reply