Electrical – STM32F407VG Pin Assignment

cdigital-logicmicrocontrollerstm32stm32f4

I am new to the STM32 world. I am using [STM32F407VG]1 (100 Pins pkg). I have to select an 8-bit port for connecting 8 digital inputs to the MCU.. but the datasheet shows so many alternate as well as additional functions on each pin that I am confused as to which pins i should select. Is there any SOP about how to select appropriate pins when multiple options are available for pin assignment?

edit:

Regarding Alternate Functions on port pins.. for example TIM1/2 alternate functions can be assigned on Port A, B or E.. Are all assignments of Alternate Functions equal or is there any more preferable port for peripheral alternate functions.. as in the case of TIM1 are all the Port A, B or E assignments would be same in all respects or will there be any difference from one case to the other?

enter image description here

Best Answer

Work order in a professional project:

  • Determine what the product should do and write a spec.
  • Find out which external hardware that is needed. In particular, which serial buses do you need, how many ADC channels, how many PWM channels, how many GPIO etc. This should preferably be in the spec too.
  • Pick a MCU based on what you need. Not based on finding one on some hobbyist board or in a packet of corn flakes.

So the obvious answer to the question is then: pick GPIO from pins that aren't used by other hardware peripherals needed in your project. Port routing alternatives may be available.

Once that is sorted out, you should place pins related to the same external hardware the same GPIO port. For example if you need to scan 8 buttons, it will be wise to place all 8 in adjacent order on "port x".

And finally, if none of the above matters, pick pins that gives shortest paths/best layout on the PCB.