6.1.1 SPI_Config Command and its Response

The SPI_Config command (0x20) configures the SPI peripheral with the specified clock speed, SPI mode, chip-select and its active state, and the delays between chip-select assertion and the first data byte between the data bytes, and between the last data byte and de-assertion of the chip-select.

Note: An additional internal delay of approximately 6 μs (±2 μs) is always present, independent of the configured delay value. The total delay equals the configured Delay plus approximately 6 μs. This variance must be considered for timing-sensitive applications.

This command is sent through Endpoint 0x06 (OUT). The response is read through Endpoint 0x86 (IN).

Table 6-2. SPI_Config - Command
Byte IndexCommandDescription
00x20Command codeConfigures the SPI module
1

0x30

0x20

0x32

0x22

0x34

0x24

0x26

Speed: 12 MHz

6 MHz

3 MHz

1.5 MHz

750 kHz

375 kHz

187.5 kHz

SPI clock speed
2

0x44

0x45

0x46

0x47

Mode: 0

1

2

3

SPI mode
3

0x00

0x01

0x40

0x41

0x80

0x81

0xC0

0xC1

CS-ActStat:

CS0 active low

CS0 active high

CS1 active low

CS1 aActive high

CS2 active low

CS2 active high

CS3 active low

CS3 active high

Chip-select and its assertion state
4-5

0x0000

0x000A

0x0014

0x03E8

0x1388

Delay: 0 μs

10 μs

20 μs

...

1000 μs

...

5000 μs

Delay between:
  • Chip-select assertion and the first data byte
  • Between each data byte
  • The last data byte and chip-select de-assertion.
Table 6-3. SPI_Config - Response
Byte IndexResponseDescription
00x20Return command codeReturns whether the SPI_Config command code was accepted
10x20Accepted - successThe command is accepted
0x60Rejected – wrong parametersThe command is rejected because the parameters are invalid
0x64Rejected – SPI is busyThe command is rejected because the SPI module is busy
0x6CRejected – wrong CS pinThe command is rejected because the selected chip-select pin is not configured as a CS function. Configure the corresponding I/O pin as a chip-select pin and resend the command.