You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Common host interfaces: APB, AHB, AXI, Wishbone, custom bus.
146
+
147
+
### 5.9 Debug & Test Support
148
+
149
+
Loopback modes (internal/external), timestamping, trace buffers, test registers, and statistics counters.
150
+
151
+
## 6. Data Flow — Transmit Path
152
+
153
+
-`Frame creation`: CPU/DMA writes identifier, DLC, data bytes into transmit mailbox or FIFO, sets a request_to_send bit.
154
+
155
+
-`Priority selection`: If multiple mailboxes present, the TX arbiter selects the highest priority pending frame.
156
+
157
+
-`Start-of-transmission`: On bus idle, the TX logic issues SOF and starts serializing fields.
158
+
159
+
-`Arbitration`: TX unit drives each identifier bit on the bus while sampling. If a recessive bit is observed while transmitter drove dominant, that node loses arbitration and moves to listening mode — it will retry later automatically.
160
+
161
+
-`Frame stuffing & CRC`: Transmit side inserts stuff bits and appends CRC.
162
+
163
+
-`ACK handling`: After CRC delimiter, transmitter samples the ACK slot — if no node drove ACK (i.e., ACK remains recessive), transmitter marks the frame as not acknowledged (error handling).
164
+
165
+
-`Retransmission / Error handling`: On failure (e.g., no ACK, detected error), hardware automatically retries transmission up to configured attempts, while updating TEC/REC and possibly entering error passive/bus-off states.
166
+
167
+
-`Completion`: On success, TX mailbox flagged complete, interrupt raised if enabled.
168
+
169
+
## 7. Data Flow — Receive Path
170
+
171
+
-`Bit sampling & synchronization`: BTU provides sample points; the receiver samples the bus and synchronizes on SOF.
172
+
173
+
-`De-stuffing`: Receiver removes stuff bits inserted by transmitter (counts consecutive bits and drops inserted bits).
174
+
175
+
-`Field demarcation & CRC check`: Bits are collected into identifier, control, data, CRC and CRC is checked on the fly or after reception.
176
+
177
+
-`Acceptance filter`: If the frame matches a filter, it is moved to a RX mailbox or FIFO; otherwise discarded.
178
+
179
+
-`ACK generation`: If CRC OK, receiver asserts ACK by driving dominant in the ACK slot.
180
+
181
+
-`Host notification`: RX mailbox ready flag and interrupt triggered; CPU reads data from RX mailbox.
182
+
183
+
## 8. Arbitration & Determinism
184
+
185
+
Bitwise arbitration compares transmitted bits on the bus with the node's expected bit. Dominant wins — nodes that lose arbitration cease transmitting immediately, preserving bus time and determinism.
186
+
187
+
Deterministic behavior: Priority is solely identifier-based. Lower numerical ID = higher priority.
188
+
189
+
## Error Detection & Handling (High-level)
190
+
### 9.1 Error detection mechanisms
191
+
192
+
Bit monitoring: Transmitting node monitors bus to detect if what it sent differs from actual bus state.
193
+
194
+
Bit stuffing errors: Detected if more than five identical consecutive bits appear without a stuff bit.
195
+
196
+
Format errors: Wrong fixed-format fields (e.g., wrong delimiter values).
197
+
198
+
ACK error: No receiver asserted ACK.
199
+
200
+
CRC error: CRC mismatch detected by receiver.
201
+
202
+
### 9.2 Error counters & states
203
+
204
+
Transmit Error Counter (TEC) and Receive Error Counter (REC) are incremented/decremented following specified rules.
205
+
206
+
Node states: Error Active → Error Passive → Bus Off. Bus-Off requires recovery sequence (e.g., 128 occurrences or vendor-specific behavior).
207
+
208
+
### 9.3 Retransmission
209
+
210
+
On detected transmission errors, hardware typically attempts automatic retransmission until successful or until bus-off threshold hit.
211
+
212
+
## 10. Timing Considerations & Bit Timing Configuration
213
+
214
+
- Bit time divided into: SYNC_SEG (1 Tq), PROP_SEG, PHASE_SEG1, PHASE_SEG2.
215
+
216
+
- Sample point typically around 70–80% of bit time for single-sample nodes, or triple-sampling near sample point for improved noise immunity.
217
+
218
+
- Tolerance & synchronization: Resynchronization allowed by phase segments and sample point adjustments using SJW (synchronization jump width).
219
+
220
+
- Configuration registers: prescaler, prop, phase1, phase2, SJW — must be set according to bus length, node count and bit rate to meet ISO timing constraints.
221
+
222
+
## 11. Implementation Notes for RTL / FPGA
223
+
224
+
Clocking: Use a high-frequency clock and a BTU to derive sample ticks; avoid metastability with proper synchronizers on async RX input.
225
+
226
+
FIFO Depths: Size TX/RX FIFO based on expected peak traffic and interrupt latency.
227
+
228
+
Hardware Filters: Implement simple mask+filter for low complexity; implement CAM or hash filters for higher performance.
229
+
230
+
Test modes: Provide internal loopback (no transceiver) and external loopback for validation.
231
+
232
+
Formal checks: Add assertions for frame format, FIFO overflow/underflow, error counter thresholds.
0 commit comments