iC-LNG 16-BIT OPTO ENCODER
WITH SPI AND SERIAL / PARALLEL OUTPUTS
Rev A1, Page 15/25
SPI INTERFACE
CS
SCLK
OP7 OP6 OP5 OP4 OP3 OP2 OP1 OP0 ADR7 ADR6 ADR5 ADR4 ADR3 ADR2 ADR1 ADR0
MOSI
OP7 OP6 OP5 OP4 OP3 OP2 OP1 OP0 ADR7 ADR6 ADR5 ADR4 ADR3 ADR2 ADR1 ADR0 DB7 DB6 DB5 DB4 DB3 DB2 DB1 DB0
MISO
Figure 4: SPI transmission, taking the Read REGISTER opcode as an example (cont.)
General protocol description
OPCODE description
iC-LNG’s SPI interface is implemented as an SPI slave
and supports SPI modes 0 and 3, meaning the idle ACTIVATE
time at SCK can be 0 or 1. Data is always accepted iC-LNG’s register and sensor data channels can be
on a rising edge at SCK. The idle time of the MISO switched on and off using the ACTIVATE command.
line is 1; on a rising edge at CS the MOSI signal is The command causes all slaves to zero their RAC-
switched through to the MISO signal.
TIVE and PACTIVE register and to loop-in this register
Data is sent byte by byte with the MSB (most signif- data between the MOSI and MISO data stream. The
icant bit) first. Each data transmission starts when a register and sensor or actuator data channels can be
1-byte opcode is sent by the SPI master (Table 10).
switched on and off using the following data bytes.
After a power-on iC-LNG’s sensor data channel is de-
activated (PACTIVE = 0) and the register communica-
tion is activated (RACTIVE = 1).
OPCODE
Code
0xB0
0xA6
0xF5
0x8A
0xCF
0xAD
Description
ACTIVATE
CS
Sensor data transmission
Sensor data status
Read REGISTER (cont.)
Write to REGISTER (cont.)
REGISTER status/data
SCLK
RAPA 0-4
RAPA 5-7
OP
OP
...
MOSI
MISO
Table 10: Instructions / opcodes
8 cycles
SPI data transmission for register readout takes place
as follows (Figure 4):
Figure 5: Setting ACTIVATE: RACTIVE/PACTIVE
(several slaves)
Bytes FAIL, VALID, BUSY, and DISMISS in the STA-
TUS byte are reset by the ACTIVATE command (Ta-
ble 14).
1. The master initializes a transmission by a rising
edge at CS.
2. iC-LNG transfers the level from MOSI to MISO.
RACTIVE
Code
Description
3. The master transmits the OPCODE and address
ADR through MOSI; iC-LNG immediately outputs
OPCODE and ADR through MISO.
0
1
Register communication deactivated
Register communication activated
Table 11: Register communication
4. iC-LNG transmits the data requested according
to the address.
If RACTIVE is not set, on commands Read REGIS-
TER (cont.), Write to REGISTER (cont.) and REG-
ISTER status/data the ERROR bit is set in the SPI
interface STATUS byte (Table 14), indicating that the
command has not been carried out. The slave imme-
diately outputs the data at MISO which has been sent
by the master through MOSI.
5. The master ends the command by a falling edge
at CS.
6. iC-LNG switches its MISO output to 1.