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.