Why do you call SPI.endTransaction()? You never called SPI.beginTransaction(), so there is no transaction to end.