CAN Bus Example to Read Engine RPM, Speed from ECU 2000 Simulator Hardware

I am new to CAN Bus communication and need help with a basic example to read few parameters from a simulator. I have purchased the ECUSim 2000, device that has basic and advanced information. ( ), image attached.

The protocol on the device is setup as follows:

OBD Protocol ISO 15765-4
CAN ID Type 11 bit
CAN Baud Rate 250.0 kbps

(it also supports 29bit type and 500Kbps)

It has the following ECUs:
0 ECU1-EngineControl 7E0,7DF
1 ECU2-Transmission 7E1,7DF
2 ECU3-AbsControl 7E2,7DF

How do a write a simple CAN Message to read the engine RPM, or speed, or anyting. I am using the G120 on a custom board with the SN65HVD230QD CAN transceiver IC, and have option for the 120Ohm resistor if needed in the circuit to be used or not.

When I try to run the simple example CAN code from the support section, I get nothing. If I turn on/off the simulator while connected to the CAN on the board, I get the Error message fired and that is all I get.

var can = new ControllerAreaNetwork(ControllerAreaNetwork.Channel.Two, ControllerAreaNetwork.Speed.Kbps250);

can.ErrorReceived += can_ErrorReceived;
can.MessageAvailable += can_MessageAvailable;
can.Enabled = true;

can.SendMessage(new ControllerAreaNetwork.Message() { 
Data = new byte[] { 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08 }, ArbitrationId = 0x12345678, 
Length = 8,  IsRemoteTransmissionRequest = false, IsExtendedId = true });

How do I go about sending a simple message to get the engine RPM, or speed etc.

CAN itself is just a transport layer of data.The information you need is the higher level standard for diagnostics that sit above CAN. Some googling should help.

@ andre.m - thanks for the hints. I was trying to see how far I can go with CAN messages for basic info. I have seen that there are interpreter ICs on the market that will provide data via UART, but was hoping to do it without the extra layers.

To test the basic CAN bus messaging flow, can I use for example my Raptor board and the G120 board connected via a null modem DB9 cable?

I see that CAN bus is more complex, but just trying to get off the ground with some basic program that works, to build from it. I have seen various post on the forum, but some involve timings etc., which I am not sure if is needed for the latest libraries, as I do not see it in the examples.

@ andre.m - that will work, I will use simple wiring.

As for the simulator, I found this on their web site for getting Speed or RPM for example. Not sure if these are CAN messages or OBD, but I would guess OBD.

Link: Reading Real-Time Data | OBD Solutions

41 0C 0F A0

0x0FA0 = 4000
4000 / 4 = 1000 rpm

Vehicle Speed:

41 0D FF

0xFF = 255 km/h

I would guess, as Gus was saying, this is probably OBD and not CAN?

@ Zan - Think of CAN as a physical line between two people in a land line phone conversation. And think of OBD as a language that these two speakers are using to communicate.

@ Zan - Maybe this can help a bit to get you started … [url][/url]

Other than knowing the actual protocol used on the bus, one of the things about CAN is ensuring that your sampling points are the same as the rest of the bus. Just because it says 250Kbps doesn’t mean that another bus running at 250Kbps will talk to each other. This timing is easy when you have your own bus for a custom design but when it comes to connecting to another already designed bus, you need to know the full spec. I couldn’t find it in a quick search but looks like OBD uses 75% sampling point.

If you already have communications with the sim then you have the right settings.

Thank you all for the hints and helpful info. After all I decided to go back to basics, and make sure I can confirm and make the CAN bus work with the simple example from the CAN section of the documentation.
On our G120 based board, I connected two boards, loaded the CAN example, and set the resistors on, and voila, it all works like a charm to echo a message across the bus.

So, it seems that the CAN bus on our board is working perfectly, and I can now focus on some more complex scenarios.

Thanks again!