SPI Protocol

Overview

The TLE92466ED uses a 32-bit SPI protocol with 8-bit CRC (SAE J1850) for robust communication. This is a full-duplex, synchronous serial interface operating in SPI Mode 0.

Protocol Specifications

Parameter Value Notes
Frame Size 32 bits Single transaction
CRC 8-bit SAE J1850 Polynomial 0x1D
Mode 0 (CPOL=0, CPHA=0) Data sampled on rising edge
Frequency 100 kHz - 10 MHz Typical: 1-2 MHz
Bit Order MSB first Most significant bit first
CS Polarity Active low Pull low during transfer

Frame Structure

32-Bit Frame Layout

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
   Bit Position:  31  30  29  28  27  26  25  24  23  22  21  20  19  18  17  16  15 ...  0
                 โ”Œโ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
   MOSI (Write): โ”‚              CRC (8)              โ”‚    ADDR (7)   โ”‚R/Wโ”‚   DATA (16)   โ”‚
                 โ””โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
                 
                 โ”Œโ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
   MISO (Reply): โ”‚              CRC (8)              โ”‚RM โ”‚ STATUS(5) โ”‚R/Wโ”‚   DATA (16)   โ”‚
                 โ””โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

   Field Breakdown:
   โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
   โ”‚ Bits [31:24] โ”‚ CRC      โ”‚ 8-bit CRC checksum (SAE J1850)              โ”‚
   โ”‚ Bits [23:17] โ”‚ ADDRESS  โ”‚ 7-bit register address (MOSI)               โ”‚
   โ”‚ Bits [23:22] โ”‚ RPLY_MOD โ”‚ Reply mode indicator (MISO)                 โ”‚
   โ”‚ Bits [21:17] โ”‚ STATUS   โ”‚ 5-bit status field (MISO)                   โ”‚
   โ”‚ Bit  [16]    โ”‚ R/W      โ”‚ 1=Write, 0=Read                             โ”‚
   โ”‚ Bits [15:0]  โ”‚ DATA     โ”‚ 16-bit data payload                         โ”‚
   โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
```text

### MOSI (Master Out, Slave In) - Write Frame

```text
    Write Transaction Format:

    31                24  23        17  16  15                 0
    โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
    โ”‚     CRC (8)       โ”‚  ADDR (7)   โ”‚ 1 โ”‚    DATA (16)      โ”‚
    โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
         Computed            Target       Write    Value to
         checksum           register      flag     write

    Example: Write 0x1234 to register 0x0002 (GLOBAL_CONFIG)
    
    Step 1: Build frame without CRC
      Bits [23:17] = 0x01      (0x0002 >> 3 = 0x01, upper 7 bits)
      Bit  [16]    = 1         (Write operation)
      Bits [15:0]  = 0x1234    (Data to write)
      
    Step 2: Calculate CRC on bits [23:0]
      Input: 0x00 0x02 0x34 (3 bytes, address + R/W + data)
      CRC  : 0xXX (computed)
      
    Step 3: Complete frame
      [31:24] = CRC, [23:0] = 0x012341234
```text

### MOSI (Master Out, Slave In) - Read Frame

```text
    Read Transaction Format:

    31                24  23        17  16  15                 0
    โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
    โ”‚     CRC (8)       โ”‚  Don't Care โ”‚ 0 โ”‚    ADDRESS (16)   โ”‚
    โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
         Computed           Ignored    Read    Full register
         checksum                      flag    address

    Example: Read register 0x0100 (CH0 SETPOINT)
    
    Step 1: Build frame without CRC
      Bits [23:17] = Don't care
      Bit  [16]    = 0         (Read operation)
      Bits [15:0]  = 0x0100    (Register address)
      
    Step 2: Calculate CRC on bits [23:0]
      Input: 0x00 0x00 0x01 0x00 (3 bytes)
      CRC  : 0xXX (computed)
      
    Step 3: Complete frame
      [31:24] = CRC, [23:0] = 0x00000100
