Forgive me if this question has already been answered, but I was unable to find an answer either on this page or in the wider Internet.
I'm an experienced developer with decent knowledge regarding low-level programming, but relatively new to embedded development. I've been teaching myself embedded systems development using an ST-NUCLEO144 board, which features an STM32F746ZG MCU. One question that seems non-obvious to me is that why logically related bit fields in a register may be in different locations.
One example is the
USART_CR1 register on the STM32746ZG. The
M1 bit fields together control the word length in USART TX/RX, a combined 2-bit value of
0b00 specifies 8-bits,
0b01 specifies 9-bits, etc. This is all quite straightforward, except that
M0 is at bit 12 and
M1 is at bit 28... why is this?
Is this for legacy design reasons, such as a new feature was inserted into previously reserved space? Is it for reasons related to the chip design, that I'm not considering, or is there a greater purpose to this that I'm not seeing?
Obviously this is pretty trivial to overcome with bit-masking, but I'm just curious.