Content originally posted in LPCWare by capiman on Thu Oct 10 08:06:19 MST 2013
Hi Elam,
just read 3 times 8 bits. Even when AD7793 (which i don't know) transmits 24 bits in one shot, the LPC will receive 3 times 8 bits in one shot.
Master creates the clock signal. There is no "framing" signal, which say that resulting data is really 24 bits or 3 times 8 bits.
Pay attention: The CS will be changed on start of command and CS goes back to idle at end of command.
What data is exchanged between, is not really relevant.
I have e.g. a SD card which sends me 512 bytes (1 sector full of data). I can read 512 times 8 bit. Or i can read 256 times 16 bits.
There are so many SPI devices, some use e.g. multiple fields, one after the another. LPC can't have each combination in hardware.
They only support certain transfer sizes and when you need more, you must just use multiple read/writes.
Pay attention that only when you send one byte, you will receive one byte.
If you want only read something from slave, you must send the same amount of dummy bytes.
Each sent byte will be producing x clock cycles on SPI. When you sent 1 bit, at the same time you receive 1 bit.
Best regards,
Martin