Demonstrates how to use LIN buses in a SIL environment.
Click here to download the project: https://github.com/DanlawMxTeam/Samples/raw/master/LINSILSample.rar
•MxSuite 3.36 or later
•A supported version of Visual Studio is required.
This sample includes examples of the following features:
•LIN Transmit Driver Transform
•LIN Receive Driver Transform
•LIN Cache Transform
•An MxVMC configured to act as a LIN slave node
LIN SIL Sample Harness
LIN messages are transmitted from TestCases to the LIN Transmit Driver. Go To Sleep and Wakeup messages are routed through the router Transforms and then to the LIN Transmit Driver. The LIN Transmit Driver transmits them onto the LIN bus. The LIN Cache stores the most recent message of each type and transmits them to the LIN Receive Driver. The LIN Receive Driver extracts the messages from the LIN bus and transmits them from its outports to the response Signals in TestCases. The Slave1 Transform receives messages as a client of the LIN Cache Transform. For more information on the LIN Cache, see the Multi LIN Cache sample. Notice how the Slave1 VMC is configured as a client in the properties of the LIN Cache.
The values of the Counter is calculated in the PostToCache method in the AppIF.c file of the Slave1 VMC. Each time the method is ticked by the Tick TestCase, the values are transferred to the payload of a LIN message and saved to the LIN Cache by the MxVuC_LIN_Tx method.
The LIN_Rx_Int method is called when a LIN message is received. It calculates the Sum, which is used in the PostToCache method.
To run the Default Scenario, click the run button ().
The Frm_MstrNode·Addend1 and Frm_MstrNode·Addend2 Signals are stimulus Signals transmitted to the LIN Transmit Driver.
The Frm_Slave1·Sum and Frm_Slave1·Counter Signals are extracted from the LIN bus by the LIN Receive Driver and read from its ports as shown below:
The Counter Signal is exported directly from the Slave1 VMC and not transmitted to the LIN bus. In a successful test, Frm_Slave1·Counter (from the bus) and Counter (directly from the VMC) should have the same values.
Multi LIN Cache sample