vblocs:
Yes, it works byte by byte, but i try to use SPI.transfer(array, size) function.
one possible reason why that function is not working here is that it is too quick. if you had a look at Nick's example, in the 'transferAndWait' function there is a small delay to give the slave enough time to process.
you could implement a similar function but takes in an array instead; something like this maybe (UNTESTED!):
void transferAndWait (byte *arr, uint8_t size)
{
uint8_t i = 0;
byte a = SPI.transfer (arr[i]);
delayMicroseconds (20);
for (i = 0; i < size - 1; ++i) {
arr[i] = SPI.transfer (arr[i + 1]);
delayMicroseconds (20);
}
arr[i] = SPI.transfer (0x00);
} // end of transferAndWait
But, how to use one shot : SPI.transfer(datas,size) and get slave datas ?
I post a very simple example. But in my case, I send command and parameters : [commandType, paramA, paramB]
and slave return values.
I just explained to you why the 'standard' function may not work for your case and provided you with a custom function based on nick's example that would do the the same thing (ie take in an array)....
please try the custom function and see if it works for you!