TN0897 Technical note ST SPI protocol Introduction The document describes a standardized SPI protocol. It defines a common structure of the communication frames and defines specific addresses for product and status information. September 2013 Doc ID 023176 Rev 2 1/28 www.st.com Contents TN0897 Contents 1 2 General description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6 1.1 Feature list . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6 1.2 Signal description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6 SPI communication flow . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8 2.1 General description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8 2.2 Command byte . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9 2.2.1 2.3 Global status register . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11 2.3.1 2.4 3 4 5 6 7 2/28 Operating code definition . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10 Global error flag definition . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12 Configuration register (optional) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13 Address mapping . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15 3.1 RAM address range . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15 3.2 ROM address range . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15 Write operation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17 4.1 Write command format . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17 4.2 Format of data shifted out at SDO during write cycle . . . . . . . . . . . . . . . . 18 Read operation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19 5.1 Read command format . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19 5.2 Format of data shifted out at SDO during Read cycle . . . . . . . . . . . . . . . 20 Read and clear status operation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21 6.1 Read and clear status command format . . . . . . . . . . . . . . . . . . . . . . . . . 21 6.2 Format of data shifted out at SDO during read and clear status operation 22 Read device information . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23 7.1 ID-Header . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23 7.2 Silicon version . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24 7.3 Product code . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24 7.4 SPI-Frame-ID . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24 Doc ID 023176 Rev 2 TN0897 Contents Appendix A Reference documents . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25 Appendix B Product code . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26 Revision history . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27 Doc ID 023176 Rev 2 3/28 List of tables TN0897 List of tables Table 1. Table 2. Table 3. Table 4. Table 5. Table 6. Table 7. Table 8. Table 9. Table 10. Table 11. Table 12. Table 13. Table 14. Table 15. Table 16. Table 17. Table 18. 4/28 Command byte (8 bit) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10 Operating code definition . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10 Global Status Register . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11 Definition of Global Status bits . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11 Configuration register . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14 RAM operation code . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15 RAM address range . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15 ROM operation code. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15 ROM address range . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16 Device information . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23 ID-Header . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23 Product family . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23 Silicon version. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24 Silicon version coding . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24 SPI-frame-ID . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24 Frame width . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24 Product code. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26 Document revision history . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27 Doc ID 023176 Rev 2 TN0897 List of figures List of figures Figure 1. Figure 2. Figure 3. Figure 4. Figure 5. Figure 6. Figure 7. Figure 8. Figure 9. Figure 10. Figure 11. Figure 12. Figure 13. ST SPI signal description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7 SPI signal description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7 Communication principle of the ST SPI . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9 Global error flag definition. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13 Write command format . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17 SDO Frame composition during WRITE operation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18 Write operation - 16 bit frame . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18 Read command format . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19 SDO Frame composition during READ operation. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20 Read operation - 16 bit frame . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20 Read and clear status command format . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21 SDO Frame composition during READ and CLEAR operation. . . . . . . . . . . . . . . . . . . . . . 22 Read and clear status operation - 16 bit frame. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22 Doc ID 023176 Rev 2 5/28 General description TN0897 1 General description 1.1 Feature list ● Standardized communication frame structure ● Variable frame width ● Global status information available in every communication frame ● In-frame response ● Pre-defined address assignment ● Fail-safe concept ● ● 1.2 – Robust communication protocol – Bus fault detection – Global failure Indication Product information – Product name and family – Silicon version Plug & play concept (standardized access to product information) Signal description Serial Clock (SCK): this input signal provides the timing of the serial interface. Data present at Serial Data Input (SDI) is latched on the rising edge of Serial Clock (SCK). Data on Serial Data Out (SDO) is shifted out at the falling edge of Serial Clock (SCK). Serial Data Input (SDI): this input is used to transfer data serially into the device. It receives the data to be written. Values are latched on the rising edge of Serial Clock (SCK). Serial Data Output (SDO): this output signal is used to transfer data serially out of the device. Data is shifted out on the falling edge of Serial Clock (SCK). SDO also reflects the status of the <Global Error Flag> (Bit 7 of the <Global Status Register>) while CSN is low and no clock signal is present Chip Select Not (CSN): when this input signal is High, the device is not selected and Serial Data Output (SDO) is high impedance. Driving this input Low enables the communication. The communication must start and stop on a Low level of Serial Clock (SCK). Failure Status (FSTAT) (optional): the <FSTAT> pin reflects the status of the <Global Error Flag> (Bit 7 of the <Global Status Register>). It is an open-drain output signal so that <FSTAT> pins of several devices can be connected to a common pull-up resistor and one microcontroller I/O port in order to indicate a failure in the system. 6/28 Doc ID 023176 Rev 2 TN0897 General description Figure 1. ST SPI signal description SCK SDI SDO CSN FSTAT optional The SPI can be driven by a microcontroller with its SPI peripheral running in following mode: CPOL = 0 and CPHA = 0. Figure 2. SPI signal description &32/&3+$ 6&. 6', 6'2 06% +, 06% § § §§ §§ &61 /6% /6% +, *$3*&)7 The communication starts at the CSN transition from High to Low. SCK is initially Low. Data at SDI must be stable at the first SCK transition from Low to High. Data at SDO is shifted at the first falling edge of SCK. CSN transition Low to High must occur after the specified number of clock cycles (rising and falling edges of SCK are counted). Doc ID 023176 Rev 2 7/28 SPI communication flow TN0897 2 SPI communication flow 2.1 General description The proposed SPI communication is based on a standard SPI interface structure using CSN (Chip Select Not), SDI (Serial Data In), SDO (Serial Data Out/Error) and SCK (Serial Clock) signal lines. At device start-up the master reads the <SPI-frame-ID> register (ROM address 3EH) of the slave device. This 8-bit register indicates the SPI frame length (16, 24, or 32 bit) and the availability of additional features. Each communication frame consists of an instruction byte which is followed by 1, 2 or 3 data bytes. The data returned on SDO within the same frame always starts with the <Global Status> register. It provides general status information about the device. It is followed by 1, 2 or 3 data bytes (i. e. ‘In-frame-response’). For write cycles the <Global Status> register is followed by the previous content of the addressed register. For read cycles the <Global Status> register is followed by the content of the addressed register. 8/28 Doc ID 023176 Rev 2 TN0897 SPI communication flow Figure 3. Communication principle of the ST SPI :ULWH 2SHUDWLRQ &61 6', 06% &RPPDQG %\WH ELW /6% /6% 'DWD *OREDO6WDWXV %\WH ELW 6'2 'DWD RUELW 06% SUHYLRXVFRQWHQWRIUHJLVWHU 06% /6% 5HDG2SHUDWLRQ &61 6', 6'2 06% &RPPDQG %\WH ELW /6% *OREDO6WDWXV %\WH ELW 06% 'RQ¶WFDUH RUELW 'DWD RUELW 06% /6% /6% *$3*&)7 2.2 Command byte Each communication frame starts with a command byte. It consists of an operating code which specifies the type of operation (<Write>, <Read>, <Read and Clear>, <Read Device Information>) and a 6 bit address. If less than 6 address bits are required, the remaining bits are unused but are reserved. Doc ID 023176 Rev 2 9/28 SPI communication flow Table 1. TN0897 Command byte (8 bit) Operating code Address MSB LSB OC1 OC0 A5 A4 A3 A2 A1 A0 OCx: operating code Ax: address 2.2.1 Operating code definition Table 2. Operating code definition OC1 OC0 Meaning 0 0 <Write mode> 0 1 <Read mode> 1 0 <Read and clear status> 1 1 <Read device information> The <Write Mode>, <Read Mode> and <Read and Clear Status> operations allow access to the RAM of the device, i. e. to write to control registers or read status information. <Read Device Information> allows access to the ROM area which contains device related information such as the product family, product name, silicon version, register width and availability of a watchdog. Example 1 For 16-bit frames Command Byte: 0000 1000 Data Byte: 1111 1111 Write FFH at RAM address 08H Example 2 For 16-bit frames Command Byte: 0111 1110 Data Byte: 0000 0000 Read register at RAM address 3EH Example 3 For 16-bit frames Command Byte: 1011 1110 Data Byte: 0000 0000 Read register at RAM address 3EH and clear its content at CSN low to high transition 10/28 Doc ID 023176 Rev 2 TN0897 SPI communication flow Example 4 For 16-bit frames Command Byte: 1111 1110 Data Byte: 0000 0000 Read register at ROM address 3EH (i. e. <SPI-frame-ID>) 2.3 Global status register Table 3. Global Status Register Bit 7 Bit 6 Bit 5 Bit 4 Bit 3 Bit 2 Global Error Not (Chip Reset TSD / chip Tframe / Temp Comm Error Flag (GEF) OR Comm Error) overload prewarning Table 4. Bit Bit 1 Device Device specific specific Bit 0 Fail Safe Definition of Global Status bits Description Optional feature Polarity Comment 0 Fail Safe X Indicates that the device is in Fail Safe Mode (1). Active high The bit is defined as ‘0’ if no fail-safe functionality is present in the device 1 Device specific X Active high See product datasheet(2) 2 Device specific X Active high See product datasheet(2) 3 Temp pre-warning X Active high The bit is defined as ‘0’ if feature is not present. See product datasheet 4 Thermal Shutdown / Chip Overload X Active high The bit is defined as ‘0’ if feature is not present. See product datasheet 5 Not (Chip Reset OR Communication Error) Chip Reset: registers have been set to default Communication Error: see bit 6 Active low The bit is cleared automatically after a valid communication with any register After Power-On the bit is ‘0’ and is set to ‘1’ by a valid SPI communication 6 Communication Error Bit is set if the number of clock cycles during CSN = low does not match with the specified frame Active high width or if any other device specific communication error occurs. See product datasheet(2) 7 Global Error Flag (GEF) Logic OR combination of all failures in the <Global Active high Status register> and additional device specific failures 1. Fail-safe Mode is an operating mode where the device enters a safe state. The precise definition is device specific and is defined in the product datasheet. 2. See Appendix A: Reference documents. Doc ID 023176 Rev 2 11/28 SPI communication flow 2.3.1 TN0897 Global error flag definition The <Global Error Flag> (GEF) is a diagnosis information which is transmitted with every communication frame. It indicates that a failure condition has been detected which can be identified in the Status Registers. The GEF is composed by a logical OR combination of failures notified in the <Global Status> register and in device specific Status Registers. Bits 1, 2 and 3 of the <Global Status> register may be maskable in the <Configuration> register, i.e. these bits may be excluded from the GEF composition. The clock monitor counts the number of clock pulses during a communication frame (while CSN is low). If the number of SCK pulses does not correspond with the frame width indicated in the <SPI-frame-ID> (ROM address 3EH) the frame is ignored and the <Communication Error> bit in the <Global Status> register is set. This safety function is implemented to avoid an unwanted activation of output stages by a wrong communication frame. If a communication error is detected during a read operation, the <Communication Error> bit in the <Global Status> register is set, but the register read is transferred to the SDO pin. If the number of clock cycles is smaller than the frame width, the data at SDO is truncated. If the number of clock cycles is larger than the frame width, the data at SDO is filled with ‘0’. If the frame width is greater than 16 bits, initial Read of <SPI-frame-ID> using a 16 bits communication sets the <Communication Error> bit of the <Global Status> register. A subsequent correct length transaction is necessary to correct this bit. Due to this safety functionality a daisy chaining of SPI is not possible. Instead, a parallel operation of the SPI bus by controlling the CSN signal of the connected ICs is recommended. The SPI Failure Detection identifies a short circuit condition at SDI if all bits within a received frame are ‘0’ (short to GND) or ‘1’ (short to Vdd). In this case the communication frame is ignored, the device enters the <Fail-Safe Mode> and the <Fail-Safe> bit in the <Global Status> register is set. 12/28 Doc ID 023176 Rev 2 TN0897 SPI communication flow Figure 4. Global error flag definition Watchdog Trigger Signal Watchdog Trigger Bit: Configuration Register (RAM: 3FH; Bit 0) Watchdog Failure Watchdog SDI SCK CSN Fail Safe Events SDI failure detection (device specific) Communication Error Clock Monitor OR SDO / Err FSTAT optional Fail Safe GEF Global Status Register OR Status Registers (device specific) GAPGCFT00721 The open-drain <FSTAT> pin is an optional feature which reflects the status of the <Global Error Flag> (Bit 7 of the <Global Status> register). Several <FSTAT> pins in a system can be connected to one microcontroller I/O port in order to indicate an error in the system. The faulty device can then be identified by reading the <Global Error Flag> bits of all devices. The <Global Error Flag> is also available on the SDO pin while CSN is low and the clock signal is stable (high or low). The flag at SDO remains as long as CSN is low. This operation does not set the <communication error> bit in the <Global Status Register>. The refreshprocedure of the GEF at SDO is device specific. A status change during an SPI communication can cause an inconsistency in the <Global Status> register and other Status Registers. For devices intended for safety critical applications, precautions must be taken to avoid such inconsistencies. 2.4 Configuration register (optional) The <Configuration> register is optional. When available, it is always accessible at RAM address 3FH. Doc ID 023176 Rev 2 13/28 SPI communication flow Table 5. TN0897 Configuration register Bit 7 Bit 6 Device specific fault mask Device specific fault mask Bit 5 Bit 4 Device Device specific specific fault mask fault mask Bit 3 Bit 2 Bit 1 Bit 0 Masking Bit 3 of <Global Status> register Masking Bit 2 of <Global Status> register Masking Bit 1 of <Global Status> register WD Trigger <WD Trigger>: this Bit is reserved to trigger the watchdog. The precise procedure required to serve the watchdog is device specific and defined in the product datasheet. The bit is reserved if the device has no watchdog. <Masking>: bits 1, 2 and 3 allow masking of the corresponding bit in the <Global Status> register. If a Status Bit is masked, it is excluded from the <Global Error Flag> composition, i. e. the information is still indicated in the <Global Status> register but it is not contributing to the <Global Error Flag> (Bit 7 of the <Global Status> register). 1 = corresponding bit is masked, 0 = corresponding bit is not masked 14/28 Doc ID 023176 Rev 2 TN0897 Address mapping 3 Address mapping 3.1 RAM address range Table 6. RAM operation code Op Code Operation OC1 OC0 0 0 <Write> 0 1 <Read> 1 0 <Read and Clear Status> Table 7. RAM address range RAM Address Description Access 3FH <Configuration> optional R/W ... R Status Registers R ... R/W Control Registers R/W ... Reserved(1) 00H 1. Address 00H is reserved. A Write operation to this address is recognized as a SDI failure (short to GND) and causes the device to enter Fail-Safe Mode. The RAM memory area contains the Control Registers (Read/Write) and Status Registers (Read). The address assignment for these registers is device specific and defined in the product datasheet. The register width can be 8, 16 or 24 bit and is defined in the <SPI Frame ID>. For the <Configuration> register the eight most significant bits of the memory cell are used. All unused RAM addresses are read as ‘0’. 3.2 ROM address range Table 8. ROM operation code Op Code Operation OC1 OC0 1 1 <Read Device Information> Doc ID 023176 Rev 2 15/28 Address mapping TN0897 Table 9. ROM address range ROM Address Device Information Access 3FH Reserved(1) 3EH <SPI frame ID> R 04H to 3DH Product specific See product datasheet R 03H <product code 2> R 02H <product code 1> R 01H <silicon version> R 00H <ID Header> R 1. ROM address 3FH is unused. An attempt to access this address is recognized as a SDI failure (short to VDD) and causes the device to enter Fail-Safe Mode. The register width of the ROM area is 8 bit. For products with 16 or 24 bit register width, the eight most significant bits of the memory cell are used. All unused ROM addresses are read as ‘0’. 16/28 Doc ID 023176 Rev 2 TN0897 4 Write operation Write operation The write operation starts with a Command Byte followed by 1, 2, or 3 data bytes (depending on the register width of the device). The number of data bytes is specified in the <SPI-frame-ID>. 4.1 Write command format Figure 5. Write command format Command byte MSB LSB Op Code 0 Address 0 A5 A4 A3 A2 A1 A0 Data byte 1 MSB D7 LSB D6 D5 D4 D3 D2 D1 D0 Data byte 2(1) MSB D7 LSB D6 D5 D4 D3 D2 D1 D0 1. Only for 24-bit SPI frame width. A0 to A5: address bits Doc ID 023176 Rev 2 17/28 Write operation 4.2 TN0897 Format of data shifted out at SDO during write cycle Figure 6. SDO Frame composition during WRITE operation Global status register Bit 7 Bit 6 Bit 5 Bit 4 Global Error Comm Not (Chip Reset TSD / chip Flag (GEF) Error OR Comm Error) overload Bit 3 Bit 2 Bit 1 Bit 0 Tframe Device specific Device specific Fail Safe Data byte 1 - previous content of addressed register MSB D7 LSB D6 D5 D4 D3 D2 D1 D0 Data byte 2 - previous content of addressed register(1) MSB D7 LSB D6 D5 D4 D3 D2 D1 D0 1. Only for 24-bit SPI frame width. Failures are indicated by activating the corresponding bit of the <Global Status> register. The returned data byte(s) represent(s) the previous content of the accessed register. Figure 7. Write operation - 16 bit frame CSN SDI 0 0 A5 A4 A3 A2 A1 A0 D7 D6 D5 D4 D3 D2 D1 D0 Command NOT (Chip SDO GEF Com Res Error OR Comm Err) TSD / Dev Dev Chip Tframe spec spec OVL Data (8 bit) Fail Safe D7 D6 D5 D4 D3 D2 D1 D0 Data Global Status (previous content of the register) GAPGCFT00722 18/28 Doc ID 023176 Rev 2 TN0897 5 Read operation Read operation The Read operation starts with a Command Byte followed by 1, 2, or 3 data bytes. The number of data bytes is specified in the <SPI-frame-ID>. The content of the data bytes is ‘don’t care’. The content of the addressed register is shifted out at SDO within the same frame (‘in-frame response’). 5.1 Read command format Figure 8. Read command format Command byte MSB LSB Op Code 0 Address 1 A5 A4 A3 A2 A1 A0 Data byte 1 MSB 0 LSB 0 0 0 0 0 0 0 Data byte 2(1) MSB 0 LSB 0 0 0 0 0 0 0 1. Only for 24-bit SPI frame width. A0 to A5: address bits Doc ID 023176 Rev 2 19/28 Read operation 5.2 TN0897 Format of data shifted out at SDO during Read cycle Figure 9. SDO Frame composition during READ operation Global status register Bit 7 Bit 6 Bit 5 Bit 4 Global Error Comm Not (Chip Reset TSD / chip Flag (GEF) Error OR Comm Error) overload Bit 3 Bit 2 Bit 1 Bit 0 Tframe Device specific Device specific Fail Safe Data byte 1 - content of addressed register MSB D7 LSB D6 D5 D4 D3 D2 D1 D0 Data byte 2 - content of addressed register(1) MSB D7 LSB D6 D5 D4 D3 D2 D1 D0 1. Only for 24-bit SPI frame width. Failures are indicated by activating the corresponding bit of the <Global Status> register. The returned data byte(s) represent(s) the content of the register to be read. Figure 10. Read operation - 16 bit frame CSN SDI 0 1 A5 A4 A3 A2 A1 A0 0 0 0 0 0 0 0 0 Command NOT (Chip SDO GEF Com Res Error OR Comm Err) TSD / Dev Chip Tframe spec OVL Dev Fail spec Safe D7 D6 D5 D4 D3 D2 D1 D0 Global Status Data (8 bit) GAPGCFT00723 20/28 Doc ID 023176 Rev 2 TN0897 6 Read and clear status operation Read and clear status operation The <Read and Clear Status> operation starts with a Command Byte followed by 1, 2, or 3 data bytes. The number of data bytes is specified in the <SPI-frame-ID>. The content of the data bytes is ‘don’t care’. The content of the addressed status register is transferred to SDO within the same frame (‘in-frame response’) and is subsequently cleared. A <Read and Clear Status> command addressed to the <Configuration> register (RAM: 3FH) clears all status registers (incl. the <Global Status> register) simultaneously and reads back the <Configuration> register. 6.1 Read and clear status command format Figure 11. Read and clear status command format Command byte MSB LSB Op Code 1 Address 0 A5 A4 A3 A2 A1 A0 Data byte 1 MSB 0 LSB 0 0 0 0 0 0 0 Data byte 2(1) MSB 0 LSB 0 0 0 0 0 0 0 1. Only for 24-bit SPI frame width. A0 to A5: address bits Doc ID 023176 Rev 2 21/28 Read and clear status operation 6.2 TN0897 Format of data shifted out at SDO during read and clear status operation Figure 12. SDO Frame composition during READ and CLEAR operation Global status register Bit 7 Bit 6 Bit 5 Bit 4 Global Error Comm Not (Chip Reset TSD / chip Flag (GEF) Error OR Comm Error) overload Bit 3 Bit 2 Bit 1 Bit 0 Tframe Device specific Device specific Fail Safe Data byte 1 - content of addressed status register or configuration register MSB D7 LSB D6 D5 D4 D3 D2 D1 D0 Data byte 2 - content of addressed status register(1) MSB D7 LSB D6 D5 D4 D3 D2 D1 D0 1. Only for 24-bit SPI frame width. Failures are indicated by activating the corresponding bit of the <Global Status> register. The returned data byte(s) represent(s) the content of the register to be read. Figure 13. Read and clear status operation - 16 bit frame CSN SDI 1 0 A5 A4 A3 A2 A1 A0 0 0 0 0 0 0 0 0 Command NOT (Chip SDO GEF TSD / Dev Chip Tframe spec Comm OVL Com Res Error OR Dev Fail spec Safe D7 D6 D5 D4 D3 D2 D1 D0 Err) Global Status Content of addressed status register or ‚Configuration’ Register (8 bit) GAPGCFT00724 22/28 Doc ID 023176 Rev 2 TN0897 7 Read device information Read device information Product specific information is stored in the ROM area and can be read using a dedicated operating code (<Read Device Information>). Table 10. Device information Op Code 7.1 Address Device Information 1 3FH Reserved 1 1 3EH <SPI-frame-ID> 1 1 04H to 3DH Product specific See product datasheet 1 1 03H <Product Code 2> 1 1 02H <Product Code 1> 1 1 01H <Silicon Version> 1 1 00H <ID-Header> OC1 OC0 1 ID-Header Table 11. ID-Header Bit 7 Bit 6 Bit 5 Bit 4 Fam Bit 3 Bit 2 Bit 1 Bit 0 ROM Address Range for <Device Information> The <Address Range> specifies the highest ROM address which contains <Device Information>. The standard value if no additional information registers are present is 03H ( content of ID-Header is: XX00 0011) The <Family Identifier> specifies the product family according to the following family codes: Table 12. Product family Bit 7 Bit 6 Product family 0 0 VIPower 0 1 BCD 1 0 VIPower hybrid Doc ID 023176 Rev 2 23/28 Read device information 7.2 TN0897 Silicon version Table 13. Bit 7 Silicon version Bit 6 Bit 5 Bit 4 Bit 3 Reserved Bit 2 Bit 1 Bit 0 Silicon Version The <Silicon Version> provides information about the silicon version according to the following table: Table 14. 7.3 Silicon version coding Bit3 Bit 2 Bit 1 Bit 0 Silicon version 0 0 0 0 First silicon 0 0 0 1 V2 Product code <Product Code 1> and <Product Code 2> represent a unique set of codes to identify the product. The code is specified in the datasheet (see Appendix B: Product code). 7.4 SPI-Frame-ID The <SPI-frame-ID> provides information about the register width (1, 2, 3 bytes) and the availability of additional features like <Burst Mode Read> and <watchdog>. Table 15. SPI-frame-ID Bit 7 Bit 6 Bit 5 Bit 4 Bit 3 BR WD X X X Bit 2 Bit 1 Bit 0 Frame width BR: Burst-Mode Read (1 = Burst-Mode Read is supported) WD: Watchdog (1 = available, 0 = not available) Frame width: width of SPI frame (see Table 16) Table 16. 24/28 Frame width Bit 2 Bit 1 Bit 0 Frame width Command Data 0 0 1 16 bit 8 bit 8 bit 0 1 0 24 bit 8 bit 16 bit 1 0 0 32 bit 8 bit 24 bit Doc ID 023176 Rev 2 TN0897 Reference documents Appendix A Reference documents 1. Power management IC with LIN transceiver (L99PM60J, Doc ID 18309) 2. Power management IC with LIN and high speed CAN (L99PM62XP, Doc ID 16363) 3. Power management IC with LIN and high speed CAN (L99PM62GXP, Doc ID 17639) 4. Advanced power management system IC with embedded LIN and high speed CAN transceiver supporting CAN Partial Networking (L99PM72PXP, Doc ID 022035) 5. Door actuator driver (L99DZ80EP, Doc ID 18260) 6. Door actuator driver (L99DZ81EP, Doc ID 022498) 7. Octal half-bridge driver with SPI control for automotive application (L99MD01, Doc ID 17242) 8. Hexa half-bridge driver with SPI control for automotive applications (L99MD02, Doc ID 16082) 9. High efficiency constant current LED driver (L99LD01, Doc ID 18451) 10. Integrated microprocessor driven device intended for LIN controlled exterior mirrors (L99MM70XP, Doc ID 022637) 11. SPI control diagnosis interface device for VIPower® M0-5 and M0-5E high side drivers (L99PD08, Doc ID 15872) 12. Quad channel high-side driver VIPower® M0-6(VNQ6040S-E, Doc ID 18061) 13. Quad-channel high-side driver with 16-bit SPI interface VIPower® M0-6 (VNQ6004SA-E, Doc ID 22315) Doc ID 023176 Rev 2 25/28 Product code TN0897 Appendix B Product code Table 17. Product code Product code Product 26/28 PC1 hex PC2 hex L99PM60J 0C 4B L99PM62XP 44 4E L99PM62GXP 13 4B L99PM72PXP 4B 27 L99DZ80 52 48 L99DZ81 01 55 L99MD01 3E 4E L99MD02 3E 4E L99LD01 31 51 L99MM70XP 48 48 L99PD08 25 50 VNQ6040S-E 1A 00 VNQ6004SA-E 1A 00 Doc ID 023176 Rev 2 TN0897 Revision history Revision history Table 18. Document revision history Date Revision Changes 31-Oct-2012 1 Initial release. 23-Sep-2013 2 Updated Disclaimer. Doc ID 023176 Rev 2 27/28 TN0897 Please Read Carefully: Information in this document is provided solely in connection with ST products. STMicroelectronics NV and its subsidiaries (“ST”) reserve the right to make changes, corrections, modifications or improvements, to this document, and the products and services described herein at any time, without notice. All ST products are sold pursuant to ST’s terms and conditions of sale. Purchasers are solely responsible for the choice, selection and use of the ST products and services described herein, and ST assumes no liability whatsoever relating to the choice, selection or use of the ST products and services described herein. No license, express or implied, by estoppel or otherwise, to any intellectual property rights is granted under this document. If any part of this document refers to any third party products or services it shall not be deemed a license grant by ST for the use of such third party products or services, or any intellectual property contained therein or considered as a warranty covering the use in any manner whatsoever of such third party products or services or any intellectual property contained therein. UNLESS OTHERWISE SET FORTH IN ST’S TERMS AND CONDITIONS OF SALE ST DISCLAIMS ANY EXPRESS OR IMPLIED WARRANTY WITH RESPECT TO THE USE AND/OR SALE OF ST PRODUCTS INCLUDING WITHOUT LIMITATION IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE (AND THEIR EQUIVALENTS UNDER THE LAWS OF ANY JURISDICTION), OR INFRINGEMENT OF ANY PATENT, COPYRIGHT OR OTHER INTELLECTUAL PROPERTY RIGHT. ST PRODUCTS ARE NOT DESIGNED OR AUTHORIZED FOR USE IN: (A) SAFETY CRITICAL APPLICATIONS SUCH AS LIFE SUPPORTING, ACTIVE IMPLANTED DEVICES OR SYSTEMS WITH PRODUCT FUNCTIONAL SAFETY REQUIREMENTS; (B) AERONAUTIC APPLICATIONS; (C) AUTOMOTIVE APPLICATIONS OR ENVIRONMENTS, AND/OR (D) AEROSPACE APPLICATIONS OR ENVIRONMENTS. WHERE ST PRODUCTS ARE NOT DESIGNED FOR SUCH USE, THE PURCHASER SHALL USE PRODUCTS AT PURCHASER’S SOLE RISK, EVEN IF ST HAS BEEN INFORMED IN WRITING OF SUCH USAGE, UNLESS A PRODUCT IS EXPRESSLY DESIGNATED BY ST AS BEING INTENDED FOR “AUTOMOTIVE, AUTOMOTIVE SAFETY OR MEDICAL” INDUSTRY DOMAINS ACCORDING TO ST PRODUCT DESIGN SPECIFICATIONS. PRODUCTS FORMALLY ESCC, QML OR JAN QUALIFIED ARE DEEMED SUITABLE FOR USE IN AEROSPACE BY THE CORRESPONDING GOVERNMENTAL AGENCY. Resale of ST products with provisions different from the statements and/or technical features set forth in this document shall immediately void any warranty granted by ST for the ST product or service described herein and shall not create or extend in any manner whatsoever, any liability of ST. ST and the ST logo are trademarks or registered trademarks of ST in various countries. Information in this document supersedes and replaces all information previously supplied. The ST logo is a registered trademark of STMicroelectronics. All other names are the property of their respective owners. © 2013 STMicroelectronics - All rights reserved STMicroelectronics group of companies Australia - Belgium - Brazil - Canada - China - Czech Republic - Finland - France - Germany - Hong Kong - India - Israel - Italy - Japan Malaysia - Malta - Morocco - Philippines - Singapore - Spain - Sweden - Switzerland - United Kingdom - United States of America www.st.com 28/28 Doc ID 023176 Rev 2