You are on page 1of 9

User Manual

1 2

Baby-LIN-MB-RS-232

Purpose .....................................................................................................................................................2 RS-232 Commands...................................................................................................................................2 2.1 2.2 2.3 2.4 2.5 2.6 2.7 2.8 2.9 2.10 Command B Baud rate Setup .........................................................................................................3 Command L - Load SDF File ...........................................................................................................3 Command S - Start Lin Simulation ..................................................................................................3 Command X - Stop Lin Simulation..................................................................................................3 Command R - Read LIN-Signal .......................................................................................................4 Command W - Write LIN-Signal .....................................................................................................4 Command M - Issue Master Request ...............................................................................................4 Command V - Read Value from last Slave Response......................................................................4 Command Version - Read SW-Version of Baby-LIN-MB ..............................................................5 Error responses .................................................................................................................................5

3 4

Application example.................................................................................................................................6 Connections ..............................................................................................................................................8 4.1 4.2 4.3 Pin assignment X8 Power Supply .................................................................................................8 Pin assignment X5 LIN Bus ..........................................................................................................8 Pin assignment X7 RS-232...........................................................................................................8

5 6

Import of SDF files...................................................................................................................................9 Firmware-Update......................................................................................................................................9

UserManual-Baby-LIN-MB-RS-232.doc Stand: 23.08.2010

Seite 1

User Manual 1 Purpose

Baby-LIN-MB-RS-232

The Baby-LIN-MB device allows for control of a LIN equipped ECU over a RS-232, RS-485, CAN or Ethernet interface, This documents describes the features of the Baby-LIN-MB-RS-232, which is equipped with a MIF-RS-232 to implement an isolated RS-232 interface.

DUT PLC RS-232 Baby-LIN-MB LIN


Device with LIN-Bus

The Baby-LIN-MB-RS-232 offers a set of ASCII-commands, which can be used to communicate with a plc or any other type of host system. The configuration of the LIN-Bus communication is done by loading one or more SDF files into the BabyLIN-MB, which will be stored on the internal SD-Card drive. The SDF (Session Description File) is derived from the LDF (LIN description File) and contains all information's about frames, signals, signal encodings, schedule tables etc. The implemented command set allows for loading a specific SDF file, starting the LIN bus communication and accessing signals received or transmitted via the LIN bus.

2 RSRS-232 Commands
The RS-232 communication will always be under control of the PLC. Thus the PLC sends a command, and the Baby-LIN-MB will start a corresponding action and will then return a result value or an error code. A command consists of a letter, which identifies the command, and one or more parameters. Every Parameter will be separated by a blank (0x20). Every Command is terminated by a <CR> character. To ease identification of the beginning of a new command, a ":" character is used as a command prefix. All commands are given as ASCII characters. Number can be expressed in decimal or hexadecimal notation. A hexadecimal value will be identified by a trailing H 10 => decimal value 10H => hexadecimal value = 16 decimal

UserManual-Baby-LIN-MB-RS-232.doc Stand: 23.08.2010

Seite 2

User Manual

Baby-LIN-MB-RS-232

2.1 Command B Baud rate Setup


The RS-232 interface comes up with a baud rate of 9600 Baud. If an application asks for a different baud rate, the baud rate can be changed with the B command. Example: Command: Response :B 38400<CR> :0<CR> Set baud rate to 38400 Baud baud rate accepted

The response to the baud rate command is send with the current baud rate, and after sending the response, the Baby-LIN-MB will switch to the new baud rate. The minimal available baud rate is 4800 Baud and the maximal value is 115000 Baud.

2.2 Command L - Load SDF File


The L command followed by a filename (8.3 convention) will load a SDF file from the Baby-LIN-MB SD card drive. Example: Command: Response :L Test0001.sdf<CR> :0<CR> :@x<CR> Will load the SDF File into the Baby-LIN-MB memory. Response 0 Error occured => file loaded

If the load operation was okay, a zero will be returned

2.3 Command S - Start Lin Simulation


The S command starts the simulation. An optional parameter can be given and will express the number of used schedule table. Example: Command: Response: :S 1<CR> :0<CR> :@x<CR> Simulation started Error occured

Will start LIN-Bus Simulation with second schedule table (index runs form 0999)

2.4 Command X - Stop Lin Simulation


The X command stops the simulation. Example: Command: Response Response 0 :X<CR> :0<CR> => Simulation has been stopped

UserManual-Baby-LIN-MB-RS-232.doc Stand: 23.08.2010

Seite 3

User Manual

Baby-LIN-MB-RS-232

2.5 Command R - Read LIN-Signal


The R command will read a signal value of the signal with the given index Example: Command: Response Response :R 12<CR> :099999<CR> :@x <CR> Signal value => Signal read failed

2.6 Command W - Write LIN-Signal


The W command will write a value to the signal with the given index. A write operation can only be executed for signals, which are published by simulated nodes. The write command has two parameters. The first parameter is the signal index, and the second parameter is the value to be written. Example: Command: Response Response :W 12 16<CR> :0<CR> :@x<CR> => write value 16 to signal 12 Signal write success Signal write failed

2.7 Command M - Issue Master Request


The M command will issue a Master Request with the given 8 parameters used as the 8 databytes The 9. Parameter defines a timeout in ms, within which the response must be received. The optional 10. parameter defines the number of Slave responses, which will be send by the slave as response. Typically it is 1, and in that case the 9. parameter can be omitted Example: Command: Response Response :M 43H 6H B2H 01H 2H 0H 0H 27H 1000 <CR> :0<CR> :@x<CR> => Master Request Command will be executed => Master Request Command failed

2.8 Command V - Read Value from last Slave Response


