Question re./ CANBus Ack conventions

Introduction and miscellaneous that we haven't created categories for, yet
Post Reply
mikeselectricstuff
Posts: 120
Joined: Sun Nov 08, 2020 11:33 am
Been thanked: 2 times

Question re./ CANBus Ack conventions

Post by mikeselectricstuff »

I'm totally new to CABbus, but have extensive experience reverse engineering other things.
I was wondering if there was a general convention in car applications for how Acks are generated.
Seems that there are many cases where sensors etc. spit out their data, and multiple devices can make use of that data.
Is there any convention on which nodes send Acks to these packets?
Possible scenarios I can envisage are
1) All devices Ack all received packets
2) All devices which are interested in that ID send an Ack (I'd imagine it doesn't look at validity of parameters etc. as there isn't time)
3) One specific "primary" device that makes use of that ID sends an Ack
4) Only the gateway sends an Ack
5) It's a big old mess, every manufacturer does it different, with lots of fudges and special cases

If(2) is the case, it seems that would be very useful for reversing a device to see which IDs it's interested in.
User avatar
celeron55
Posts: 774
Joined: Thu Jul 04, 2019 3:04 pm
Location: Finland
Has thanked: 27 times
Been thanked: 110 times
Contact:

Re: Question re./ CANBus Ack conventions

Post by celeron55 »

I just checked the MCP2515 datasheet and it says: "The final field is the two-bit Acknowledge (ACK) field. During the ACK Slot bit, the transmitting node sends out a recessive bit. Any node that has received an error-free frame acknowledges the correct reception of the frame by sending back a dominant bit (regardless of whether the node is configured to accept that specific message or not)."

Wikipedia seems to agree? At least it doesn't say otherwise: "Each node that receives the frame, without finding an error, transmits a dominant level in the ACK slot and thus overrides the recessive level of the transmitter."

If someone knows about automotive stuff specifically, that would be useful.
mikeselectricstuff
Posts: 120
Joined: Sun Nov 08, 2020 11:33 am
Been thanked: 2 times

Re: Question re./ CANBus Ack conventions

Post by mikeselectricstuff »

OK so that implies that Acks are a low-level CAN thing, as opposed to a higher level application-dependent behaviour.
Isaac96
Posts: 656
Joined: Sat Oct 05, 2019 6:50 pm
Location: Northern California, USA
Been thanked: 1 time
Contact:

Re: Question re./ CANBus Ack conventions

Post by Isaac96 »

It seems to be low level, yes. A CAN controller can also be configured to 'silent' mode where it will not send ACK bits -- this can be useful if you don't want to disturb a system but still want data.
The MCP2515 will go into an error state if it does not receive any ACK bits after 255(?) messages - I believe it's "bus-off" state. It's a pain when testing if you don't want to have to hook up something else on the bus.
User avatar
johu
Site Admin
Posts: 5684
Joined: Thu Nov 08, 2018 10:52 pm
Location: Kassel/Germany
Has thanked: 153 times
Been thanked: 960 times
Contact:

Re: Question re./ CANBus Ack conventions

Post by johu »

Additionally, when no one sends an ACK the sender will repeat the message indefinitely. Happens if you have your DUT hooked up to only a logic analyzer. Can only be fixed by recompiling the senders software to setup CAN hardware to not retransmit lost frames.
Support R/D and forum on Patreon: https://patreon.com/openinverter - Subscribe on odysee: https://odysee.com/@openinverter:9
mikeselectricstuff
Posts: 120
Joined: Sun Nov 08, 2020 11:33 am
Been thanked: 2 times

Re: Question re./ CANBus Ack conventions

Post by mikeselectricstuff »

johu wrote: Tue Jun 29, 2021 4:26 pm Additionally, when no one sends an ACK the sender will repeat the message indefinitely. Happens if you have your DUT hooked up to only a logic analyzer. Can only be fixed by recompiling the senders software to setup CAN hardware to not retransmit lost frames.
..or maybe just hook any other CAN device on the bus to genaerate the ACKs ?
User avatar
johu
Site Admin
Posts: 5684
Joined: Thu Nov 08, 2018 10:52 pm
Location: Kassel/Germany
Has thanked: 153 times
Been thanked: 960 times
Contact:

Re: Question re./ CANBus Ack conventions

Post by johu »

Yes, if you have one at hand
Support R/D and forum on Patreon: https://patreon.com/openinverter - Subscribe on odysee: https://odysee.com/@openinverter:9
User avatar
EV_Builder
Posts: 1199
Joined: Tue Apr 28, 2020 3:50 pm
Location: The Netherlands
Has thanked: 16 times
Been thanked: 33 times
Contact:

Re: Question re./ CANBus Ack conventions

Post by EV_Builder »

It's a feature which is done on hardware level but is controlled by software. I think if you don't set the RTR bit it won't happen anyway. CanBus is a broadcast network so everybody writes and reads.
Hardware takes care of the implied challenges.
Converting an Porsche Panamera
see http://www.wdrautomatisering.nl for bespoke BMS modules.
Post Reply