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
How to simulate ECU
Re: How to simulate ECU
Hello,
to create your ECU simulator (CCP slave) you just need to understand the protocol, which is actually very straightforward. Principally you should:
This is an example on how a function that handle the CONNECT command could be:
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.
to create your ECU simulator (CCP slave) you just need to understand the protocol, which is actually very straightforward. Principally you should:
- Create an application that connects to the same CAN bus as your CCP master app, using the same bitrate.
- Define in your application the CAN Ids to be used for CRO and DTO messages.
- Define an "ECU Address" that identifies your App as ECU.
- Write a function that reads the CAN bus periodically for new messages.
- 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.
- Write a function to handle each CCP command.
- Be sure that each of those functions sends a response back (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);
}
}
I hope this helps you with your project.
Best regards,
Keneth
Keneth