changes to spi code on both ends