```text

### MISO (Master In, Slave Out) - Reply Frame Types

#### Type 1: 16-Bit Reply Frame (Standard)

```text
    31                24  23 22  21        17  16  15                 0
    โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”ฌโ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
    โ”‚     CRC (8)       โ”‚ 0โ”‚ 0โ”‚ STATUS (5) โ”‚R/Wโ”‚    DATA (16)      โ”‚
    โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”ดโ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
         Computed        Reply  Status      Echo   Register
         checksum        Mode   flags       R/W    contents

    Reply Mode [23:22] = 00b: Standard 16-bit data
    Status [21:17]: Error/status indication
    R/W [16]: Echoes request R/W bit
    Data [15:0]: Register value or last write acknowledgment
```text

#### Type 2: 22-Bit Reply Frame (Extended Data)

```text
    31                24  23 22  21                             0
    โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”ฌโ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
    โ”‚     CRC (8)       โ”‚ 0โ”‚ 1โ”‚       EXTENDED DATA (22)        โ”‚
    โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”ดโ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
         Computed        Reply     Extended feedback data
         checksum        Mode      (e.g., current measurements)

    Reply Mode [23:22] = 01b: Extended 22-bit data
    Used for: High-resolution feedback registers
```text

#### Type 3: Critical Fault Frame

```text
    31                24  23 22  21                             0
    โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”ฌโ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
    โ”‚     CRC (8)       โ”‚ 1โ”‚ 0โ”‚        Don't Care               โ”‚
    โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”ดโ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
         Computed        Reply     Undefined
         checksum        Mode

    Reply Mode [23:22] = 10b: Critical fault condition
    Indicates: Severe hardware fault, device in safe state
```text

## SPI Status Codes

### Status Field [21:17] Encoding

```text
    Status Bits: 5-bit field in MISO reply

    โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
    โ”‚ Code โ”‚ Meaning                                         โ”‚
    โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค
    โ”‚00000 โ”‚ No error - transaction successful               โ”‚
    โ”‚00001 โ”‚ SPI frame error - invalid frame format          โ”‚
    โ”‚00010 โ”‚ Parity/CRC error - checksum mismatch            โ”‚
    โ”‚00011 โ”‚ Write to read-only register - access denied     โ”‚
    โ”‚00100 โ”‚ Internal bus fault - hardware issue             โ”‚
    โ”‚00101 โ”‚ Internal bus fault - alternate code             โ”‚
    โ”‚00110 โ”‚ Internal bus fault - alternate code             โ”‚
    โ”‚xxxxx โ”‚ Other codes reserved                            โ”‚
    โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

    Priority: Lower encoding = higher priority
    (If multiple errors, lowest code is reported)
```text

## CRC Calculation

### SAE J1850 CRC-8 Algorithm

```text
    Polynomial: 0x1D (x^8 + x^4 + x^3 + x^2 + 1)
    Init Value: 0xFF
    Final XOR:  0xFF
    Bit Order:  MSB first

    Algorithm Pseudocode:
    โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
    โ”‚ function calculate_crc8(data[], length):               โ”‚
    โ”‚     crc = 0xFF              // Initialize              โ”‚
    โ”‚     for each byte in data:                             โ”‚
    โ”‚         crc = crc XOR byte  // Mix in data byte        โ”‚
    โ”‚         for bit = 0 to 7:   // Process 8 bits          โ”‚
    โ”‚             if crc & 0x80:  // Check MSB               โ”‚
    โ”‚                 crc = (crc << 1) XOR 0x1D              โ”‚
    โ”‚             else:                                       โ”‚
    โ”‚                 crc = (crc << 1)                       โ”‚
    โ”‚     return crc XOR 0xFF     // Final inversion         โ”‚
    โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
```text

### CRC Calculation Example

```text
    Example: Calculate CRC for write to GLOBAL_CONFIG
    
    Frame contents (before CRC):
      Address [23:17] = 0x01
      R/W [16]        = 1
      Data [15:0]     = 0x4005
      
    Bytes to CRC (bits [23:0] = 3 bytes):
      Byte 0: 0x02      (bits [23:16])
      Byte 1: 0x40      (bits [15:8])
      Byte 2: 0x05      (bits [7:0])
      
    Step-by-step:
      crc = 0xFF
      
      Process 0x02:
        crc = 0xFF XOR 0x02 = 0xFD
        [bit processing yields]
        crc = 0xC5
        
      Process 0x40:
        crc = 0xC5 XOR 0x40 = 0x85
        [bit processing yields]
        crc = 0x7A
        
      Process 0x05:
        crc = 0x7A XOR 0x05 = 0x7F
        [bit processing yields]
        crc = 0x23
        
      Final XOR:
        crc = 0x23 XOR 0xFF = 0xDC
        
    Result: CRC = 0xDC
    Complete frame: 0xDC024005
