Hi! I'm trying to create a new CANBUS line with Arduino in my car to manage sensors and aftermarket units I've added or built. My idea is to add an additional OBD-II diagnostic port and, using a tool like Torque, create a list of custom PIDs and fault codes so that, in case of an error, I can try to analyze where the problem is.
The only issue I have is figuring out how to create a fault code like P1234 or C9130 following the fault code standard. I know how to create PIDs and send information between Arduinos, which is OBD-II "Mode 1," but I don't know how to manage "Mode 3" and "Mode 4" with Arduino. Has anyone made some kind of ECU emulator with faults? I know people who have created extra units and made them work with Torque, and I have too, but I want to add the diagnostics and fault-clearing functions. A simple example would be ideal, as I could deepen my understanding starting from that example.
Thanks in advance!
Cheers!