GPIO Alternate Function Finder — InnovChip

GPIO Alternate Function Finder

Validate GPIO pin / alternate-function (AF) pairings on STM32. Check whether the AF number you configured matches the peripheral preset and the legal AF range.

Calculator

About This Calculator

Every STM32 GPIO pin can map to multiple peripherals through alternate functions (AF0-AF15). Mismatching the AF number is a classic silent bug — the pin is configured but the peripheral never connects. This tool validates that the AF value in your setup matches the documented preset for the target peripheral.

How to Use

  1. Select the port and pin you plan to use.
  2. Enter the AF value your firmware writes into the MODER/OSPEEDR/AFRL-register pair (or the HAL GPIO_Init Alternate field).
  3. Pick the peripheral preset — each fixture group shows a typical AF for reference (check your reference manual for the exact part).
  4. A score of 100 with 'AF Matches = 1' means the pairing is consistent.

Formulas

AF legal rangeAF valid = AF ≤ 15 ? 1 : 0
Match checkAF match = configured AF === preset AF ? 1 : 0
Compatibility scoreScore = 100 − |AF − preset| × 20 (0..100)

Design Notes

AF assignments are part-specific. The presets above are common families; always verify against the datasheet AF table for your exact STM32 part.

Many pins have multiple AF options. A valid AF that is not the preset may still work — verify the pinout table, not just the range.