I have understood the CAN error handling but I am confused about whether these error handling mechanisms are implemented in software or hardware of CAN controllers.
More specifically I want to know where the overload frames part of CAN 2.0 specification is implemented. If a hijacked/re-programmed ECU wanted to DoS the CAN bus via overload frames but according to the CAN specification only 2 OFs can be sent by a node. So where is this counter implemented? If it is just a register then it can be overwritten the same way other DoS exploits using error frames on CAN bus have been doing till now right? But if it is some internal circuit seeing that 2 frames were sent and then turns off overload frame circuitry then we can't help it right?
Also if OF is implemented in hardware, does it mean we can't generate them using software directly?
Also what about this whole thing in MCUs with integrated CAN Controllers, is it a hardware based implementation there too?
In all, please just let me know what aspects of CAN Specification are implemented in hardware directly and what in software. Thank you.
P.S. I didn't find any code in open-source RTOS projects CAN drivers(MCP2515) that handle overload frames, but I am pretty bad at C programming too so I might have missed it, please help a fellow out.