```text

## Communication Timing

### SPI Timing Diagram

```text
    CSN     โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”                                         โ”Œโ”€โ”€โ”€โ”€โ”€โ”€
                     โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
                       tCSS                           tCSH
                     
    SCK     โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”  โ”Œโ”€โ”€โ”  โ”Œโ”€โ”€โ”  โ”Œโ”€โ”€โ”  โ”Œโ”€โ”€โ”  โ”Œโ”€โ”€โ”  โ”Œโ”€โ”€โ”  โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€
                     โ”‚  โ”‚  โ”‚  โ”‚  โ”‚  โ”‚  โ”‚  โ”‚  โ”‚  โ”‚  โ”‚  โ”‚  โ”‚  โ”‚
                     โ””โ”€โ”€โ”˜  โ””โ”€โ”€โ”˜  โ””โ”€โ”€โ”˜  โ””โ”€โ”€โ”˜  โ””โ”€โ”€โ”˜  โ””โ”€โ”€โ”˜  โ””โ”€โ”€โ”˜
                      tSCKH tSCKL      32 clock cycles
                       
    SI/SO   โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค B31โ”‚ B30โ”‚ B29โ”‚ ... โ”‚ B2 โ”‚ B1 โ”‚ B0 โ”œโ”€โ”€โ”€โ”€โ”€โ”€
                     โ””โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”˜
                      tSU  tH
    
    Timing Parameters:
    โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”
    โ”‚ Parameter          โ”‚ Min  โ”‚ Typical โ”‚ Max  โ”‚ Unit โ”‚
    โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”ค
    โ”‚ tSCK (Clock period)โ”‚ 100  โ”‚   -     โ”‚  -   โ”‚  ns  โ”‚
    โ”‚ tCSS (CS setup)    โ”‚  50  โ”‚   -     โ”‚  -   โ”‚  ns  โ”‚
    โ”‚ tCSH (CS hold)     โ”‚  50  โ”‚   -     โ”‚  -   โ”‚  ns  โ”‚
    โ”‚ tSU (Data setup)   โ”‚  20  โ”‚   -     โ”‚  -   โ”‚  ns  โ”‚
    โ”‚ tH (Data hold)     โ”‚  20  โ”‚   -     โ”‚  -   โ”‚  ns  โ”‚
    โ”‚ tCSI (CS inactive) โ”‚ 100  โ”‚   -     โ”‚  -   โ”‚  ns  โ”‚
    โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”˜
```text

### Transaction Sequence

```text
    Complete Read/Write Sequence:

    Transaction 1: Write Command
    โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€
    MCU โ†’ IC:  [WRITE CMD: 0xXX + CRC + ADDR + DATA]
    IC โ†’ MCU:  [RESPONSE: Previous register state]
    
    Transaction 2: Read Back (optional verify)
    โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€
    MCU โ†’ IC:  [READ CMD: 0xXX + CRC + ADDR]
    IC โ†’ MCU:  [RESPONSE: Current register state]
    
    Timing:
    CSN  โ”   โ”Œโ”€โ”€โ”€โ”   โ”Œโ”€โ”€โ”€
         โ””โ”€โ”€โ”€โ”˜   โ””โ”€โ”€โ”€โ”˜
          T1      T2
          
    Notes:
    - Response to write contains previous value
    - Read returns current value from addressed register
    - Minimum 100ns between transactions
