I was trying to use a microcontroller's 16-bit IO port to interface with a parallel display. I found that the IOs of a single port (let's say PORTB) are highly fragmented around the microcontroller:
For example in the image above, PB0~PB2 are located at the bottom right, PB3~PB9 are located at the top left, and PB10~PB15 are located at the bottom right.
Here is another example of a PIC32MM:
This one is so chaotic you can't find 5 pins straight in a row!
And finally this one, Freescale Kinetis KL16:
This one has a few sets of pins straight in a row, but the ports themselves are not complete; a bit of PTA, a few pins of PTB, and so on.
The questions:
- I'm not familiar with the silicon underneath, but aren't the PORTS just a few MOSFETs and some other circuitry controlled from the signals (the bits) of a register? So physically, they should be in a row just like the register, or at least, not so chaotic that half the port is 1 cm away from the other half of it. Why are them designed like that?
- I think some manufacturers prefer the pinout to be compatible with peripherals (e.g. SPI) and to be close to each other because no one needs 16 pins in a row these days. But many of these microcontrollers have some kind of remappable peripheral IO, and aside from that, what's the problem of having an SPI IO straight as the main PORT IO, so we could retain the 16-pin compatibility?