Generic SPI
The controller can communicate with external devices via this SPI interface, e.g. port expanders or displays. The corresponding pins are only available with product variants PD1-…-OF-….
Note: The used SPI peripheral must support a clock frequency of at least 164 KHz.
The settings of the SPI interface are located in object 3273h:01h (Generic SPI Hardware Configuration):
- Bit 0 (Clock Phase):
- Value = "0": Data transfer begins with the first clock edge after Chip Select was pulled to low.
- Value = "1": Data transfer begins with the second clock edge after Chip Select was pulled to low.
- Bit 1 (Clock Polarity): With this bit, you can invert the polarity of the clock signal. The value 0 means the level remains on Low if the clock is idling.
- Bits 2 to 4 (baud rate): You set the clock frequency here:
- 000b: 21 MHz
- 001b: 10.5 MHz
- 010b: 5.25 MHz
- 011b: 2625 KHz
- 100b: 1312.5 KHz
- 101b: 656.25 KHz
- 110b: 328.125 KHz
- 111b: 164.0625 KHz
- Bit 10 (CS Polarity): With this bit, you can invert the polarity of the Chip Select. Value 0 means that the level remains on High if the signal is idling.
The data are sent/received via the following objects:
- 3274h (Generic SPI Mosi Data):
- Subindex 1 to 1Fh (Generic SPI Mosi Data Byte #1 to #31): You write the data that are to be sent here, divided into up to 31 bytes.
- Subindex 0 (Length of SPI message to be sent): Then enter the number of bytes here (= subindicies) that are to be sent. In the next millisecond cycle, the data are sent and the subindex is reset to the value "0".
- 3275h (Generic SPI Miso Data): You read the received data here.
- Subindex 0 (Length of received SPI message): The value tells you how many data bytes (= subindices) were received.
- Subindex 1 to 1Fh (Generic SPI Miso Data Byte #1 to #31): The data that were received are located here.