The V command will fetch a value which was included in the Slave Response to the last issued Mater Request. The parameters will specify location (Bit Number) and size (number of Bits) of the requested value. Example: Command: :V 24 32<CR> Reads the 32 Bit Value (4 Bytes), which is included in the Slave Response at bit position 24 with a length of 32 Bit Response Response :B<CR> => System still busy to send MasterRequest or Receive Slave Response 32 bit value from the slave response Seite 4 :0999999999<CR>

UserManual-Baby-LIN-MB-RS-232.doc Stand: 23.08.2010

User Manual
Response :@x <CR>

Baby-LIN-MB-RS-232
=> response failed

2.9 Command Version - Read SW-Version of Baby-LIN-MB


The Version command reports the software version of the Baby-LIN-MB Example: Command: Response :Version<CR> :V.1.21<CR> => System responds with version

2.10 Error responses


If a command was not understood, or parameters were invalid or any specific erroc condition on the LIN Bus side causes a command to fail, the system will respond with one of the following generic error codes Response: Response: Response: Response: Response: Response: Response: Response: Response: Response Response: :@1 <CR> :@2 <CR> :@3 <CR> :@4 <CR> :@5 <CR> :@6 <CR> :@7 <CR> :@8 <CR> :@9 <CR> :@11<CR> :@12<CR> unknown command invalid Parameter Parameter out of range Parameter missing Command Timeout (incomplete command) File not found File load error SDF download to MIF-LIN failed Internal MIF-LIN operation failed Node Timeout (no answer from LIN Bus) LIN Bus supply missing

UserManual-Baby-LIN-MB-RS-232.doc Stand: 23.08.2010

Seite 5

User Manual 3 Application example

Baby-LIN-MB-RS-232

The following sample shows the commands and responses to read a 8 bit signal from a LIN device. The signal index used for the read signal can be retrieved from the sdf file. Just open the SDF file with the LINWorks SessionConf.exe and use the "Edit LDF" function to see the embedded LDF data.

Selecting the appropriate signal will show the signal properties, and the first value given on the right side (Signal's SDF-Nr) is the index used for the Read and Write commands.

UserManual-Baby-LIN-MB-RS-232.doc Stand: 23.08.2010

Seite 6

User Manual

Baby-LIN-MB-RS-232

If the Test0001.sdf file has been transferred to the Baby-LIN-MB by use of an USB-Stick, you need only 3 commands to start communication and read the signal value (here signal Symbolcode_1 with index 25). Command Hex-Codes Response Hex-Codes Command Hex-Codes Response Hex-Codes Command Hex-Codes Response Hex-Codes Command Response Hex-Codes :L Test0001.sdf<CR> 3A 4C 20 54 65 73 74 30 30 30 31 2E 73 64 66 0D :0<CR> 3A 30 0D :S 1<CR> 3A 53 20 30 0D :0<CR> 3A 30 0D :R 25<CR> 3A 52 20 32 35 0D :16<CR> 3A 31 36 0D :X<CR> :0<CR> 3A 30 0D Read Signal with index 25 => Signal value 0255 (8 Bit) Stop LIN bus Start Lin bus Load SDF

UserManual-Baby-LIN-MB-RS-232.doc Stand: 23.08.2010

Seite 7

User Manual 4 Connections

Baby-LIN-MB-RS-232

The Ground connections of the Power Supply (X8), LIN-Bus (X5) and RS-232 (X7) are not connected as all interfaces are fully isolated from each other.

4.1 Pin assignment X8 Power Supply


Pin Signal 24 V Supply (18-28 V DC) GND Supply

X8 Power Supply

1 2

4.2 Pin assignment X5 LIN Bus


Pin Signal GND-LIN LIN V-LIN (typ. 12V) not connected

X5 LIN Bus

3 8 9 1,2,4,5,6,7

4.3 Pin assignment X7 RS-232


Pin Signal TXD RXD GND-RS-232 CTS(input) RTS(output)

X7 - RS-232

2 3 5 7 8

The serial interface on X7 is initialised to 9600 Baud, 1 start bit, 8 data bits, 1 stop bit, no parity. Firmware version V.1.20 and later support to change the baudrate with the "B" command.

UserManual-Baby-LIN-MB-RS-232.doc Stand: 23.08.2010

Seite 8

User Manual 5 Import of SDF files

Baby-LIN-MB-RS-232

The operation of the Baby-LIN-MB system is basically defined by the SDF files available on the internal SD-card drive. These SDF files are typically created and prepared on a PC by the LINWorks software. When SDF configuration is done, the SDF file is transferred to the Baby-LIN-MB by means of an USB stick. The SDF files to be transferred to the Baby.LIN-MB have to be copied into a specific subdirectory on the usb stick: \BL-MB-01\database. Inserting a stick, which holds sdf files in the subdirectory "\BL-MB-01\database" and pressing the green button, will automatically start the sdf file copy process. During the copy operation the green LED flashs. After completion of the operation the green LED will stay on permanent, when everything went right, or the red LED will turn on, if any error occured.

6 FirmwareFirmware-Update
The firmware of the Baby-LIN-MB can be updated with an ISP (InSystemProgramming) operation. Again the data to be transferred into the Baby-LIN has to be copied to a specific subdirectory of an usb stick: "\BL-MB-01\update\". The firmware data will always be contained in a file named: BLMBUPD.bin. Inserting an USB stick with a "\BL-MB-01\update\ BLMBUPD.bin " file on it and pressing the black key for 4 seconds will start the firmware update process. The green and red LED will start to flash alternatively and the update procedure will start. If an error occurs during the update the red LED will turn on for 3 seconds. If everything went right, the green LED will turn on for 3 seconds, and a system reset will be performed.

UserManual-Baby-LIN-MB-RS-232.doc Stand: 23.08.2010

Seite 9