so a tiny update while I wait for the new SPI based boards to arrive...
I hacked one of the I2C boards to have the SPI chips on them (they are mostly the same but obviously take SPI signals instead of I2C, so 2 pins have to be re-routed and 2 new pins have to be connected PER CHIP) by dropping the header socket connections out of the socket, and wiring the appropriate SPI header lines to connect with the correct (former) I2C positions, and wiring new jumps from the SPI header pins to the chips legs directly. Quite a task on fine pitch SSOP chips I can tell you!
anyway the result is a working (if fragile) SPI version of GBCartSlurp.
so on to the software... I can get the SPI chips to read and write without an intermediate library like wiring pi but one of the speedups I did on the I2C version was that I could make use of "Sequential" mode where I could write 2 bytes per chip (for the address data) in one command, reducing some of the overhead per transfer.
(the operation to read one byte of data off the cartridge looks something like:
Code: Select all
* Write the address data out to the address bus (2 bytes - chip 1, ports 1 and 2)
*Set the apropriate read/write lines (1 byte - chip 2, port 2)
*read the state of the data lines (1 byte - chip 2, port 1)
*revert the control lines back to rest (1 byte - chip 2, port 2)
each of those is one command sent to the port expander chips PER BYTE.
so sequential mode lets me send 2 bytes to the address bus with only the overhead of one byte command.
This works well on I2C and it gave me a small speed increase pretty much for free.
However for SPI it doesn't seem to work despite me following every documented reference I can find to it to the letter...
(this is in a test program which was explicitly written to exercise this feature.) I have lights go on for the first byte, but the second one is always dropped.
*BUMMER!!*
So testing continues, but I may have to forget about sequential mode. fortunately the SPI command set overhead isn't as much as it is on the I2C version so it may not matter if the overall speed increase is significant...