How to simulate ECU

A free API for the Communication with Control Units based on the CAN Calibration Protocol (CCP) by ASAM for Windows®
Locked
Fredouille
Posts: 1
Joined: Thu 27. Feb 2020, 16:32

How to simulate ECU

Post by Fredouille » Thu 27. Feb 2020, 16:50

I am already using CCP API to communicate successfully with ECU.

Now, I want to use CCP API to create an application to simulate ECU side, to perform tests using a PCAN-USB Pro.
But I haven't found anything to respond to Connect API.

Please, do you have any examples to illustrate the way to follow ?

Thanking you in advance.
Regards

K.Wagner
Software Development
Software Development
Posts: 796
Joined: Wed 22. Sep 2010, 13:36

Re: How to simulate ECU

Post by K.Wagner » Fri 28. Feb 2020, 08:44

Hello,

to create your ECU simulator (CCP slave) you just need to understand the protocol, which is actually very straightforward. Principally you should:
  1. Create an application that connects to the same CAN bus as your CCP master app, using the same bitrate.
  2. Define in your application the CAN Ids to be used for CRO and DTO messages.
  3. Define an "ECU Address" that identifies your App as ECU.
  4. Write a function that reads the CAN bus periodically for new messages.
  5. Write a function that, taking into account the CCP protocol, interprets the received CAN messages (CROs), so that you know which command is being required.
  6. Write a function to handle each CCP command.
  7. Be sure that each of those functions sends a response back (DTO).
For instance, the command CONNECT is intended to establish a logical point-to-point connection to the ECU. For this, it contains the address of the ECU to connect. You has to compare if this is the address of your App and accept the connection by sending a positive DTO:

This is an example on how a function that handle the CONNECT command could be:

Code: Select all


void HandleCommandConnect(TPCANMsg canMsg)
{
	if (MySlave.Connect(RetrieveAddressFromCANMessage(canMsg.DATA)))
	{
		TPCANMsg resultMsg;

		resultMsg = FillMessageAsCro(ACKNOWLEDGE);
        	PCANBasic.Write(MySlave.Channel, ref resultMsg);
	}           
}
     
NOTE: we actually don't give help on the protocol itself but only for our API. If you need more help on this, please refer to the offcial CCP documentation from ASAM. You will find there examples for CROs and DTOs for each command, so you can easily implement the ECU.

I hope this helps you with your project.
Best regards,
Keneth

K.Wagner
Software Development
Software Development
Posts: 796
Joined: Wed 22. Sep 2010, 13:36

Re: How to simulate ECU

Post by K.Wagner » Fri 20. Mar 2020, 16:17

- Closed -
Best regards,
Keneth

Locked