SPI vs. shiftOut advantages and disadvantages

I have 3 serial peripherals max7219 and 2 - 74595 devices what are the

advantages and disadvantages of SPI vs. shiftOut ?

Thanks

The big advantage of SPI, provided you are using more than one device, is the fact that it is an addressable bus - you can hang multiple peripheral devices off of the same lines, and communicate with each of them (as long as you supply each one with a chip-select line - I2C, however, doesn't need such lines for addressing; so it uses less lines, but is a slower bus from what I have read).

I think I have also seen designs where people have hung a shift register off the SPI lines and clocked it just the same...?

If you are are only driving a single device, there may not be much difference between the two except possibly speed and reliability of bit transmission at higher speeds (but I really don't know this for certain).

Maybe others can shed more light on this subject...

:slight_smile:

there may not be much difference between the two except possibly speed and reliability of bit transmission at higher speeds (but I really don't know this for certain).

my 32x32 matrix is using the atmega spi hardware, clocking out at 9.5mhz while updating a software screenbuffer and reading a bitmap :sunglasses:

so yes its faster for basic stuff without a bus, just depends if you need it or not

and as long as your using components that can deal with ~20 mhz it should be good

SPI was much faster than ShiftOut when this user measured them last summer. Probably still is (though it's possible that someone did some speed improvements to the libraries since then).

Using shiftOut allows you to do certain kinds of "cheating" that can be useful and/or time-saving for certain applications. The 74595s are not just shift registers: they're shift registers plus latches. So you can do things like clearing the shift registers (i.e., do some shiftOut calls with zeros) during startup, then loading in a single 1 bit and percolating it through all the outputs by "manually" toggling the shift and load pins. You could use that to generate the "digit select" outputs for multiplexed LEDs. Or you could create "chase lights" by clocking in a 1 bit every 3rd or 4th cycle, or loading some other pattern one bit at a time.

With an SPI interface, you'd probably need to load the entire string of registers every cycle.

Very helpful as always!

Thanks Guys