How do I communicate on LIN - neoVI API
The very first step to working with LIN is to make sure it is enabled on your hardware device. This is done in neoVI Explorer. Please see the hardware documentation for the device to be used on how to do this.
Working with LIN can be done in different ways, so it is important to know how what is needed for the LIN network that is being connected to. Is the application going to act as a Master, Slave, or just spy on the bus? If just spying on the bus is needed, messages can be read like other networks.
The first step to acting as a Master is to enable the Master resistor in the hardware. This is done in neoVI Explorer under the desired LIN channel. This is not needed if the cabling includes the resistor or when operating as a Slave. Below is the setup for a simple Master request with no slave data. Note that the J1850 Spy Message structure is used and the LIN protected ID is in the first data byte.
Master frame no slave Data
Master frame with Slave data
Sending a Slave message is just like sending a Master frame with Slave data. The difference is that the SPY_STATUS_INIT_MESSAGE
bit is not set in the StatusBitField. This bit tells the hardware if the message is a Master frame or a slave frame. When sending a Slave message, it is sent and saved in the hardware. The message will be sent when a Master request is received. Once the request is received, then the Slave data goes out appended to the Master Frame. The same slave data will go out with every Master request, until a new Slave message with updated data is sent from the application to the hardware using the TxMessage function. When reading LIN, the checksum will be in the ACK1 parameter of the message structure.
Last updated