0% found this document useful (0 votes)
9 views12 pages

HowTo PCAN-LIN V1.0.0.2

Uploaded by

Nik Name
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
9 views12 pages

HowTo PCAN-LIN V1.0.0.2

Uploaded by

Nik Name
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 12

HowTo use PCAN-LIN in different scenarios:

The PCAN-LIN module is a flexible LIN/CAN/Serial Gateway, which can be used in different
applications. In this “how to” document we will show you different ways to use the PCAN-LIN module
for LIN applications in master or slave mode.

PCAN-LIN Configuration:

The PCAN-LIN can only be configured using a serial connection. Best solution is to use a native COM
port of your PC/Mainboard. If you use an USB2Serial device, please note, that only a module with a
FTDI chip will work correctly with the PCAN-LIN CT application.

PCAN-LIN CT screenshot while connected to PCAN-LIN through a serial port:

The “Data Present in Module” Tab will show the current configuration on the module. To configure
the PCAN-LIN, click on the “create a new profile with standard settings” button. Now you can setup
the bitrates, forward masks and all other needed settings. See below for the details on different
scenarios. Save this profile on your hard disk and send it to the module using the “Send” button.

HowTo_PCAN-LIN V1.0.0.2 ©2021 PEAK-System Technik GmbH 1


1. Using PCAN-LIN as LIN/CAN/Serial gateway as a simple LIN listener:

To use the PCAN-LIN as a LIN monitoring tool (listener only) you have to set the bitrate for
LIN and CAN and the LIN forward mask to CAN or LIN (or both) to see the LIN messages on
those connections (also enable the error forwarding to be able to see problems due to a
wrong frame configuration setup). Next, you have to set the frame configuration to the
needed settings given by your LIN specification or ldf file. When you use a LIN 2.0 system you
have to set all frames to Checksum Type “Enhanced” and set the length code as given by
your LIN description or ldf file. Here an example for a ldf file, and how to extract the required
information from it:
Note: a *.ldf file is an ASCII based configuration file which can be displayed with a text editor:

On top of the ldf file the LIN specification will be displayed

Here the used LIN protocol Version is 2.x, so you have to setup all used LIN frames to
“enhanced” Checksum type.

Note: the LIN frames 0x3C and 0x3D (master request, slave response) always uses classic
Checksum type, even in a LIN 2.x system!

In the frame section of the ldf file, you will see the used frames and length codes:

The yellow marked number shows the


LIN ID, the blue underlined number
shows the length code of the LIN
frame.

HowTo_PCAN-LIN V1.0.0.2 ©2021 PEAK-System Technik GmbH 2


Open the frame configuration by pressing the set button, and modify the frames to the given
data of the ldf file:

Keep direction as “Subscriber” for all frames, in case you only want to “listen” to the LIN bus
system. In the LIN section, set Master Status to “Inactive” and LIN Bus Termination to
“Slave”:

HowTo_PCAN-LIN V1.0.0.2 ©2021 PEAK-System Technik GmbH 3


Now you can see the LIN data on the “Message and Scheduler” Tab in PCAN-LIN CT and on
the CAN bus (here with PCAN-View connected to a PCAN-USB module):

You could use the trace option in PCAN-LIN CT or PCAN-View to log the received data to disk.

HowTo_PCAN-LIN V1.0.0.2 ©2021 PEAK-System Technik GmbH 4


2. Using PCAN-LIN as LIN Master using the internal Scheduler of PCAN-LIN:
To use the PCAN-LIN as LIN Master with an active scheduler you have to set the scheduler
entries, set the LIN Bus Termination to “Master” and set the Master Status to “Active”. With
an active scheduler, the PCAN-LIN will send out subscriber and publisher frames, depending
on how the scheduler list and frame configuration is set. In the ldf file the different
schedulers are listed in the scheduler_table section:

Next, you have to modify the frame configuration to the required Checksum type and length
code, and configure the publisher frames (here ID 5) with default data:

HowTo_PCAN-LIN V1.0.0.2 ©2021 PEAK-System Technik GmbH 5


As soon as the configuration was sent to PCAN-LIN, it starts with the scheduler and forwards
the data to CAN and the serial port:

HowTo_PCAN-LIN V1.0.0.2 ©2021 PEAK-System Technik GmbH 6


Now it is possible to change the publisher data of ID 5 through serial commands using the
PCAN-LIN CT “Advanced Configuration” Tab or by serial streams:

Example: changing the data bytes of ID 5 to 0xAB 0xCD (by serial):

Note: when setting the cursor over the P00 to P03 parameters, there will be a hint displayed
in the status bar, showing you which parameter must be set in that specific field.
The used serial command will be displayed below as raw-command: 0x02 0x24 0xA9 0x01
0x05 0xAB 0xCD 0x EF

Result:

HowTo_PCAN-LIN V1.0.0.2 ©2021 PEAK-System Technik GmbH 7


Example: changing the data bytes of ID 5 to 0x12 0x34 (by CAN):

To change the publisher data by CAN while a scheduler is active, an ID offset 0f 0x40 must be
used: CAN-ID = 5 + 0x40 + CAN-ID Offset =0x45 (CAN ID Offset is set to 0 in that config)
The length code must match to the length code of the publisher data.

More details can be seen in the help file of PCAN-LIN CT:

HowTo_PCAN-LIN V1.0.0.2 ©2021 PEAK-System Technik GmbH 8


3. Using PCAN-LIN as LIN Master controlled by serial streams:
To send LIN frames via serial commands, you can build up an own application using serial
streams or use PCAN-LIN CT “Advanced Configuration” Tab to send frames. You will find the
description of those serial streams in the PCAN-LIN Protocol Definitions.pdf, which will be
installed with PCAN-LIN CT. Keep all frames as subscriber in the frame configuration.

Sending a Subscriber frame with PCAN-LIN CT (ID: 0x05 or 0x80 (subscriber option) = 0x85):

Same request with a serial terminal program:

Blue markings are the positive response from PCAN-LIN, red markings show the data from
the LIN slave responding on 0x01 subscriber frame

HowTo_PCAN-LIN V1.0.0.2 ©2021 PEAK-System Technik GmbH 9


Sending a Publisher frame with PCAN-LIN CT with 2 databytes (ID 0x05 data 0x12 0x34):

Same publisher frame with a serial terminal program:

HowTo_PCAN-LIN V1.0.0.2 ©2021 PEAK-System Technik GmbH 10


4. Using PCAN-LIN as LIN Master controlled by CAN frames:
To send LIN publisher and subscriber frames initiated by CAN, you have to set all frames to
subscriber in the frame configuration and set the master status to “inactive”. To send a
publisher frame, you have to send a CAN frame with the same CAN ID and same length code
with data as the LIN publisher frame you want to send.

Example: Send CAN ID 0x05 len2 data 0xAB 0xCD:

Here the result in PCAN-LIN CT:

HowTo_PCAN-LIN V1.0.0.2 ©2021 PEAK-System Technik GmbH 11


To send a subscriber frame and get the data from a connected LIN slave, a CAN RTR message
,with the LIN ID and length code as defined in the frame configuration, must be send:

Sending a Subscriber frame with PCAN-View ID: 0x01 len8 RTR:

In the receive Window the answer from the LIN slave (data) on that subscriber frame will be
visible.

As you can see with these examples, PCAN-LIN is a very flexible device to handle
LIN/CAN/Serial tasks. If you have questions regarding the use of PCAN-LIN, you can contact
our support team by email or post your request in our forum.

HowTo_PCAN-LIN V1.0.0.2 ©2021 PEAK-System Technik GmbH 12

You might also like