Download and extract the reader ZIP archive (a compressed collection of files). Links labelled “reader ZIP; extract …” download this archive; after extraction, open the named file. It includes the offline article, full-size Portable Network Graphics (PNG) images, editable Scalable Vector Graphics (SVG) diagrams, complete source code, tests and worksheets.
Use two controlled bench nodes to distinguish observing a Controller Area Network (CAN) frame from acknowledging it. A listen-only node can fill its receive buffer while the sender reports a failed transmission.
Verification scope: the shared controller code has 34 host assertions using fake registers, and a separate logical model has 12 tests. No Arduino target build, real bus capture, oscillator qualification, physical test or production-network experiment was performed. The circuit is a locally prepared bench design.
The acknowledgement is part of the bus protocol
A Controller Area Network (CAN) carries framed messages between devices over a shared pair of wires. A frame packages an identifier, control information, optional data and error checks. Acknowledgement (ACK) is the receiver’s signal during the ACK slot: a correctly receiving, participating controller drives a dominant state there. It is not a response generated later by an Arduino sketch.
A dominant bus state represents logical 0 and overrides the recessive state, logical 1, when nodes drive together. The transmitter sends a recessive ACK slot and checks whether another node made it dominant. An unacknowledged transmission is not a success just because one monitoring application displays its bytes. ACK also does not prove that a particular application consumed those bytes or that the identifier passed that application’s filters.
The MCP2515’s listen-only mode suppresses its transmissions, ACK signals and error flags. Its error counters are inactive in this mode. The controller may receive invalid as well as valid messages, so a printed receive buffer is especially weak evidence of a successful transmission. In normal mode it participates in acknowledgement and error handling even if the sketch never calls a send function. These mode rules come from Microchip’s MCP2515 data sheet, DS20001801K, sections 10.3–10.5.
Build an isolated two-node fixture
This experiment uses two Arduino UNO Rev3 boards. Each has a Microchip MCP2515-I/P CAN controller in an 18-pin Plastic Dual In-line Package (PDIP), and an MCP2562-E/P physical transceiver in PDIP-8. A transceiver converts the controller’s logic signals into differential wire voltages and back. The controller is not a direct CAN wire driver. The MCP2562 is the variant with VIO, the supply for its digital input/output logic; MCP2561 has a different pin 5 function and is not the illustrated part.
Use two genuine controllers with revision B4 or later, identified through the manufacturer’s marking guidance in silicon errata DS80000179H, Appendix B. That document maps B4 to the 0538 date-code transition; confirm the full marking and supplier provenance rather than treating an unverified marketplace label as a silicon revision. Record markings in the worksheet. No installed devices were inspected during this preparation.
Each node needs the two chips, one ECS ECS-160-20-4X 16 MHz fundamental quartz crystal, two 33 pF ceramic capacitors, one 2.2 MΩ feedback resistor, one 10 kΩ reset pull-up and two 100 nF ceramic decoupling capacitors. Use two 120 Ω, 1%, 0.25 W bus terminators for the whole bus, a 0.5 m twisted pair for CANH/CANL, a ground wire, short local logic wiring and a USB cable for each UNO. USB means Universal Serial Bus; each cable powers and programs its own UNO. Do not join their two +5 V outputs.
VDD names the positive power-supply pin, and VSS names the ground supply pin. The MCP2515 operates from 2.7–5.5 V; this fixture uses nominal 5 V. The MCP2562 requires VDD in its 4.5–5.5 V operating range and VIO in its specified logic-supply range; both are tied to the same local 5 V rail. Do not power VDD from the UNO’s 3.3 V output. The transceiver’s bus-fault absolute maxima are survival ratings, not permission to apply external power to CANH or CANL. The current product-linked MCP2561/2 data sheet DS20005167C is the pin and supply reference.
Keep this fixture disconnected from vehicles, appliances and every other network. All application sends require the single-letter manual command below. Listen-only is a controller mode, not galvanic isolation: the transceiver, ground connection, cable and terminators still electrically load the wires.
Exact node wiring and the two end terminators
The Serial Peripheral Interface (SPI) is the local clocked link between each UNO and its MCP2515. Serial clock (SCK) times bits. Controller Out Peripheral In (COPI) carries UNO output to the peripheral’s Serial Input (SI). Controller In Peripheral Out (CIPO) returns Serial Output (SO). Older UNO drawings may label COPI/CIPO as MOSI/MISO, meaning Master Out Slave In/Master In Slave Out. Chip Select (CS) is active low and brackets one command.
| Signal or part | Per-node endpoints |
|---|---|
| Power and ground | UNO +5 V → MCP2515 pin 18 VDD; MCP2562 pins 3 VDD and 5 VIO. UNO GND → MCP2515 pin 9 VSS; MCP2562 pins 2 VSS and 8 STBY. |
| SPI | UNO D13 → MCP2515 pin 13 SCK; D11 → pin 14 SI; D12 ← pin 15 SO; D10 → pin 16 CS. |
| Local transmit/receive | MCP2515 pin 1 TXCAN → MCP2562 pin 1 TXD; MCP2562 pin 4 RXD → MCP2515 pin 2 RXCAN. |
| Clock | Crystal between MCP2515 pin 8 OSC1 and pin 7 OSC2. R2 2.2 MΩ across these pins. C3 33 pF from pin 8 to GND; C4 33 pF from pin 7 to GND. |
| Reset and support | R1 10 kΩ from MCP2515 pin 17 RESET to +5 V. C1 100 nF between MCP2515 pins 18/9. C2 100 nF between MCP2562 pins 3/2, with VIO joined locally to VDD. |
| Unused MCP2515 pins | Pins 4/5/6 request inputs are left unconnected, using their documented internal pull-ups; software disables their request function. Pins 3 CLKOUT, 10 RX1BF, 11 RX0BF and 12 INT are unconnected outputs. The sketch polls registers. |
| Bus | Node A MCP2562 pin 7 → CANH → node B pin 7. Pin 6 → CANL → node B pin 6. Join both node grounds. One 120 Ω resistor spans CANH/CANL at each cable end. |
VSS is the ground supply pin; VDD is the positive supply. STBY means standby. Holding the MCP2562 STBY pin low keeps its high-speed receiver active; its standby mode is not a substitute for the controller’s listen-only mode. NC means no connection. Matching named ports in the original schematic identify one connected net.
— reader ZIP; extract assets/mcp2515-uno-node.pngassets/mcp2515-uno-node.svg · Full size — reader ZIP; extract assets/mcp2515-uno-node.pngCheck the oscillator and calculate the bit timing
The selected crystal specifies 20 pF load capacitance. An initial estimate is CL ≈ C3 × C4/(C3 + C4) + Cstray. With two 33 pF parts and an assumed combined stray capacitance of 3.5 pF, CL ≈ 16.5 + 3.5 = 20 pF. Stray capacitance is the unintended capacitance from pins and layout; it was not measured. The 2.2 MΩ feedback resistor is within the controller data sheet’s 2–10 MΩ guidance.
These are starting component values, not an oscillator qualification. Keep the loop short on a soldered adapter or compact prototype board; long breadboard wires are poor crystal wiring. Verify start-up and frequency over the intended supply and temperature range. The crystal’s specified maximum drive is 500 μW; if drive testing indicates overdrive, a series damping resistor and a new start-up check are required. This package has no drive-power measurement and does not establish that zero series resistance is correct for every layout. Probe loading itself can disturb the oscillator. A mode register that reads back correctly does not prove frequency accuracy.
A time quantum (TQ) is the controller’s basic bit-timing interval. With oscillator frequency Fosc = 16 MHz and the Baud Rate Prescaler (BRP) register field equal to 3, TQ = 2 × (BRP + 1)/Fosc = 0.5 μs. The configured bit contains a 1 TQ synchronization segment, 5 TQ propagation segment, 6 TQ first phase segment and 4 TQ second phase segment: 16 TQ = 8 μs, or 125,000 bits/s. The sample point is after 1 + 5 + 6 = 12 TQ, or 75% of the bit.
The Synchronization Jump Width (SJW), the maximum phase correction at an edge, is 1 TQ. The configuration bytes are CNF1=0x03, CNF2=0xAC and CNF3=0x03, including the programmable second phase segment and one sample per bit. Both nodes must use the same oscillator and timing settings. A board with an 8 MHz crystal would run at 62.5 kbit/s with these bytes. This short bench choice is not a validated timing budget for a long cable.
With power removed, two 120 Ω terminators in parallel predict 60 Ω between CANH and CANL. The prediction can be affected by connected electronics; use resistance mode only on the unpowered fixture. At an illustrative 2 V differential level, each terminator dissipates 2²/120 = 33 mW. That nominal calculation is not a measured transceiver output or a worst-case fault-energy rating.
Load the complete shared listener and controlled sender
Open code/CanAckLab/CanAckLab.ino in the Arduino Integrated Development Environment (IDE), using Arduino AVR Boards 1.8.6 and the UNO board selection. AVR is the microcontroller architecture family used by this UNO. The required mcp2515_lab.h is supplied in the same sketch directory; it is byte-identical to the host-tested copy in code/. The built-in SPI library is the only Arduino library dependency. Upload this same sketch to both boards and open each serial monitor at 115200 bits/s.
The sketch defaults to listen-only, reads CANSTAT’s actual operating-mode bits and requires a mode change to complete within 100 ms. The command l selects listen-only; n selects normal participation; s requests exactly one standard 11-bit identifier 0x321 data frame with one incrementing byte. Sending is refused outside normal mode. Both boards can therefore serve as the listener or controlled sender without a hidden second sketch.
One-shot mode prevents automatic retransmission after an unsuccessful attempt. Only transmit buffer 0 is used and pending requests cannot be overwritten. The completion check requires its request bit to clear, its successful-transmit flag to be set and its error/abort/arbitration flags to be clear. A 100 ms pending deadline requests an abort; an incomplete abort stops the fixture until reset. The timeout is a diagnostic choice, not an observed bus latency.
The errata’s overlapping-buffer reprioritization is avoided by one outstanding buffer. The sketch uses SPI mode 0 and the Request-To-Send (RTS) command with CS raised immediately, addressing the documented repeated-request hazard. Buffer 0 also avoids the older buffer-1/2 corruption condition; requiring B4 or later addresses the separate older identifier corruption condition. This lesson does not enter sleep, and the old sleep-oscillator issue is outside its operating mode. These measures do not constitute a complete device certification.
mcp2515_lab.h
#ifndef MCP2515_LAB_H
#define MCP2515_LAB_H
#include <stdint.h>
struct Frame {uint32_t id;uint8_t data[8],length,rawLength;bool extended,remote;};
enum class TxResult {Pending,Success,Failed};
// Port supplies read/write/modify, reset, rts0, ms and wait. One exclusive owner.
template<class Port> class MCP2515 {
Port &p;
public:
explicit MCP2515(Port &port):p(port){}
bool mode(uint8_t requested){
p.modify(0x0f,0xe0,requested);
uint32_t start=p.ms();
while((p.read(0x0e)&0xe0)!=requested){
if(uint32_t(p.ms()-start)>=100)return false;
p.wait(1);
}
return true;
}
bool begin(){
p.reset();p.wait(10);
if(!mode(0x80))return false;
// 16 MHz oscillator: TQ=.5 us; 1+5+6+4=16 TQ; 125 kbit/s.
p.write(0x2a,0x03);p.write(0x29,0xac);p.write(0x28,0x03);
p.write(0x60,0x64);p.write(0x70,0x60); // all frames, rollover
p.write(0x0c,0);p.write(0x0d,0); // buffer-full outputs / RTS inputs disabled
p.write(0x2b,0);p.write(0x2c,0); // polling, clear flags
p.modify(0x0f,0x0c,0x08); // one shot, CLKOUT disabled
return mode(0x60); // safe default: listen-only
}
bool send0(uint16_t id,uint8_t value){
if(id>0x7ff||(p.read(0x0e)&0xe0)!=0||p.read(0x30)&8)return false;
p.write(0x30,0); // TXB0 only; no overlapping pending buffers
p.modify(0x2c,4,0); // clear prior TX0IF
p.write(0x31,uint8_t(id>>3));p.write(0x32,uint8_t((id&7)<<5));
p.write(0x33,0);p.write(0x34,0);p.write(0x35,1);p.write(0x36,value);
p.rts0();return true;
}
TxResult transmitResult(){
uint8_t s=p.read(0x30);
if(s&8)return TxResult::Pending;
if((s&0x70)==0&&(p.read(0x2c)&4))return TxResult::Success;
return TxResult::Failed;
}
bool receive(Frame &f){
uint8_t flags=p.read(0x2c);uint8_t flag,base;
if(flags&1){flag=1;base=0x61;}else if(flags&2){flag=2;base=0x71;}else return false;
uint8_t sidh=p.read(base),sidl=p.read(base+1);
f.extended=(sidl&8)!=0;
if(f.extended)f.id=(uint32_t(sidh)<<21)|(uint32_t(sidl&0xe0)<<13)|
(uint32_t(sidl&3)<<16)|(uint32_t(p.read(base+2))<<8)|p.read(base+3);
else f.id=(uint16_t(sidh)<<3)|(sidl>>5);
uint8_t dlc=p.read(base+4);f.rawLength=dlc&15;
f.length=f.rawLength>8?8:f.rawLength;
// Standard-frame RTR appears in RXBnSIDL.SRR; extended in RXBnDLC.RTR.
f.remote=f.extended?(dlc&0x40)!=0:(sidl&0x10)!=0;
for(uint8_t i=0;i<8;i++)f.data[i]=(i<f.length&&!f.remote)?p.read(base+5+i):0;
p.modify(0x2c,flag,0);return true;
}
};
#endif
CanAckLab.ino
// Arduino UNO Rev3; Arduino AVR Boards 1.8.6; built-in SPI library.
// Identical complete sketch on A and B. No automatic transmissions.
#include <SPI.h>
#include "mcp2515_lab.h"
const uint8_t CS_PIN=10;
struct UnoPort {
void select(){SPI.beginTransaction(SPISettings(1000000,MSBFIRST,SPI_MODE0));digitalWrite(CS_PIN,LOW);}
void release(){digitalWrite(CS_PIN,HIGH);SPI.endTransaction();}
void reset(){select();SPI.transfer(0xc0);release();}
uint8_t read(uint8_t a){select();SPI.transfer(3);SPI.transfer(a);uint8_t v=SPI.transfer(0);release();return v;}
void write(uint8_t a,uint8_t v){select();SPI.transfer(2);SPI.transfer(a);SPI.transfer(v);release();}
void modify(uint8_t a,uint8_t mask,uint8_t v){select();SPI.transfer(5);SPI.transfer(a);SPI.transfer(mask);SPI.transfer(v);release();}
void rts0(){select();SPI.transfer(0x81);release();} // errata: Mode 0, CS ends immediately
uint32_t ms(){return millis();}
void wait(uint16_t n){delay(n);}
};
UnoPort port;MCP2515<UnoPort> can(port);
bool ready=false, pending=false;uint8_t value=0;uint32_t sentAt=0;
void setup(){
pinMode(CS_PIN,OUTPUT);digitalWrite(CS_PIN,HIGH);SPI.begin();Serial.begin(115200);
ready=can.begin();
Serial.println(ready?F("Listen-only. l=listen, n=normal ACK, s=one send in normal"):F("FAULT: mode setup failed; check clock/wiring"));
}
void loop(){
if(!ready)return;
if(Serial.available()){
char c=Serial.read();
if((c=='l'||c=='n')&&!pending){
if(!can.mode(c=='l'?0x60:0)){ready=false;Serial.println(F("FAULT: mode timeout"));}
else Serial.println(c=='l'?F("Listen-only verified"):F("Normal verified: hardware may ACK valid frames"));
}
if(c=='s'&&!pending){
if(can.send0(0x321,value++)){pending=true;sentAt=millis();}
else Serial.println(F("Send refused: select normal, wait for pending request"));
}
}
Frame f;
while(can.receive(f)){
Serial.print(F("RX buffer (not proof of ACK/validity): id=0x"));Serial.print(f.id,HEX);
Serial.print(f.extended?F(" extended"):F(" standard"));
Serial.print(f.remote?F(" remote"):F(" data"));Serial.print(F(" raw DLC="));Serial.print(f.rawLength);
for(uint8_t i=0;i<f.length&&!f.remote;i++){Serial.print(' ');Serial.print(f.data[i],HEX);}
Serial.println();
}
if(pending){
TxResult r=can.transmitResult();
if(r!=TxResult::Pending){
Serial.println(r==TxResult::Success?F("TX success: controller completed; application receipt unproven"):F("TX failed: inspect flags/wiring/mode, no auto retry"));pending=false;
}else if(uint32_t(millis()-sentAt)>=100){
port.modify(0x0f,0x10,0x10);delay(2); // abort all
if(port.read(0x30)&8){ready=false;Serial.println(F("FAULT: abort incomplete; reset fixture"));}
else {port.modify(0x0f,0x10,0);Serial.println(F("TX timeout, aborted; no auto retry"));}
pending=false;
}
if(!pending){
Serial.print(F("TXB0CTRL=0x"));Serial.print(port.read(0x30),HEX);
Serial.print(F(" CANINTF=0x"));Serial.print(port.read(0x2c),HEX);
Serial.print(F(" TEC="));Serial.print(port.read(0x1c));
Serial.print(F(" REC="));Serial.print(port.read(0x1d));
Serial.print(F(" EFLG=0x"));Serial.println(port.read(0x2d),HEX);
}
}
// RX overflow is evidence of loss, not permission to call a capture complete.
uint8_t e=port.read(0x2d);
if(e&0xc0){Serial.println(F("FAULT: RX overflow; capture incomplete"));port.modify(0x2d,0xc0,0);}
}

