Hello, I have difficulty communicating a SPI RFID reader with Arduino.
In order to make the reader work, every time I need to send a command consisting of several bytes of data, e.g. CC 02 01 03. The returned message should look like BB 08 01 48 59 35 30 32 42 6F.
I looked through the SPI library in Arduino.cc. The major function is spi.transfer(). However, it sends 1 byte of data and reads back 1 byte of data every time. It may be ok to send the data by calling transfer() several times, e.g.
it sends 1 byte of data and reads back 1 byte of data every time
No just keep on sending it as many bytes as you need, then keep on reading as many bytes as it sends.
These are two routines I use to read and write to a 23S17 port expander. You will see on the read, I write two bytes to it and read back one. On the write I just write three bytes.