10.3.1 SPI Data Transfer Modes |
These modes allow the transfer of arbitrary data, under program control, via the SPI Modules.
To transmit data unidirectionally to an SPI Slave Device, use SpiAPITransmit.
To transmit a request to, and then receive a response from, an SPI Slave Device, use SpiAPITransceive.
In both cases, SpiModuleOutputSource must be set to DataSourceSpi.
Note in particular that DataSourceSpi is strictly necessary, and the only option, for bi-directional communication via SPI under program control.
Programming examples for this mode are shown in 10.3.2 SPI Programming using the SpiAPI.
To transmit data contained in a list command, call CommandListAppendSpiWrite to add the PERIPHERAL_SPI command, along with a suitable data-payload, to a CommandList.
The data will be transmitted to the SPI Slave Device when the PERIPHERAL_SPI command is executed.
In this case, SpiModuleOutputSource must be set to DataSourceSpiListCommand.
Programming examples for this mode are shown in 10.3.3 SPI Programming via CommandLists.
Return Channel Data mode (RCD Mode
) is used to output a scanhead's Return Channel Data stream via an SPI Module, thus allowing an SPI Slave Device to monitor the return channel data.
RCD Mode is enabled by setting SpiModuleOutputSource to DataSourceScannerCommunication.
A programming example for this mode is shown in 10.3.4 SPI Programming for Scanner Data Monitoring.
The SPI module transmits three 32-bit DWORDs containing the scanhead return channels X, Y, and Z, and some additional channel status information.
The return channel data from Scanhead 0 are output by both SPI modules 0 and 2, simultaneously.
The return channel data from Scanhead 1 are output by both SPI modules 1 and 3, simultaneously.
An SPI transfer will normally be started as soon as a complete return channel data frame is received from the scanhead by the SP-ICE-3
Please note, however, the following important exceptions to this general rule:
Scanner Protocol | SPI Frame Transfer | ||
---|---|---|---|
XY2-100 | An SPI frame transfer happens strictly every 10μs because the return channel's clock signal is generated by the SP-ICE-3. The three channels (X-, Y-, Z-axis channel) are always synchronised.
| ||
SL2-100/RL3-100 | An SPI frame transfer happens only after an SL2-100/RL3-100 frame has been received.
The SL2-100 protocol has no third channel for the Z-Axis, so the third channel is taken instead from the X-channel of the second SL2 interface.
|
The clock rate is 16MHz and one transfer contains three 32-bit DWORDs.
The SYN pin is asserted LOW before the start of the transfer and deasserted HIGH after the last DWORD has been transfered.
The TXD pin is HIGH when inactive, but the data itself is not inverted (i.e. data bits are active HIGH).
The TXD changes on a falling edge of the CLK and shall be captured on a rising edge of the CLK.
Bit 31 | Bit 30 | Bit 29 | Bit 28 | Bit 27 | Bit 26 | Bit 25 | Bit 24 |
---|---|---|---|---|---|---|---|
RX_FRM20 | RX_FRM18 | RX_FRM16 | RX_CMD | RX_PDO | RX_CHST | RX_USER | RX_VALID |
Bit 23 | Bit 22 | Bit 21 | Bit 20 | Bit 19 | Bit 18 | Bit 17 | Bit 16 |
---|---|---|---|---|---|---|---|
RX_AUX3 | RX_AUX2 | RX_AUX1 | RX_AUX0 | RX_DAT19 | RX_DAT18 | RX_DAT17 | RX_DAT16 |
Bit 15 | Bit 14 | Bit 13 | Bit 12 | Bit 11 | Bit 10 | Bit 9 | Bit 8 |
---|---|---|---|---|---|---|---|
RX_DAT15 | RX_DAT14 | RX_DAT13 | RX_DAT12 | RX_DAT11 | RX_DAT10 | RX_DAT9 | RX_DAT8 |
Bit 15 | Bit 14 | Bit 13 | Bit 12 | Bit 11 | Bit 10 | Bit 9 | Bit 8 |
---|---|---|---|---|---|---|---|
RX_DAT7 | RX_DAT6 | RX_DAT5 | RX_DAT4 | RX_DAT3 | RX_DAT2 | RX_DAT1 | RX_DAT0 |
Bit | Symbol | Description |
---|---|---|
31 | RX_FRM20 | Indicates whether the last received frame in the RX_DAT field has a valid 20 bit payload. This happens when SL2-100 is configured. |
30 | RX_FRM18 | Indicates whether the last received frame in the RX_DAT field has a valid 18 bit payload. This happens when XY2-100 is configured and the scanhead sends either PDO or 18 bit data. |
29 | RX_FRM16 | Indicates whether the last received frame in the RX_DAT field has a valid 16 bit payload. This happens when XY2-100 is configured and the scanhead sends 16 bit data. |
28 | RX_CMD | Indicates whether the last received frame in the RX_DAT field has a valid answer to a standard XY2-100 Enhanced or SL2-100 Enhanced command. In SL2-100 mode this is indicated by a set VALID bit. In XY2-100 mode this is indicated by a 16 bit frame type. So in XY2-100 mode Enhanced commands which result in a 18 bit frame will not set this bit. |
27 | RX_PDO | Indicates whether the last received frame in the RX_DAT is a Process Data Objekt (PDO). In SL2-100 mode a PDO is indicated by a cleared valid-bit and the number in the AUX-bits is not zero and indicates the PDO Number. In XY2-100 mode this bit is set when a 18 bit frame was received. The to LSBs indicate the PDO Number. The PDO Number is reflected in the AUX bits as in SL2-100. |
26 | RX_CHST | Contains the CHST bit in SL2-100 mode. Zero in XY2-100 mode. |
25 | RX_USER | Contains the USER bit in SL2-100 mode. Zero in XY2-100 mode. |
24 | RX_VALID | Contains the VALID bit in SL2-100 mode. Indicates a valid 18- oder 16 bit frame in XY2-100 mode. If this bit is set, the received return channel may contain the answer to a XY2-100 Enhanced command. In XY2-100 mode the received frame can bei either a 16 bit frame (which is always a valid answer to a command) or a 18 bit frame which can bei either a PDO or a answer to a Ehnahced command with 18 bit payload. In SL2-100 mode this bit equals the RX_CMD bit. |
23:20 | RX_AUX | Contains the AUX bits in SL2-100 mode. In XY2-100 mode there are no AUX bits but these bits are set in a way that reflects the AUX bits used to distinguish between PDOs in 18 bit mode and set to "1110" in 16 bit mode to indicate no scanhead error. When a command answer is received in SL2-100 mode (RX_CMD=1) these bits reflect the scanhed status bits: PowerOK, TempOK, PosAck, ASC. When a PDO is received the AUX bits indicate the PDO number: PDO1 = "0010 PDO2 = "0100" ... PDO6 = "1100". There is no PDO0 or PDO7. PDO0 (AUX = "0000") indicates an invalid frame. |
19:0 | RX_DAT | Contains the payload data from either SL2-100 or XY2-100. The data is always left alignd. (The MSB is always in bit 19, depending on 20-, 18- or 16 bit frame the LSB are zero.) |
Here are some typical examples of SPI data frames output in RCD Mode.
This example shows the received data frame when the CurrentPosition is returned from the scanhead via the RAYLASE.SPICE3.ScannerEnhancedProtocol.
The asserted CMD bit in the register indicates a valid response to the command, regardless of whether it is received by XY2-100 or SL2-100. XY2-100 and SL2-100 can be distinguished by the FRM16/18/20 bits.
The payload will be a the same position regardless of being transfered by SL2-100 or XY2-100. In XY2-100 mode the last 4 LSB bits in the payload will be zero because XY2-100 can only transfer 16 bit.
This example shows the received data frame when the scanhead is commanded to return the StatusWord via the RAYLASE.SPICE3.ScannerEnhancedProtocol.
This example shows the received data frame when the scanhead is commanded to return the CompatibleStatusWord via the RAYLASE.SPICE3.ScannerEnhancedProtocol, or in any case when an SS-II scanhead is connected.
This mode is only possible with XY2-100 and should not be used except with SS-II scanheads.
The register marks such frames as FRM18 and not as a CMD. The VALID bit is set nonetheless.
Note that the Status Word is shifted to right by one in the payload and the payload MSB ist always '1'.
This example shows the received data frame when a unknown frame or a frame with an error is received.
Be aware that it is also possible in SL2-100 mode that no frame is received at all. In that case there will be no frame transmitted on the SPI bus.