FlexCan -Does anyone have an example of reading OBD engine error codes/messages?

Hi All,

I’ve been playing around with a CAN simulator and my own design of OBD reader to build an interface for my car, and I have succeeded (I think) in pulling out the PID values as I require, but I’m unsure of how to handle error codes or messages from the ECU. Does anyone have any example code or help they can give to point me in the right direction?

I’ll attach an example of the code I’m using to read… I’m not really sure where to start with this next part…

CAN_Reader_Code.ino (4.36 KB)

N_ECU_R.cpp (4.41 KB)

N_ECU_R.h (1.81 KB)



Have you tried using the forum search function for "OBD"?

Yes, but not found much to go on... Mostly I seem to find people unsure of which version of flexcan to use, and a couple of projects that were trying to read OBD but gave up and decided to interface with ELM327.

Not found much in terms of example code.

I started with SkPang's reader code and have expanded it to read a few more PIDs and this works great, and I've read up on the OBD page on wikipedia on how it's done and it almost makes sense but I can't quite connect the dots...

looking at the skpang reader cpp, I can see how it's reading the PIDs, but I'm not sure how to add on another if statement to identify DTCs to display them and am struggling to find any examples to follow. The other useful thing would be being able to send a clear fault code message but maybe one step at a time...