Requires U3 hardware version 1.21. Sends and receives serial data using SPI synchronous
communication.
• NumSPIWords: This is the number of SPI bytes divided by 2. If the number of SPI
bytes is odd, round up and add an extra zero to the packet.
• SPIOptions: If AutoCS is true, the CS line is automatically driven low during the SPI
communication and brought back high when done. If DisableDirConfig is true, this
function does not set the direction of the lines, whereas if it is false the lines are
configured as CS=output, CLK=output, MISO=input, and MOSI=output. SPIMode
specifies the standard SPI mode as discussed below.
• SPIClockFactor: Sets the frequency of the SPI clock according the following
approximate formula: Frequency = 1000000/(8+10*(256-SPIClockFactor), where
5.3.15 SPI
Command:
Byte
0 Checksum8
10xF8
2 4 + NumSPIWords
30x3A
4 Checksum16 (LSB)
5 Checksum16 (MSB)
6 SPIOptions
Bit 7: AutoCS
Bit 6: DisableDirConfig
Bits 1-0: SPIMode (0=A, 1=B, 2=C, 3=D)
7 SPIClockFactor
8 Reserved
9 CSPinNum
10 CLKPinNum
11 MISOPinNum
12 MOSIPinNum
13 NumSPIBytesToTransfer
14 SPIByte0
……
Response:
Byte
0 Checksum8
10xF8
2 1 + NumSPIWords
30x3A
4 Checksum16 (LSB)
5 Checksum16 (MSB)
6 Errorcode
7 NumSPIBytesTransferred
8 SPIByte0
……
106