Two different projects, Diagnostics Sample and SIL Diag Sample, show a couple of the many approaches that can be taken when testing CAN diagnostic features.
•Diagnostics Sample uses a quick and easy method by setting up Transport Protocol messages directly from Signal Dictionary to send/receive diagnostic messages.
•SIL Diag Sample shows a more comprehensive approach by creating separate signals for different Diagnostic Functions and using the SIL Easy Transform to re-use C code for Seed/Key Security Algorithm functionality.
•MxSuite 3.36 or later
•A supported version of Visual Studio is required.
Click here to download the project: https://github.com/DanlawMxTeam/Samples/raw/master/DiagnosticsSample.rar
This sample project demonstrates using the Diagnostics protocol with MxVDev. Normally diagnostics are used with a hardware ECU, but for purposes of this sample, the ECU is simulated by a MxVMC Transform.
The project contains one CAN bus named “Diagnostic CAN Bus”.
There are 3 Transport Protocol Signals defined on this bus:
•Diagnostic Transmit – used to send diagnostic messages to the ECU. This Signal is received by the Transport Request Transform.
•Diagnostic Receive – used to receive diagnostic messages from the ECU. This Signal is read from the CAN bus and transmitted from the outport of the Transport Response Transform.
•Functional Transmit – used to send Functional Requests to all the ECUs connected on the bus. This Signal is used for the Tester Present message. It is received by the Transport Request Transform.
These Signals are defined by the Transforms and exported. The CAN IDs used are specified in the Transforms' properties as shown here:
These are ECU specific, and one can easily change them in the Harness Transform properties. The same strategy can be adopted for a HIL set up where a virtual bus is connected to a physical CAN bus with a real ECU. See Connecting to a Hardware Bus.
The Scenario does the following:
•Initializes the ECU (resets values in the AppIF.c)
•Starts the tick for the VMC
•Start the Tester Present (sends a Tester Present message every 100ms over the Functional Transmit signal)
•Enters in different diagnostic sessions
Diagnostic Sample Harness
The Transport Request Transform receives messages from the TestCases and transmits them in ISO15765 transport protocol. The message pass through the Delay and Funnel Transforms to the ECU simulated by the VMC.
The VMC receives Enter Session messages and sends a response to the CAN Network and through the Delay Transform to the Transport Response Transform.
The Sil\DiagSample project shows a SIL Easy Transform used in a more complex Harness. It demonstrates using SIL Easy for a security algorithm, using Transport Protocol (TP) Transforms, Diagnostic Transforms, and routing data to a virtual ECU.
Click here to download the project: https://github.com/DanlawMxTeam/Samples/raw/master/SilEasySamples.rar
The project is in the Sil/DiagSample/MxVDev subfolder.
Diagnostic Request/Response Transforms
Transport Request/Response Transforms