MASTER-INTERFACECABLE 数据手册
Melexis USB LIN master
Version 2.0
Melexis USB LIN Master
Version 2.0 revision Fast Loader
Documentation
For Melexis USB LIN master used in demo setups and
development kits
Rev. 004
Page 1 of 13
Application note
Oct/06
Melexis USB LIN master
Version 2.0
Table of Contents
1. General description ............................................................................................................................. 3
2. Hardware ............................................................................................................................................. 3
3. Software............................................................................................................................................... 3
3.1. Installation of the LIN master ........................................................................................................ 4
3.1.1. Installing the USB driver......................................................................................................... 4
3.1.2. Installing the LIN master application software ....................................................................... 6
3.2. LIN commander ............................................................................................................................ 7
3.2.1. Lin Schedules and LIN Sequences ........................................................................................ 9
3.2.2. Log window ............................................................................................................................ 9
3.2.3. Start working with the LIN commander .................................................................................. 9
3.2.4. Reprogramming of Melexis modules using the LIN Master ................................................. 10
4. Appendix A: Possible LIN baudrates................................................................................................. 11
5. References ........................................................................................................................................ 13
6. Disclaimer .......................................................................................................................................... 13
Rev. 004
Page 2 of 13
Application note
Oct/06
Melexis USB LIN master
Version 2.0
1. General description
The Melexis USB LIN master can be used for all applications requiring a LIN master. It is designed to
support the automatic configuration algorithms as they are defined by the LIN consortium. The Melexis
Lin master is fully configurable by software through the USB port and supports all practical baud rates
on the LIN bus.
This user manual describes the LIN master revision 2 (Fast loader). This LIN master is backwards
compatible with LIN master revision 1.
2. Hardware
The LIN master consists of a microcontroller connected to the TH8061 physical layer interface of
Melexis. It can be connected to the PC using the USB port. The LIN bus and power supply can be
connected through connectors at one side of the device. There are 5 control LEDs:
1. PC connected: indicates that the PC is connected and the USB link is active.
2. PC communication: indicates that there is communication between the PC and the master.
3. M2S: indicates that a message with data field send by the master is travelling over the bus.
4. S2M: indicates that a message with data field send by a slave is travelling over the bus.
5. Vbus: indicates that the LIN bus is powered and that messages can be send.
The internal microcontroller and LEDs are powered by the USB bus. When the USB plug is connected,
communication with the microcontroller over the USB line is possible. The LIN bus itself is not
powered by the USB interface. Therefore an extra power supply has to be foreseen. The LIN bus
voltage will be 1 diode voltage lower than the external power supply. As soon as the power supply is
above 8V, the green LED will be on. When the LIN voltage is lower than 7V, the internal
microcontroller will still send the requested LIN message to the physical layer. Because of the fact that
the physical layer is not powered according to the LIN specifications, the signals on the LIN bus will
not be valid. But the fact that the LIN voltage is out of spec does not block the functionality of the
master. Even when the LIN voltage is out of spec, the microcontroller drives the physical interface of
the LIN bus.
After connecting the USB cable, the microcontroller is powered. All 5 LEDs will be on for
approximately 10 seconds. After those 10 seconds, some of the LEDs will flash and only the PC
connected LED will be on. If the external power is connected, the green Vbus LED will be on too. From
now on, all LEDs will react on PC and LIN messages.
Pinout of the different connectors:
- Red banana connector = battery voltage 12V typical.
- Black banana connector = ground
- Yellow banana connector = LIN bus
3. Software
This chapter describes the necessary steps to install the device drivers and all the software necessary
to communicate with the LIN master.
All software is written for Windows XP Pro. It might be possible that is it working under other versions
of windows, but this cannot be guaranteed.
Rev. 004
Page 3 of 13
Application note
Oct/06
Melexis USB LIN master
Version 2.0
3.1. Installation of the LIN master
This chapter describes the necessary installations to do to be able to work with the LIN master.
Note that both software and device drivers installations are required in order to work with the
device and must be done before the first time you connect the LIN Master to the PC. Also, to be
able to successfully accomplish these installations you need administrative rights on the PC.
3.1.1. Installing the USB driver
Insert the CD into your PC
1. An autorun popup screen will appear
2. Click on the “Install USB driver” button to start the installation
3. A welcome window will appear. Click “Next” button to continue
4. You’ll see a window with the license agreement and a few installation windows popping up.
Accept the license and ignore all the windows.
Rev. 004
Page 4 of 13
Application note
Oct/06
Melexis USB LIN master
Version 2.0
5. At the end, this window tells that the installation is done successfully
The correct drivers are installed. From now on, the LIN master can be accessed via a virtual COM
port. Note that the first time the device is connected to a particular USB port, an automatic virtual COM
port installation is performed and a unique COM port number is assigned. Check the device manager
of Windows XP to get the number of the COM port the LIN master is connected to (start->settings>control panel->system->hardware->device manager->Ports (COM & LPT)).
Rev. 004
Page 5 of 13
Application note
Oct/06
Melexis USB LIN master
Version 2.0
3.1.2. Installing the LIN master application software
After installing the USB drivers, the software to work with the LIN master have to be installed. This
installation is done automatically.
Insert the CD into your PC
1. An autorun popup screen will appear
2. Click on the Install LinMaster button to start the installation
3. You’ll see a window with the license agreement and a few installation windows popping up.
Accept the license and ignore all the windows.
4. At the end, this window tells that the installation is done successfully
The LIN master is now ready to use.
LIN Master can be used through two applications – LIN commander which is described below and the
user interface module for MPT application which is documented separately in LinMasterUI.pdf.
For those, who want to implement their own application, we provide a library along with documentation
(LIN_PSF_Object_Model.pdf) and examples in LabView and MS Excel – all delivered on the CD.
Rev. 004
Page 6 of 13
Application note
Oct/06
Melexis USB LIN master
Version 2.0
3.2. LIN commander
The LIN master is delivered with a sample interface program that can be used to debug the bus when
developing an application. This program is called the ‘LIN commander’ and a screenshot of it is
displayed in Figure 1.
The configuration of the LIN messages is done by a LIN-file. This text file describes the LIN messages
that can be sent over the bus. Hereafter, the syntax of such a LIN file is given together with an
example:
- Comments start with an asterisk (*). The comment symbol should be placed in the beginning of
a line. The whole line is ignored.
- Empty lines are ignored
- The END keyword indicated the end of the lin file. This keyword must be present, otherwise the
file is ignored. Everything that is written after this end keyword is ignored.
- The complete syntax is case insensitive.
- The following keywords are defined:
o END: indicate the end of the file
o LINBAUDRATE=: defines the LIN baudrate on the bus. It should be written in the
beginning of the file
o SCHEDULENAME=: defines the name of the schedule.
o M2S: defines a master to slave message, the master sends the header as well as the
data bytes.
o S2M: defines a slave to master message, the master sends the header of the
message, and the slave the data bytes.
o WKU: defines a wake up pulse.
o CK13: defines a checksum according to LIN spec 1.3
o CK20: defines the enhanced checksum of the LIN 2.0 version
- A description of a LIN message consists of two parts, separated by a colon (:)
o name of the message: can be any possible string as long as it does not contain a
colon.
o body of the message.
- The body of the message consists out of 4 parts each separated by a comma (,)
o message type:
1. M2S for a master to slave message: the master sends the header, data bytes
and checksum.
2. S2M for a slave to master message: the master sends the header and the
slave the data bytes and the checksum
3. WKU for a wake up pulse. In case of a wake up pulse, not other parameters
are necessary.
o LIN ID: the LIN ID of the message, always send by the master
o In case of a master to slave message, all the data bytes to be send by the master
In case of a slave to master message, the number of data bytes that the slave should
receive
o A checksum type
1. CK13 for checksum according to LIN spec. 1.3
2. CK20 for an enhanced checksum according to LIN spec 2.0
- Multiple messages can be concatenated into one message string. Each message has to be
separated by a semi colon. This can be done to send multiple messages in the same time slot.
- All numbers can be decimal or hexadecimal numbers. Hexadecimal numbers are preceded by a
$ symbol.
************************************************************************************
*
MELEXIS LIN DEBUG
*
************************************************************************************
Rev. 004
Page 7 of 13
Application note
Oct/06
Melexis USB LIN master
Version 2.0
* Example
*--------LINBAUDRATE = 19200
SCHEDULENAME = example
* a LIN sequence with one M2S LIN message
M2S
: M2S, $25, $aa, $23, $0a, $04, CK13;
* a LIN sequence with one S2M LIN message
S2M
: S2M, $26, $04;
* a LIN sequence grouping 2 LIN messages, one M2S and one S2M message.
M2S+S2M
: M2S, $25, $01, $02, $0a, $04, Ck20; S2M, $26, $04, CK13;
END
Figure 1: Screenshot of the LIN commander
1. Buttons to load the LIN files (schedules and sequences), (dis)connect the LIN master
2. The baud rate that is initialized in the LIN file and the real baudrate on the LIN bus
3. List of all configured LIN messages
4. The LIN message that will be send
5. The ‘Once’ and ’Repeat’ buttons to send a message once or repeatedly
6. The time between 2 LIN messages when send repeatedly
7. LIN schedule and sequence windows
8. Message log window.
Mover over each button to see a small description on what the button does.
Take the following steps to work with the commander:
- Connect the LIN master via the USB link
- Connect a 12V power supply to the red and black banana connector (or the RJ45 cable).
- Double click the LIN commander icon on your desktop to start the software.
Rev. 004
Page 8 of 13
Application note
Oct/06
Melexis USB LIN master
Version 2.0
3.2.1. Lin Schedules and LIN Sequences
A LIN file can be interpreted as sequence or as schedule. The difference between them can be
explained by an example.
In a system with multiple slaves, each slave has to react on a subset of the LIN messages on the bus.
All possible messages on the bus can be described in a LIN sequence. The subset of messages per
slave can be described in a schedule.
Lin Sequences are loaded in the sequence window, schedules in the schedule window. There can
only be one loaded sequence at the time, while multiple opened schedules are possible. Each
schedule has its name and all the schedules are listed in the ‘Loaded schedules’ list.
The syntax for sequences and schedules is the same and so schedules can be loaded into the
sequence window and vice versa. The only difference between the two files is the SCHEDULENAME=
keyword. If this is not present in the lin file that is loaded as schedule, the software automatically adds
the name “anonymous” to the file when saving it.
New schedules can be assembled out of a sequence by writing the name of the new schedule in the
‘New schedule name’ field in the schedule window and clicking the ‘new’ button. The schedule content
is displayed in the ‘Selected Schedule’ list. By clicking the ‘Add Sequence’ button the selected LIN
message in the sequence is added to the schedule. Deleting a message from the schedule can be
done by selecting the message in the schedule and clicking the ‘delete sequence’ button. Schedules
can be saved and loaded by the ‘Save’ and ‘Load’ buttons. They are deleted from the schedule list by
clicking the ‘Delete’ button. This does not delete the schedule from the hard disk.
Sending a LIN message in the sequence is done by selecting the message from the message list and
clicking the ‘Once’ button. Sending it repeatedly is done by clicking the ‘Repeat’ button. The time
interval is given in the ‘Delay’ box. The minimal practical delay is 10 ms due to the Windows timing
system.
Sending a schedule is done by selecting it from the ‘Loaded Schedules’ list and clicking the ‘Once’ or
‘Repeat’ buttons. All the LIN messages of the schedule are sent. It is not possible to send only a part
of the schedule.
3.2.2. Log window
The traffic over the LIN bus is logged in the Log window. All LIN messages are displayed here
(message name, ID, data bytes and checksum). In some cases, extra info is given e.g no slave
reaction on a S2M message. The messages can be logged in a csv file when needed.
3.2.3. Start working with the LIN commander
To start working with the LIN commander, do the following:
- Load a lin file by clicking the ‘Load LIN file’ button. The syntax of such an initialisation file is
explained above
- Wait until the LIN master is detected by the software. If the software cannot detect the LIN
master, a C++ exception is thrown. If this exception is thrown, close the software, disconnect
the master, wait a few moments until the driver is unloaded from Windows and try again. This
might happen the first time the Lin Master is connected after booting the PC.
- Select a message in the sequence list by clicking on it. The message will appear green in the
box just above the ‘Once’ button.
Rev. 004
Page 9 of 13
Application note
Oct/06
Melexis USB LIN master
Version 2.0
- Click the Once button to sent the selected message once. The message (ID and databyte) will
appear in the LIN message log window. If there are no databytes, only an ID (in cases that
there is no slave that responds), only the ID is shown.
- Click the ‘Repeat’ button in case the message has to be send continuously. The time between
two messages is displayed in the delay box. This is more an indication of the time between 2
messages. Every time a message has to be sent on the LIN bus, the PC has to give the
command to the Lin Master. Therefore, a complete message has to travel through the USB
stack on the PC. This might take some time, so the time indicated in the delay box is will be
longer. In the test setup, the minimal time between 2 messages is 10ms.
After clicking the repeat button, this button becomes a ‘stop’ button to stop sending the
message.
- Clear the message log window by clicking the ‘clear’ button.
- It is also possible to save the logging into a csv file. Before starting the save, click the “start
saving LIN messages” button and browse to the correct directory where you want to store the
csv file.
- Because of the fact that the LIN master is a microcontroller with a LIN baudrate generating
timer inside, it is not possible to have all imaginable baudrates. The real baudrate is indicated
below the theoretical baudrate. A table of all possible baudrates is given in Table 1.
- Select the ‘view logging’ selection box to show the Lin message log window.
- Click the disconnect button to disconnect the LIN master. The application does not close. The
software can be reactivated by clicking the ‘connect’ button.
3.2.4. Reprogramming of Melexis modules using the LIN Master
Some of the Melexis microcontroller based devices can be reprogrammed using the Melexis LIN
master. Therefore, the ‘Firmware Loader’ command is developed.
If your project has this function, refer to your Melexis contacts on how to use these functionalities.
For designers who want to build their own PC application driving the LIN master, it is possible to get
the source code for a framework to use the library and LIN master. This source code is developed with
Borland C++ builder 5.0. Refer to you Melexis contact to get these libraries.
Rev. 004
Page 10 of 13
Application note
Oct/06
Melexis USB LIN master
Version 2.0
4. Appendix A: Possible LIN baudrates
Byte 2
1.00
2.00
3.00
4.00
5.00
6.00
7.00
8.00
9.00
10.00
11.00
12.00
13.00
14.00
15.00
16.00
17.00
18.00
19.00
20.00
21.00
22.00
23.00
24.00
25.00
26.00
27.00
28.00
29.00
30.00
31.00
32.00
33.00
34.00
35.00
36.00
37.00
38.00
39.00
40.00
41.00
42.00
43.00
Baudrate
125.00
83.33
62.50
50.00
41.67
35.71
31.25
27.78
25.00
22.73
20.83
19.23
17.86
16.67
15.63
14.71
13.89
13.16
12.50
11.90
11.36
10.87
10.42
10.00
9.62
9.26
8.93
8.62
8.33
8.06
7.81
7.58
7.35
7.14
6.94
6.76
6.58
6.41
6.25
6.10
5.95
5.81
5.68
Rev. 004
Byte 2
53.00
54.00
55.00
56.00
57.00
58.00
59.00
60.00
61.00
62.00
63.00
64.00
65.00
66.00
67.00
68.00
69.00
70.00
71.00
72.00
73.00
74.00
75.00
76.00
77.00
78.00
79.00
80.00
81.00
82.00
83.00
84.00
85.00
86.00
87.00
88.00
89.00
90.00
91.00
92.00
93.00
94.00
95.00
Baudrate
4.63
4.55
4.46
4.39
4.31
4.24
4.17
4.10
4.03
3.97
3.91
3.85
3.79
3.73
3.68
3.62
3.57
3.52
3.47
3.42
3.38
3.33
3.29
3.25
3.21
3.16
3.13
3.09
3.05
3.01
2.98
2.94
2.91
2.87
2.84
2.81
2.78
2.75
2.72
2.69
2.66
2.63
2.60
Byte 2
105.00
106.00
107.00
108.00
109.00
110.00
111.00
112.00
113.00
114.00
115.00
116.00
117.00
118.00
119.00
120.00
121.00
122.00
123.00
124.00
125.00
126.00
127.00
128.00
129.00
130.00
131.00
132.00
133.00
134.00
135.00
136.00
137.00
138.00
139.00
140.00
141.00
142.00
143.00
144.00
145.00
146.00
147.00
Baudrate
2.36
2.34
2.31
2.29
2.27
2.25
2.23
2.21
2.19
2.17
2.16
2.14
2.12
2.10
2.08
2.07
2.05
2.03
2.02
2.00
1.98
1.97
1.95
1.94
1.92
1.91
1.89
1.88
1.87
1.85
1.84
1.82
1.81
1.80
1.79
1.77
1.76
1.75
1.74
1.72
1.71
1.70
1.69
Page 11 of 13
Byte 2
157.00
158.00
159.00
160.00
161.00
162.00
163.00
164.00
165.00
166.00
167.00
168.00
169.00
170.00
171.00
172.00
173.00
174.00
175.00
176.00
177.00
178.00
179.00
180.00
181.00
182.00
183.00
184.00
185.00
186.00
187.00
188.00
189.00
190.00
191.00
192.00
193.00
194.00
195.00
196.00
197.00
198.00
199.00
Baudrate
1.58
1.57
1.56
1.55
1.54
1.53
1.52
1.52
1.51
1.50
1.49
1.48
1.47
1.46
1.45
1.45
1.44
1.43
1.42
1.41
1.40
1.40
1.39
1.38
1.37
1.37
1.36
1.35
1.34
1.34
1.33
1.32
1.32
1.31
1.30
1.30
1.29
1.28
1.28
1.27
1.26
1.26
1.25
Byte 2
209.00
210.00
211.00
212.00
213.00
214.00
215.00
216.00
217.00
218.00
219.00
220.00
221.00
222.00
223.00
224.00
225.00
226.00
227.00
228.00
229.00
230.00
231.00
232.00
233.00
234.00
235.00
236.00
237.00
238.00
239.00
240.00
241.00
242.00
243.00
244.00
245.00
246.00
247.00
248.00
249.00
250.00
251.00
Baudrate
1.19
1.18
1.18
1.17
1.17
1.16
1.16
1.15
1.15
1.14
1.14
1.13
1.13
1.12
1.12
1.11
1.11
1.10
1.10
1.09
1.09
1.08
1.08
1.07
1.07
1.06
1.06
1.05
1.05
1.05
1.04
1.04
1.03
1.03
1.02
1.02
1.02
1.01
1.01
1.00
1.00
1.00
0.99
Application note
Oct/06
Melexis USB LIN master
Version 2.0
44.00
45.00
46.00
47.00
48.00
49.00
50.00
51.00
52.00
5.56
5.43
5.32
5.21
5.10
5.00
4.90
4.81
4.72
96.00
97.00
98.00
99.00
100.00
101.00
102.00
103.00
104.00
2.58
2.55
2.53
2.50
2.48
2.45
2.43
2.40
2.38
148.00
149.00
150.00
151.00
152.00
153.00
154.00
155.00
156.00
1.68
1.67
1.66
1.64
1.63
1.62
1.61
1.60
1.59
200.00
201.00
202.00
203.00
204.00
205.00
206.00
207.00
208.00
1.24
1.24
1.23
1.23
1.22
1.21
1.21
1.20
1.20
252.00
253.00
254.00
255.00
Table 1: Possible LIN baudrates
Rev. 004
Page 12 of 13
Application note
Oct/06
0.99
0.98
0.98
0.98
Melexis USB LIN master
Version 2.0
5. References
1) Lin specification package version 1.3 (see http://www.lin-subbus.org/)
6. Disclaimer
Devices sold by Melexis are covered by the warranty and patent indemnification provisions appearing
in its Term of Sale. Melexis makes no warranty, express, statutory, implied, or by description regarding
the information set forth herein or regarding the freedom of the described devices from patent
infringement. Melexis reserves the right to change specifications and prices at any time and without
notice. Therefore, prior to designing this product into a system, it is necessary to check with Melexis
for current information. This product is intended for use in normal commercial applications.
Applications requiring extended temperature range, unusual environmental requirements, or high
reliability applications, such as military, medical life-support or life-sustaining equipment are
specifically not recommended without additional processing by Melexis for each application.
The information furnished by Melexis is believed to be correct and accurate. However, Melexis shall
not be liable to recipient or any third party for any damages, including but not limited to personal injury,
property damage, loss of profits, loss of use, interrupt of business or indirect, special incidental or
consequential damages, of any kind, in connection with or arising out of the furnishing, performance or
use of the technical data herein. No obligation or liability to recipient or any third party shall arise or
flow out of Melexis’ rendering of technical or other services.
© 2002 Melexis NV. All rights reserved.
For the latest version of this document, go to our website at:
www.melexis.com
Or for additional information contact Melexis Direct:
Europe and Japan:
Phone: +32 13 67 04 95
E-mail: sales_europe@melexis.com
All other locations:
Phone: +1 603 223 2362
E-mail: sales_usa@melexis.com
QS9000, VDA6.1 and ISO14001 Certified
Rev. 004
Page 13 of 13
Application note
Oct/06