CAN bus/How the bus decides/04. Every message is acknowledged
How the bus decides · 04 of 9

Every message is acknowledged

Near the end of every CAN frame there is one bit the sender leaves for somebody else: any board that received the frame intact drives it dominant. With no other board on the bus, nobody does, and the sender counts an error and sends the same frame again, for ever. One board on its own can never finish a message.

The ACK slot

A CAN frame is a start bit, the identifier, a length, up to eight data bytes, a checksum, and then one bit the sender leaves recessive: the ACK slot. Every other board that received the frame with a correct checksum drives that bit dominant, and the sender reads it back.

Somebody has to answer
sending
Other boards on the bus
Attempts
1
Transmit errors
0
Error-passive at
128
Acknowledged. Every other board that received the frame intact drives the ACK slot, whether or not the message was meant for it. One listener is enough, and it does not have to do anything in its sketch: its CAN controller answers by itself.

A dominant ACK means at least one board heard the frame intact. It does not say which, or whether that board wanted the message: any running CAN controller acknowledges every good frame by itself.

A board alone

With no other board, the ACK slot stays recessive. The sender flags an acknowledgement error, adds 8 to its transmit error counter, and sends the same frame again, straight away. At 128 it becomes error-passive, and from then on a missing acknowledgement no longer counts, so it goes on resending the frame indefinitely.

That is the first thing that surprises everybody: one board cannot test itself on the bus. Plug in a single TK109, run a sender, and its error count climbs to 128 and stays there. Nothing is broken. It is waiting for somebody to say yes.

The second board

It needs no special code. Any sketch that installs and starts the CAN controller at the same bit rate acknowledges every frame on the bus. The first message uses one sketch for both boards, with a line that says which one sends.

When it does not work

I wired one board to one ESP32 and the sender's error count keeps climbing.

That is what a lone CAN node does. Nobody acknowledges its frames, so it resends each one and adds 8 to its transmit error counter every time, up to 128. Add a second board and a second ESP32 running any sketch that starts its CAN controller.

The receiver's sketch does nothing with the message. Does it still acknowledge?

Yes. The acknowledgement comes from the CAN controller, as soon as it has started, whether or not the sketch ever reads the frame or its filter would have thrown it away.

Can I test one board without a second?

The ESP32's TWAI driver has a mode for it, TWAI_MODE_NO_ACK, which sends without waiting for an acknowledgement, and a frame sent with its self-reception flag set comes back to the sender's own receiver. That proves the controller and the wiring to the chip, not the bus. The honest test of a CAN bus is two boards.

Where this goes next

What the resistor fitted on every board does, and why only two keep it.

The 120 Ω resistor

Edit this page — content/books/can-bus/every-message-is-acknowledged.mdx

Community

Questions about this product

See what other owners have asked, and read their solutions.

Ask a question ↗

CAN Bus

Loading discussions…

Discuss this article

Ask about this page. The answer stays here, on the page it belongs to, for whoever hits the same wall next.

Browse Modules and blocks on the forum