```text

## Transaction Examples

### Example 1: Initialize Global Configuration

```text
    Objective: Enable CRC, watchdogs, 3.3V VIO
    
    Register: GLOBAL_CONFIG (0x0002)
    Value: 0x4005 (CLK_WD_EN | SPI_WD_EN | CRC_EN)
    
    Transaction Breakdown:
    โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
    โ”‚ Step 1: Build MOSI frame                               โ”‚
    โ”‚   Address: 0x0002 โ†’ [23:17] = 0x00, [16] = 1 (write)  โ”‚
    โ”‚   Data: 0x4005                                         โ”‚
    โ”‚   Bytes for CRC: [0x02, 0x40, 0x05]                   โ”‚
    โ”‚   CRC: 0xDC (calculated)                               โ”‚
    โ”‚   Complete: 0xDC024005                                 โ”‚
    โ”‚                                                        โ”‚
    โ”‚ Step 2: SPI Transfer                                   โ”‚
    โ”‚   MOSI: 0xDC024005                                     โ”‚
    โ”‚   MISO: 0xXXXXXXXX (previous register value + status) โ”‚
    โ”‚                                                        โ”‚
    โ”‚ Step 3: Verify (optional)                              โ”‚
    โ”‚   Read back GLOBAL_CONFIG to confirm                   โ”‚
    โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

Example 2: Read Channel Status

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
    Objective: Read CH0 current setpoint
    
    Register: CH0_SETPOINT (0x0100)
    
    Transaction Breakdown:
    โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
    โ”‚ Step 1: Build MOSI frame                               โ”‚
    โ”‚   Address: 0x0100 โ†’ [15:0] = 0x0100, [16] = 0 (read)  โ”‚
    โ”‚   Bytes for CRC: [0x00, 0x01, 0x00]                   โ”‚
    โ”‚   CRC: 0xXX (calculated)                               โ”‚
    โ”‚   Complete: 0xXX000100                                 โ”‚
    โ”‚                                                        โ”‚
    โ”‚ Step 2: SPI Transfer                                   โ”‚
    โ”‚   MOSI: 0xXX000100                                     โ”‚
    โ”‚   MISO: 0xYY000567 (register value = 0x0567)          โ”‚
    โ”‚           โ””โ”€โ”ฌโ”€โ”˜                                        โ”‚
    โ”‚            CRC                                         โ”‚
    โ”‚                                                        โ”‚
    โ”‚ Step 3: Verify CRC & Extract Data                      โ”‚
    โ”‚   Status [21:17]: Check for errors                     โ”‚
    โ”‚   Data [15:0]: 0x0567 = current setpoint              โ”‚
    โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

Example 3: Error Handling

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
    Scenario: Write to read-only register
    
    Transaction:
      MOSI: Write to ICVID (0x0200, read-only)
      MISO: Status = 0b00011 (Write to RO register)
      
    Response Handling:
    โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
    โ”‚ Parse MISO frame:                                       โ”‚
    โ”‚   [31:24]: CRC โ†’ Verify                                โ”‚
    โ”‚   [23:22]: Reply Mode = 00 (normal)                    โ”‚
    โ”‚   [21:17]: Status = 0b00011 โ†’ ERROR!                   โ”‚
    โ”‚   [16]:    R/W echo                                     โ”‚
    โ”‚   [15:0]:  Undefined (ignore)                          โ”‚
    โ”‚                                                        โ”‚
    โ”‚ Error Response:                                         โ”‚
    โ”‚   - Retry not recommended                              โ”‚
    โ”‚   - Check register address                             โ”‚
    โ”‚   - Verify register is writable                        โ”‚
    โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

Best Practices

Transaction Management

  1. CRC Verification: Always verify outgoing CRC before transmission, verify incoming CRC after reception, and reject frames with CRC mismatch.

  2. Status Checking: After every transaction, parse the status field [21:17], handle errors appropriately, and log unexpected status codes.

  3. Timing Compliance: Ensure the minimum CS inactive time is 100 ns, maintain proper setup and hold times, and keep the clock frequency within limits.

  4. Error Recovery: On error, check the CRC first, verify the register address, retry with exponential backoff (maximum three attempts), and reset communication if the issue persists.

Performance Optimization

1
2
3
4
5
6
7
8
9
10
11
12
13
Recommended SPI Frequency:
โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚ Application         โ”‚ Frequency                        โ”‚
โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค
โ”‚ Debug/Development   โ”‚ 100-500 kHz (easier to debug)    โ”‚
โ”‚ Normal Operation    โ”‚ 1-2 MHz (good balance)           โ”‚
โ”‚ High Performance    โ”‚ 5-10 MHz (maximum throughput)    โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

Transaction Rate:
- 32 bits @ 1 MHz = 32 ยตs per transaction
- +100ns CS gap = ~33 ยตs total
- Max rate: ~30,000 transactions/second