Go Down

Topic: 4 byte data transfer with DUE's SPI.  (Read 138 times) previous topic - next topic

EJLED

Hi, I am using SPI library.

how to send 4 byte data to SPI slave device using DUE's SPI.

i have read that SPI library transfers only 1 byte data at a time.

Thanks

weird_dave

https://www.arduino.cc/en/Reference.SPITransfer
Read the 3rd syntax:
"SPI.transfer(buffer, size)"

EJLED

Its for 16 bit value 2 Byte value. i want to transfer 32 bit. SAM3x8E is 32 bit controller so i think it may be possible.

weird_dave

No, you can transfer many bytes, I'm sending hundreds, read it again.

EJLED

i read it , u sending hundreds byte at what rate. how much time it will take to send hundreds bytes data from master to slave?

weird_dave

100 bytes in about 50us, but it took some effort to get it that fast. It's possible to do it in under 20us.
Have a look at this thread and ignore the Ethernet aspect of it:
https://forum.arduino.cc/index.php?topic=437243.0

Since then, I have increased one of my SPI packet sizes to 744 bytes, it takes less than 400us (I'm not using turbo SPI, just the standard library).

Go Up