STM32 gotchas
1. Peripheral clock must be enabled in RCC

This is a common feature for all 32-bitters - to control consumption, clocks to most peripherals are gated and have to be enabled individually.

In STM32, this happens in the RCC module (RCC does not have a clock gate so is available all the time). The vast majority of modules' clock is disabled after reset, see the individual RCC_AHBxENR/RCC_APBxENR registers' description in the respective Reference Manual (RM).

Using a module without enabling its clock, is a quite common mistake when programming STM32. However, it can be easily detected when debugging: if a module's clock is not enabled, all of its registers read as zero1, 2, and they can't be written.

See also gotcha 183: After enabling clock in RCC, delay may be needed before accessing some peripherals, gotcha 184: How to enable DMAMUX clock, gotcha 185: What's kernel clock ?, gotcha 186: On kernel clocks, which are not selected/enabled in RCC, gotcha 187: Some clock enables are tied to some other peripheral, gotcha 188: Some peripherals don't have clock enable at all, gotcha 189: Some peripherals have clock enabled by default, gotcha 190: Some peripherals have clock enable bit named confusingly.


1. Not necessarily zero, although apparently that is the most usual case.
STM32 forum user MMust.5 noticed, that when reading GPIOA and GPIOB registers after reset in STM32F407, before enabling GPIOA/GPIOB clock in RCC, all GPIOA registers return 0xA800'0000 and all GPIOB registers return 0x0000'0280. These are the reset values of the GPIOA_MODER and GPIOB_MODER registers, respectively.
Experimentation on STM32L476 revealed, that after enabling GPIOA clock, manipulating then reading out any GPIOA register, and disabling GPIOA clock, subsequently reading any GPIOA register returns the value of the register which was last read, but not that read value, but its value at the moment when GPIOA clock was disabled (this was tested on GPIOA->IDR: it was read once while clock enabled, then externally one of the GPIOA was pulled to the opposite polarity, then clock was disabled, and the value which is then returned for all GPIO registers reflects the grounded pin, not the value last read from IDR). So, the APB read interface of GPIOA probably consists of an input latch, which latches the read address, and an output latch, which upon each APB clock (gated by the enable bit in RCC) latches content of the addressed internal register.
This all is an entirely useless information, though, as there is no practical use of it, and also this arrangement may be entirely different for other peripherals or for GPIOx in other STM32 families. In fact, users are not supposed to read/write to disabled peripherals. Some families' RM (e.g. for 'G0) use the following warning: When the peripheral clock is not active, the peripheral registers read or write accesses are not supported. The 'H7 RM has the following: When the bus interface clock is not active, read or write accesses to the peripheral registers are not supported. A read access will return invalid data. A write access will be ignored and will not create any bus errors.

2. Some peripherals appear to have an even more complex access scheme than described in footnote 1. Here's an example:
In STM32F427, PWR has two registers, CR and CSR. After the first powerup, they read 0xC000 and 0x0000 respectively (the set bits are PWR_CR.VOS being set to Scale 1 which is the reset default). After enabling PWR clock in RCC, this reading does not change, but this step allows us to set PWR_CR.DBP (enabling access to backup domain) and also set PWR_CSR.BRE (which is enable of the low-power LDO of the Backup SRAM, which maintains its content while in VBAT mode). After this, PWR registers read as 0xC100 and 0x0208, the extra bit which reads set is bit 3 in PWR_CSR, PWR_CSR.BRR, which is the bit indicating that the low-power LDO works.
Now if we perform a "pushbutton" reset without a power cycle (i.e. we reset PWR clock in RCC, but we retain the backup-domain bits setting - namely PWR_CSR.BRE here), PWR registers read as 0xC100 and 0x0200, i.e. PWR_CSR.BRE can be read, but PWR_CSR.BRR not. After enabling PWR clock in RCC, PWR registers read as 0xC000 and 0x0208.
Corollary is, that reading a peripheral which does not have clock enabled in RCC, does not result in zeroes, but in possibly surprising values.