make the SPI code work in practice
Also corrected bugs in GPIO initialization