assets/two-node-ack-slot.svg · Full sizeRun the two comparisons, changing only node B’s mode
- With both USB cables removed, check orientation, rails, crystal circuit and the two terminators. Confirm CANH goes to CANH, CANL to CANL and the grounds join. Do not tie +5 V outputs together. Record the unpowered resistance and device markings in the blank observation sheet — reader ZIP; extract
data/bench-observations.csv. - Power both nodes and read each startup line. A failed setup is a fault to resolve before sending. Both should initially report listen-only. If the clock cannot be qualified, stop before treating the results as a CAN experiment.
- On A send
n; leave B in listen-only. On A sendsonce. Record A’s completion status and flags, and any B receive-buffer line. Expect no ACK from B. Reception may include an invalid frame and is not guaranteed to produce a useful printout. - Reset the fixture if a previous fault stopped it. Select
non both boards, then send oneson A. Under correct wiring and timing, B should participate in ACK automatically, and A should report success. B’s sketch does not need to transmit an application frame to do this. - Set B back to
land repeat one attempt. Restore the failure condition while leaving wiring and timing unchanged. Record multiple isolated trials; never infer all trials from one line. - Stop and power down before altering a cable or terminator. Preserve the original fixture after the experiment; do not try this change on a live system.
The printed transmit error counter (TEC), receive error counter (REC) and error-flag register (EFLG) provide diagnostic context. Do not expect them to be meaningful fault counters in listen-only mode. Do not repeatedly force ACK failures to chase a particular counter value: error confinement depends on error type and state, and this lesson does not model those rules or assert that every no-ACK trial causes bus-off.
Interpret the observations without overstating them
| Observation | Supported interpretation |
|---|---|
| B prints bytes while A fails | Buffer reception is not evidence of ACK. Check that B really reads back listen-only and that no other participating node exists. |
| A succeeds with B normal | The controller completed a transmission with bus acknowledgement under its protocol checks. This is not proof that B’s application saved or acted on the payload. |
| A succeeds with B listen-only | Investigate another node, a wrong mode/readback, loopback or wrong fixture. A genuine sole listener is not the ACK source. |
| Both comparisons fail | Check mode, power, reset, oscillator frequency, bit timing, CANH/CANL, common ground and termination. The absence of ACK alone does not identify which fault exists. |
| Receive overflow is reported | The capture is incomplete. The two receive buffers and a slow serial log cannot guarantee lossless monitoring. |
The receive decoder prints standard or extended identifiers and remote-frame status. The Data Length Code (DLC) describes the data length in the frame. In listen-only, malformed input may leave a raw DLC above eight; the decoder clamps array access and reports the raw value. Remote frames request data and contain no payload in this decoder. An identifier is a message label, not an address proving which application received it. The controller’s Cyclic Redundancy Check (CRC), an error-detecting calculation, is part of normal validity checking; this software does not independently verify the physical frame’s CRC.
Run the supplied offline checks
From the extracted reader directory:
python3 -m unittest discover -s code -p 'test_*.py' -v
python3 code/ack_model.py
c++ -std=c++11 -Wall -Wextra -pedantic code/test_mcp2515.cpp -o host-tests
./host-tests
The C++ suite exercises the exact core included by the Arduino sketch through fake register operations: setup, mode readback, stuck-mode deadline including unsigned clock wrap, rejected sends, buffer ownership, transmit-result classification, standard/extended receive parsing, malformed length and timing arithmetic. The separate Python model tests logical ACK eligibility, including filter rejection, wrong bit rate and invalid-frame controls. It does not simulate the MCP2515’s electrical bus, oscillator, CRC engine, error frames or error-confinement state machine. The Arduino SPI adapter and target sketch have not been compiled with an AVR compiler in this preparation.
Challenge: can a rejected identifier still be acknowledged?
Node B is normal, electrically receives a valid frame at the correct bit rate, but its acceptance filter rejects the identifier. Must A report an ACK failure?
Answer
No. Acceptance filtering selects which valid messages enter receive buffers; it does not make normal mode silent. B can acknowledge a valid frame without delivering it to the application. To observe without protocol participation, select and verify listen-only. That mode still does not remove the transceiver’s physical electrical loading.
Sources and reader files
The source index — reader ZIP; extract source-index.html identifies exact current manufacturer documents and official UNO pins. The reader includes Hypertext Markup Language (HTML) pages, Portable Network Graphics (PNG) figures and their Scalable Vector Graphics (SVG) editable originals, full target code, offline tests and a blank comma-separated values (CSV) observation sheet. README.txt — reader ZIP; extract README.txt lists exact paths. Constructed outputs are labelled and are not bench results.
No canonical article URL, native publication, target compilation, measured waveform or Facebook delivery is included in this local preparation. Circuitpedia terms are proposals awaiting the coordinated multilingual workflow.