On Tue, 27 Dec 2022 at 13:32, Douglas Miller <
durga...@gmail.com> wrote:
>
> I'm not sure about the original engineers design decisions, but it turns out with modern SPI devices that CSIO is not all that practical - the order bits are shifted is wrong for most SPI devices, like SDCards. That means every byte sent/received has to be bit-reversed in software. Modern SPI device protocols are not very conducive to use of DMA, either.
CSIO is fine for some SPI modes (it can't do the timing for all of
them) and the bit order is irrelevant because the CPU can reverse
order the byte faster than the CSIO can send the previous one. You've
got over a hundred clocks to do the bit reverse so you don't even need
a lookup table.
> If the original intent of CSIO was to interface to low-level hardware - like JTAG, I2C, etc - it was probably not considered necessary to add DMA. Also, I'm not sure what limitations the Z180 DMA engine has, and if adding another channel to support CSIO was even possible.
CSIO was intended to interface to other CSIO devices. At the time it
was designed SPI wasn't really a thing the way it is today. What SPI
there was also usually ran slowly and had low data volumes. The "stuff
things down one wire very fast" mindset, the needed drivers and
routing are a very much more modern thing. Even devices like the
68HC11 and 683xx that had SPI on board didn't have DMA for it because
the mindset of the time was "go wide to go fast" for bulk data and SPI
drove clocks, sensors and the like.
The second reason you often didn't see DMA on an SPI master is that if
your SPI is slow you don't need it, and if your SPI is fast relative
to the CPU it didn't help either. Slow SPI was handled by interrupt,
fast SPI the overhead of setting up DMA for a typical message would
exceed the benefits of just polling, and because SPI is master-clocked
there is no risk of missed bytes unlike serial. In fact at speed it's
the SPI slave that needs DMA or a FIFO buffer.
Alan