0

I've noticed that according to the datasheet and reference manual in those microcontrollers is 128 bytes for GPIOG (for example).

0x4002 1800 - 0x4002 1BFF GPIOG (From datasheet)

My question is: why 128 bytes (1024 bits)? All GPIOG registers only take 40 bytes. Thanks.

glts
  • 21,808
  • 12
  • 73
  • 94
  • 1
    Perhaps it is for future expansion. And it is convenient for the MPU to "map out" memory of a size that is power-of-2. – Weather Vane Feb 28 '15 at 20:40

1 Answers1

0

It's almost certainly for efficient internal addressing so that the MCU can determine the port by looking at bits 11-14 of the offset from AHB1PERIPH_BASE.

Bit operations inside an MCU are the most trivial and therefore efficient operation. By comparison, decimal arithmetic requires many sequential logic operations and is much more expensive.

If you're really interested in how this stuff works then I'd recommend getting hold of an FPGA development kit and trying out some simple examples.

Andy Brown
  • 11,766
  • 2
  • 42
  • 61