STM32 gotchas
67.Where are GPIO AF numbers given for individual pins? And where are the NVIC registers described?

Users are often confused by the way how STM32 documentation is organized. This is partially caused by the fact, that the processor core - ARM Cortex_M series - is not an ST product. It's just one of the modules ("intellectual property", IP) from which the chip is "assembled", and the documentation for it comes from ARM (the company). They provide a boilerplate template for all their licencees, who are supposed to generate a customized version of it, as the core can be "configured" (e.g. the floating-point unit in Cortex-M4 and Cortex-M7 is optional, Cortex-M7 can optionally have a double-precision FPU, etc.). In the STM32 world, these come as Programming Manuals (PM), e.g. PM0214 for STM32 with Cortex-M4 core.

One of the peripherals, which is described in these Programming Manuals is the interrupt module, NVIC, as it is part of the processor core as provided by ARM. However, PM describes only the general working of NVIC, not the individual signals - i.e. the interrupt lines - which come from the rest of the chip to the NVIC. In other words, for the particular number of individual interrupt sources you have to look elsewhere - namely into the Interrupts chapter of Reference Manual (RM).

Reference Manual is the largest document of the whole collection, which describes the detailed working of the individual modules, and also the working of the chip as a whole. It is usually common to a whole sub-family of STM32, for example, RM0090 pertains to 'F405/407/415/417/427/429/437/439.

Most STM32 (the ancient 'F1 being the notable exception) have a (sparse) matrix between physical pins and individual modules' IO signals. This is being programmed in the GPIO module, after setting given pin to Alternate Function, by setting the appropriate function number into the GPIO_AFR field assigned to the pin. While this general mechanism is described in the GPIO chapter of RM, the particular numbers assigning the particular functions are not described there. So where are they?

This information can be found in the "Alternate function mapping" table in Datasheet (DS). Datasheets contain particular information for several memory-size and package options of one individual STM32 model, or a very small group of models. In the DS, after an introductory overview, and table of memory/peripherals/package arrangement for individual modes, a very general overview of peripherals is given. That is followed by the pinout table and mentioned AF table, then an extensive chapter with electrical characteristics follows, and finally package drawings and numbering/ordering information is given.

The fourth member of the "canonical" set of documents is Errata Sheet (ES), again individual to a small group of STM32 models.

This set of documents (PM/RM/DS/ES) is then augmented by Application Notes (AN), Technical Notes (TN), and various marketing materials. All these are usually listed in the given STM32 model's web-folder.

On the "upper end", the information given in the PM is expanded by ARM's documents (to be found on ARM's webpage) - Technical Reference Manual (TRM) to given Cortex-M core (with accompanying Errata), and the broader Architecture Reference Manual (ARM) to the given ARM architecture version and variant.