Download as pdf or txt
Download as pdf or txt
You are on page 1of 32

Programmer’s Guide

Byte Command Protocol


API Description

English
2017-08-08
7391131_01_UK

1
ifm Programmer’s Guide Byte Command Protocol API Description 2017-08-08
Contents

Contents

1 Preliminary note 3
1.1 Copyright ..............................................................................................................................3
1.2 General ................................................................................................................................4
1.3 Symbols and formats used ..................................................................................................5
1.4 History of the instructions .....................................................................................................5

2 Byte Mode Commands 6


2.1 Command Format (Byte Mode) ...........................................................................................6
2.1.1 Example – Command Format....................................................................................................... 7
2.2 Extended Command Format (Byte Mode) ...........................................................................8
2.2.1 Example – Extended Command ................................................................................................... 8
2.3 Process Data Messages ......................................................................................................9
2.3.1 CAN data frame reception ............................................................................................................ 9
2.3.2 Transmit CAN data frame ........................................................................................................... 11
2.3.3 CAN remote frame reception ...................................................................................................... 12
2.3.4 Transmit CAN remote frame....................................................................................................... 13
2.4 Feedback messages ..........................................................................................................14
2.4.1 CAN message transmission feedback ........................................................................................ 14
2.5 Diagnosis data messages ..................................................................................................15
2.5.1 Device ID .................................................................................................................................... 15
2.5.2 Hardware / Software version ...................................................................................................... 15
2.5.3 Error status ................................................................................................................................. 17
2.5.4 Interfaces version ....................................................................................................................... 18
2.5.5 Device busy / command not supported ...................................................................................... 18
2.6 CAN Controller setup messages........................................................................................19
2.6.1 Change / request receive channel ID settings ............................................................................ 19
2.6.2 Change / request receive channel mask settings ....................................................................... 20
2.6.3 CAN baud rate............................................................................................................................ 21
2.6.4 CAN controller reset ................................................................................................................... 22
2.6.5 Set / request active / passive mode ............................................................................................ 22
2.6.6 Change / request receive channel cycle time ............................................................................. 23
2.7 Host interface configuration messages ..............................................................................24
2.7.1 Feedback / output settings ......................................................................................................... 24
2.8 Device parameter settings .................................................................................................25
2.8.1 Change / request Timestamp settings ........................................................................................ 25
2.8.2 CANopen object dictionary access ............................................................................................. 26
2.9 Hardware access commands .............................................................................................27
2.9.1 Reset device............................................................................................................................... 27
2.9.2 Request analog channel value ................................................................................................... 27
2.9.3 Set Communication password .................................................................................................... 28
2.9.4 Reset Communication password ................................................................................................ 28

3 Commands and Devices 29

4 Index 31

5 ifm weltweit • ifm worldwide • ifm à l’échelle internationale 32

2
ifm Programmer’s Guide Byte Command Protocol API Description 2017-08-08
Preliminary note Copyright

1 Preliminary note
Copyright ............................................................................................................................................... 3
General .................................................................................................................................................. 4
Symbols and formats used .................................................................................................................... 5
History of the instructions ...................................................................................................................... 5
23730

>

1.1 Copyright
23939

© All rights reserved by ifm electronic gmbh. No part of this manual may be reproduced and used
without the consent of ifm electronic gmbh.
All product names, pictures, companies or other brands used on our pages are the property of the respective rights owners:
 AS-i is the property of the AS-International Association, (→ www.as-interface.net)
 CAN is the property of the CiA (CAN in Automation e.V.), Germany (→ www.can-cia.org)
 CODESYS™ is the property of the 3S – Smart Software Solutions GmbH, Germany (→ www.codesys.com)
 DeviceNet™ is the property of the ODVA™ (Open DeviceNet Vendor Association), USA (→ www.odva.org)
 EtherNet/IP® is the property of the →ODVA™
 EtherCAT® is a registered trade mark and patented technology, licensed by Beckhoff Automation GmbH, Germany
 IO-Link® (→ www.io-link.com) is the property of the →PROFIBUS Nutzerorganisation e.V., Germany
 ISOBUS is the property of the AEF – Agricultural Industry Electronics Foundation e.V., Deutschland (→ www.aef-
online.org)
 Microsoft® is the property of the Microsoft Corporation, USA (→ www.microsoft.com)
 PROFIBUS® is the property of the PROFIBUS Nutzerorganisation e.V., Germany (→ www.profibus.com)
 PROFINET® is the property of the →PROFIBUS Nutzerorganisation e.V., Germany
 Windows® is the property of the →Microsoft Corporation, USA

3
ifm Programmer’s Guide Byte Command Protocol API Description 2017-08-08
Preliminary note General

1.2 General
23719

This manual describes the structure and commands used by the Byte Command Protocol. This
protocol is supported by all CAN to wireless gateways from ifm electronic. It is meant for
communication with a remote host via the interface supported by the device. This manual extends the
device specific manuals. In case of uncertainties please also refer to the device manuals of your
specific gateway device.
The CAN to wireless gateways connect a CAN network to a remote host using a specific interface like
Bluetooth or WLAN. The Byte Command Protocol serves for bi-directional transparent CAN message
transmission between the host and the CAN network as well as for the transfer of commands between
host and gateway. Since all CAN to wireless gateways work on the same protocol any application
software can be easily extended to use different communication interfaces by just exchanging the
basic communication routines.
Most of the commands are supported by all gateways, in some cases special commands are not
supported by single devices. The table in chapter Commands and Devices (→ S. 29) gives you an
overview on the commands supported by each single gateway-type.

Normally all commands which influence devices settings are only stored in the volatile
RAM memory of the gateway, after a reset the settings stored in the devices non-
volatile memory are used again. You can change these settings with the device specific
configurator software or – if supported by the device – via CANopen.
Exception: The command "CAN baud rate (→ S. 21)" is stored permanently.

The latest versions of the drivers, software, firmware, documentations and further information and
support are available on our website:
→ ifm weltweit • ifm worldwide • ifm à l’échelle internationale (→ S. 32)

4
ifm Programmer’s Guide Byte Command Protocol API Description 2017-08-08
Preliminary note Symbols and formats used

1.3 Symbols and formats used


23938

WARNING
Death or serious irreversible injuries may result.

CAUTION
Slight reversible injuries may result.

NOTICE
Property damage is to be expected or may result.

Important note
Non-compliance can result in malfunction or interference
Information
Supplementary note
► ... Request for action
> ... Reaction, result
→ ... "see"
abc Cross-reference
123 Decimal number
0x123 Hexadecimal number
0b010 Binary number
[...] Designation of pushbuttons, buttons or indications

>

1.4 History of the instructions


23712

Topic Date
Versions
1.0 New creation of the document 2017-08

5
ifm Programmer’s Guide Byte Command Protocol API Description 2017-08-08
Byte Mode Commands Command Format (Byte Mode)

2 Byte Mode Commands


Command Format (Byte Mode) ............................................................................................................. 6
Extended Command Format (Byte Mode) ............................................................................................ 8
Process Data Messages ....................................................................................................................... 9
Feedback messages ........................................................................................................................... 14
Diagnosis data messages ................................................................................................................... 15
CAN Controller setup messages ......................................................................................................... 19
Host interface configuration messages ............................................................................................... 24
Device parameter settings ................................................................................................................... 25
Hardware access commands .............................................................................................................. 27
23720
>

2.1 Command Format (Byte Mode)


23721

Value Description
Byte(s)
SOF ‘C’ SOF marks the beginning of the command.
(Start of Frame) ‘C’ (0x43) is the default setting. For some devices this value can be changed. This
manual always shows the default setting.
Length 0x00-0xFF The length byte includes the number of data bytes + the number of command bytes
following.
Command 0x00-0xFF Command byte, values 0x00 to 0xFE are direct commands, the value 0xFF means
that the next byte contains a command extension
Data xx Data content
Checksum xx Contains the XOR checksum of the SOF, Length, Command and the Data-bytes.
EOF <CR> EOF byte marks the end of the command.
(End of Frame) 0x0D (Carriage Return) is the default setting. For some devices this value can be
changed. This manual always shows the default setting
"--" means that this value is not of interest
"xx" means that the field contains the configuration / reply value

Each message which changes or requests the settings of the CAN device is replied by
a message with the same command byte, containing the new settings.

Request commands normally do not require additional parameters (no "Data" field).
Exceptions are mentioned in the command description.

6
ifm Programmer’s Guide Byte Command Protocol API Description 2017-08-08
Byte Mode Commands Command Format (Byte Mode)

2.1.1 Example – Command Format


23722

Value Description
Byte(s)
SOF ‘0x43’ SOF marks the beginning of the command.
(Start of Frame)
Length 0x0B The length byte includes the number of data bytes + the number of
command bytes following.
Command 0x00 11 bit ID CAN message
Data 0x07, 0x89, ID (0x789) (MSB first)
0x11, 0x12, 0x13, CAN-message Data content
0x14, 0x15, 0x16,
0x17, 0x18
Checksum 0xCE Contains the XOR checksum of the SOF, Length, Command and the Data-
bytes.
EOF 0x0D EOF byte marks the end of the command.
(End of Frame)

7
ifm Programmer’s Guide Byte Command Protocol API Description 2017-08-08
Byte Mode Commands Extended Command Format (Byte Mode)

2.2 Extended Command Format (Byte Mode)


23723

The Extended Command Format is only available for certain devices. The table in
chapter Commands and Devices (→ S. 29) gives an overview on the commands supported by
each device type.

Value Description
Byte(s)
SOF ‘C’ SOF marks the beginning of the command.
(Start of Frame) ‘C’ (0x43) is the default setting. For some devices this value can be changed. This
manual always shows the default setting.
Length 0x00-0xFF The length byte includes the number of data bytes + the number of command bytes
following.
Extended 0xD0-0xDF Command byte, values 0xD0 to 0xDF are extended commands
Command
Data xx Byte 0: CAN-Channel (starting at 0 for CAN 1) /
128 … 255 reserved for module (WLAN / GSM / GPS…)
Byte 1: Command
Byte 2: Data content
Checksum xx Contains the XOR checksum of the SOF, Length, Command and the Data-bytes.
EOF <CR> EOF byte marks the end of the command.
(End of Frame) 0x0D (Carriage Return) is the default setting. For some devices this value can be
changed. This manual always shows the default setting
"--" means that this value is not of interest
"xx" means that the field contains the configuration / reply value
>

2.2.1 Example – Extended Command


23724

Value Description
Byte(s)
SOF ‘0x43’ SOF marks the beginning of the command.
(Start of Frame)
Length 0x0D The length byte includes the number of data bytes + the number of command
bytes following.
Command 0xD0 Extended Command
Data 0x01 CAN-Channel: 2
0x00 Command: 11 bit ID CAN message
0x07, 0x89, ID (0x789) (MSB first)
0x11, 0x12, 0x13, CAN-message Data content
0x14, 0x15, 0x16,
0x17, 0x18,
Checksum 0x19 Contains the XOR checksum of the SOF, Length, Command and the Data-
bytes.
EOF 0x0D EOF byte marks the end of the command.
(End of Frame)

8
ifm Programmer’s Guide Byte Command Protocol API Description 2017-08-08
Byte Mode Commands Process Data Messages

2.3 Process Data Messages


23725

These messages are used to transmit received CAN messages to the host or to send CAN messages
from the host to the CAN network.
>

2.3.1 CAN data frame reception


23726

CAN data frame messages are received by the gateway from the CAN bus.
These CAN data frame messages are transferred to the host interface in the following format.

Value Description
Byte(s)
SOF ‘C’ SOF marks the beginning of the command.
(Start of Frame)
Length xx The length byte contains the number of data bytes + the number of command bytes
following.
Command 0x00 11 bit ID CAN message received
0x01 11 bit ID CAN message received, message contains an additional 32 bit timestamp
0x02 value.
0x03 29 bit ID CAN message received
29 bit ID CAN message received, message contains an additional 32 bit timestamp
value.
Data For 11 bit ID 0x00-0xFF Byte 0-1:
messages : 11 bit CAN ID (MSB first)
additional data bytes:
Up to 8 CAN data bytes + an additional 32 bit timestamp value
(only if timestamp option is enabled, see below)
For 29 bit ID 0x00-0xFF Byte 0-3:
messages: 29 bit CAN ID (MSB first)
additional data bytes:
Up to 8 CAN data bytes + an additional 32 bit timestamp value
(only if timestamp option is enabled, see below)
Checksum xx Contains the XOR checksum of the SOF, Length, Command and the Data-bytes.
EOF <CR> EOF byte marks the end of the command.
(End of Frame)

If a timestamp is desired, this option must be enabled with the corresponding command
message (→ Change / request Timestamp settings (→ S. 25)).

The usage as extended command is possible (→ Extended Command Format (Byte Mode)
(→ S. 8))

9
ifm Programmer’s Guide Byte Command Protocol API Description 2017-08-08
Byte Mode Commands Process Data Messages

Example – Receive
23937

Byte(s) Value Description


Byte #
1 SOF 'C' SOF marks the beginning of the command.
(Start of Frame)
2 Length = 1 + 14 = 0xF The length byte contains the number of command bytes
following + the number of data bytes.
3 Command 0x01 11 bit ID CAN message received, message contains an
additional 32 bit timestamp value.
4, 5 Data 11 bit ID 0x07, 0x89 ID: 0x789
6 ... 13 CAN data 0x11, 0x12, 0x13, Data: 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18
0x14, 0x15, 0x16,
0x17, 0x18
14 ... Timestamp 0x23, 0x22, 0x21, Timestamp: 0x23222120
17 0x20
Checksum 0xCB Contains the XOR checksum of the SOF, Length, Command
and the Data-bytes.
EOF <CR> EOF byte marks the end of the command.
(End of Frame)

10
ifm Programmer’s Guide Byte Command Protocol API Description 2017-08-08
Byte Mode Commands Process Data Messages

2.3.2 Transmit CAN data frame


23727

In order to transmit CAN data frame messages to the CAN bus, the host interface sends data to the
gateway in the following format.

Value Description
Byte(s)
SOF SOF marks the beginning of the command.
‘C’
(Start of Frame)
Length The length byte contains the number of data bytes + the number of command bytes
xx following.
Command 0x00 Transmit 11 bit ID CAN data frame
0x02 Transmit 29 bit ID CAN data frame
Data For 11 bit ID 0x00-0xFF Byte 0-1:
messages: 11 bit CAN ID (MSB first)
additional data bytes:
Up to 8 CAN data bytes
For 29 bit ID 0x00-0xFF Byte 0-3:
messages: 29 bit CAN ID (MSB first)
additional data bytes:
Up to 8 CAN data bytes
Checksum xx Contains the XOR checksum of the SOF, Length, Command and the Data-bytes.
EOF EOF byte marks the end of the command.
<CR>
(End of Frame)

The usage as extended command is possible (→ Extended Command Format (Byte Mode)
(→ S. 8)).

11
ifm Programmer’s Guide Byte Command Protocol API Description 2017-08-08
Byte Mode Commands Process Data Messages

2.3.3 CAN remote frame reception


23728

CAN remote frame messages received by the gateway from the CAN bus are transferred to the host
interface in the following format.

Value Description
Byte(s)
SOF ‘C’ SOF marks the beginning of the command.
(Start of Frame)
Length xx The length byte contains the number of data bytes + the number of command bytes
following.
Command 0x04 11 bit ID CAN remote frame received
0x05 11 bit ID CAN remote frame received, message contains an additional 32 bit
timestamp value.
0x06 29 bit ID CAN remote frame received
0x07 29 bit ID CAN remote frame received, message contains an additional 32 bit
timestamp value.
Data For 11 bit ID 0x00-0xFF Byte 0-1:
remote 11 bit CAN ID (MSB first)
frames: additional data bytes:
DLC (CAN remote frame Data Length Code) +
an additional 32 bit timestamp value
(only if timestamp option is enabled, see below)
For 29 bit ID 0x00-0xFF Byte 0-3:
remote 29 bit CAN ID (MSB first)
frames: additional data bytes:
DLC (CAN remote frame Data Length Code) +
an additional 32 bit timestamp value
(only if timestamp option is enabled, see below)
Checksum xx Contains the XOR checksum of the SOF, Length, Command and the Data-bytes.
EOF <CR> EOF byte marks the end of the command.
(End of Frame)

If a timestamp is desired, this option must be enabled with the corresponding command
message (→ Change / request Timestamp settings (→ S. 25)).

The usage as extended command is possible (→ Extended Command Format (Byte Mode)
(→ S. 8)).

12
ifm Programmer’s Guide Byte Command Protocol API Description 2017-08-08
Byte Mode Commands Process Data Messages

2.3.4 Transmit CAN remote frame


23729

In order to transmit CAN remote frame messages to the CAN bus, the host interface sends data to the
gateway in the following format.

Value Description
Byte(s)
SOF ‘C’ SOF marks the beginning of the command.
(Start of Frame)
Length xx The length byte contains the number of data bytes + the number of command bytes
following.
Command 0x04 Transmit 11 bit ID CAN remote frame
0x06 Transmit 29 bit ID CAN remote frame
Data For 11 bit ID 0x00-0xFF Byte 0-1:
remote 11 bit CAN ID (MSB first)
frames: additional data byte:
DLC (CAN remote frame Data Length Code)
For 29 bit ID 0x00-0xFF Byte 0-3:
remote 29 bit CAN ID (MSB first)
frames: additional data byte:
DLC (CAN remote frame Data Length Code)
Checksum xx Contains the XOR checksum of the SOF, Length, Command and the Data-bytes.
EOF <CR> EOF byte marks the end of the command.
(End of Frame)

The usage as extended command is possible (→ Extended Command Format (Byte Mode)
(→ S. 8)).

13
ifm Programmer’s Guide Byte Command Protocol API Description 2017-08-08
Byte Mode Commands Feedback messages

2.4 Feedback messages


23731

These messages contain feedback data which allows the user to check the correct transmission of
CAN messages.
>

2.4.1 CAN message transmission feedback


23732

Value Description
Byte(s)
SOF ‘C’ SOF marks the beginning of the command.
(Start of Frame)
Length xx The length byte contains the number of data bytes + the number of command bytes
following.
Command 0x20 11 bit ID CAN message transmitted
0x21 11 bit ID CAN message transmitted,
feedback contains an additional timestamp of the transmission time
0x22 29 bit ID CAN message transmitted
0x23 29 bit ID CAN message transmitted,
feedback contains an additional timestamp of the transmission time
0x24 11 bit ID CAN remote frame transmitted
0x25 11 bit ID CAN remote frame transmitted,
feedback contains an additional timestamp of the transmission time
0x26 29 bit ID CAN remote frame transmitted
0x27 29 bit ID CAN remote frame transmitted,
feedback contains an additional timestamp of the transmission time
Data For 11 bit 0x00-0xFF Byte 0-1:
ID 11 bit CAN ID (MSB first)
messages 0x00-0xFF additional data bytes (not on remote frame feedback):
/ remote Up to 8 CAN Data bytes + an additional 32 bit timestamp value (only if timestamp
frames: option is enabled, see below)
For 29 bit 0x00-0xFF Byte 0-3:
ID 29 bit CAN ID (MSB first)
messages 0x00-0xFF additional data bytes(not on remote frame feedback):
/ remote Up to 8 CAN Data bytes + an additional 32 bit timestamp value (only if timestamp
frames: option is enabled, see below)
Checksum xx Contains the XOR checksum of the SOF, Length, Command and the Data-bytes.
EOF <CR> EOF byte marks the end of the command.
(End of Frame)

If feedback messages are desired, the feedback option has to be enabled by the
corresponding command (→ Feedback / output settings (→ S. 24)).

If a timestamp is favored, this option must be enabled by the corresponding message


(→ Change / request Timestamp settings (→ S. 25)).

The usage as extended command is possible (→ Extended Command Format (Byte Mode)
(→ S. 8)).

14
ifm Programmer’s Guide Byte Command Protocol API Description 2017-08-08
Byte Mode Commands Diagnosis data messages

2.5 Diagnosis data messages


23733
>

2.5.1 Device ID
23734

Value Description
Byte(s)
SOF ‘C’ SOF marks the beginning of the command.
(Start of Frame)
Length xx The length byte contains the number of data bytes + the number of command bytes
following.
Command 0x40 Device ID string (request: no additional data bytes)
Data 0x00-0xFF ID string (only on response)
(only on reply)
Checksum xx Contains the XOR checksum of the SOF, Length, Command and the Data-bytes.
EOF <CR> EOF byte marks the end of the command.
(End of Frame)

The last 2 data bytes of the ID String contain a 16 bit value for individual device
identification. This value can be manipulated with the devices individual configurator
software.

>

2.5.2 Hardware / Software version


23735

Value Description
Byte(s)
SOF ‘C’ SOF marks the beginning of the command.
(Start of Frame)
Length xx The length byte contains the number of data bytes + the number of command bytes
following.
Command 0x41 Hardware / Software version (request: no additional data bytes)
Data 0x00-0xFF Byte 0-1 : Hardware version of the device
(only on reply) Byte 2-3 : Software version of the firmware
Byte 4-5 : Software version of the bootloader
Checksum xx Contains the XOR checksum of the SOF, Length, Command and the Data-bytes.
EOF <CR> EOF byte marks the end of the command.
(End of Frame)

15
ifm Programmer’s Guide Byte Command Protocol API Description 2017-08-08
Byte Mode Commands Diagnosis data messages

Example – Reading Hardware / Software version


23981

Read Request  Device Response

Byte(s) Value Byte # Byte(s) Value


Byte #
1 SOF (Start of Frame) 'C' 1 SOF (Start of Frame) 'C'

2 Length 0x01 2 Length 0x07


3 Command 0x41 3 Command 0x41
4 Checksum 0x03 4, 5 Data Hardware 0x02.
version 0x01

5 EOF (End of Frame) <CR> 6, 7 Software 0x02,


version 0x00
firmware
7, 8 Software 0x00,
version 0x00
bootloader
9 Checksum 0x04
10 EOF (End of Frame) <CR>

16
ifm Programmer’s Guide Byte Command Protocol API Description 2017-08-08
Byte Mode Commands Diagnosis data messages

2.5.3 Error status


23736

Value Description
Byte(s)
SOF ‘C’ SOF marks the beginning of the command.
(Start of Frame)
Length xx The length byte contains the number of data bytes + the number of command bytes
following.
Command 0x42 Error status (request: no additional data bytes)
Data 0x00-0xFF Byte 0:
(only on reply) bit 0: CAN receive buffer overflow
bit 1: CAN transmit timeout
bit 2: CAN error counter overflow
bit 3: CAN bus-off error
bit 4: Host interface syntax error
bit 5: Host interface format error
bit 6: Host interface transmit buffer overflow
bit 7: not used
Byte 1 (Last error code of the CAN controller):
‘0’: No Error
‘1’: More than 5 equal bits in a sequence have occurred
‘2’: Received message does not have the right format
‘3’: Transmitted Message was not acknowledged
‘4’: Not possible to set recessive level during transmission
‘5’: Not possible to set dominant level during transmission
‘6’: received CRC check sum was incorrect
Checksum xx Contains the XOR checksum of the SOF, Length, Command and the Data-bytes.
EOF <CR> EOF byte marks the end of the command.
(End of Frame)

If a timestamp is favored, this option must be enabled by the corresponding message


(→ Change / request Timestamp settings (→ S. 25)).

Each time the error status changes, an error status message is generated
automatically.

The usage as extended command is possible (→ Extended Command Format (Byte Mode)
(→ S. 8)).

17
ifm Programmer’s Guide Byte Command Protocol API Description 2017-08-08
Byte Mode Commands Diagnosis data messages

2.5.4 Interfaces version


23737

Value Description
Byte(s)
SOF ‘C’ SOF marks the beginning of the command.
(Start of Frame)
Length xx The length byte contains the number of data bytes + the number of command bytes
following.
Command 0x44 Interfaces version (e.g. Bluetooth module, WLAN-module, …)
(request: no additional data bytes)
Data 0x00-0xFF ASCII coded version string
(only on reply)
Checksum xx Contains the XOR checksum of the SOF, Length, Command and the Data-bytes.
EOF <CR> EOF byte marks the end of the command.
(End of Frame)

The usage as extended command is possible (→ Extended Command Format (Byte Mode)
(→ S. 8)).
Modul is selectable.
>

2.5.5 Device busy / command not supported


23739

Value Description
Byte(s)
SOF ‘C’ SOF marks the beginning of the command.
(Start of Frame)
Length xx The length byte contains the number of data bytes + the number of command bytes
following.
Command 0x48 Device cannot execute command
(only response on other commands)
Data 0x00-0xFF Reserved for future use
Checksum xx Contains the XOR checksum of the SOF, Length, Command and the Data-bytes.
EOF <CR> EOF byte marks the end of the command.
(End of Frame)

The usage as extended command is possible (→ Extended Command Format (Byte Mode)
(→ S. 8)).

18
ifm Programmer’s Guide Byte Command Protocol API Description 2017-08-08
Byte Mode Commands CAN Controller setup messages

2.6 CAN Controller setup messages


23741
>

2.6.1 Change / request receive channel ID settings


23742

Value Description
Byte(s)
SOF ‘C’ SOF marks the beginning of the command.
(Start of Frame)
Length xx The length byte contains the number of data bytes + the number of command bytes
following.
Command 0x50 Request receive channel ID settings
(needs one additional data byte = channel number)
0x51 Change receive channel ID settings
(needs at least two additional data bytes, the channel number and the channel
settings)
Data 0x00-0xFF Byte 0:
Receive object number (range depends on gateway device)
0…15

0x00-0x07 Byte 1:
bit 0: 0 = channel disable, 1 = channel enable
bit 1: 0 = receive 11 bit ID, 1 = receive 29 bit ID
bit 2: 0 = change 11 bit ID, 1 = change 29 bit ID
Byte 2-3: 11 bit ID if byte1, bit 2 = 0
Byte 2-5: 29 bit ID if byte1, bit 2 = 1
Checksum xx Contains the XOR checksum of the SOF, Length, Command and the Data-bytes.
EOF <CR> EOF byte marks the end of the command.
(End of Frame)

If the change message contains no ID information (length byte < 4) the last ID setting
remains. In this case byte 1, bit 2 is ignored.

The usage as extended command is possible (→ Extended Command Format (Byte Mode)
(→ S. 8)).

19
ifm Programmer’s Guide Byte Command Protocol API Description 2017-08-08
Byte Mode Commands CAN Controller setup messages

2.6.2 Change / request receive channel mask settings


23743

Value Description
Byte(s)
SOF ‘C’ SOF marks the beginning of the command.
(Start of Frame)
Length xx The length byte contains the number of data bytes + the number of command bytes
following.
Command 0x52 Request receive channel mask settings
(needs one additional data byte = channel number)
0x53 Change receive channel mask settings
(needs at least two additional data bytes, the channel number and the channel
settings)
Data 0x00-0xFF Byte 0:
Receive object number (range depends on gateway device)
0…15

0x00-0x07 Byte 1:
bit 0: 0 = channel disable, 1 = channel enable
bit 1: 0 = receive 11 bit mask, 1 = receive 29 bit mask
bit 2: 0 = change 11 bit mask, 1 = change 29 bit mask
Byte 2-3: 11 bit mask if byte1, bit 2 = 0
Byte 2-5: 29 bit mask if byte1, bit 2 = 1
Checksum xx Contains the XOR checksum of the SOF, Length, Command and the Data-bytes.
EOF <CR> EOF byte marks the end of the command.
(End of Frame)

If the change message contains no mask information (length byte < 4) the last mask
setting remains. In this case byte 1, bit 2 is ignored.

The usage as extended command is possible (→ Extended Command Format (Byte Mode)
(→ S. 8)).

20
ifm Programmer’s Guide Byte Command Protocol API Description 2017-08-08
Byte Mode Commands CAN Controller setup messages

2.6.3 CAN baud rate


23744

Value Description
Byte(s)
SOF ‘C’ SOF marks the beginning of the command.
(Start of Frame)
Length xx The length byte contains the number of data bytes + the number of command bytes
following.
Command 0x56 Request CAN baud rate parameters (no additional data bytes)
0x57 Set CAN baud rate Parameters
Data 0x00-0xFF Byte 0: 0xFF if no CIA conform standard baud rate, else:
0x00 : 10 kBit / sec
0x01 : 20 kBit / sec
0x02: 50 kBit / sec
0xFE: 100 kBit / sec
0x03 : 125 kBit / sec
0x04: 250 kBit / sec
0x05: 500 kBit / sec
0x06: 800 kBit / sec
0x07: 1 MBit / sec
0xFF: BTR values are used
Byte 1: BTR0 Value (device dependent, only if Byte 0 = 0xFF)
Byte 2: BTR1 Value (device dependent, only if Byte 0 = 0xFF)
Byte 3: BTR2 Value (device dependent, only if Byte 0 = 0xFF)
Byte 4: BTR3 Value (device dependent, only if Byte 0 = 0xFF)
Checksum xx Contains the XOR checksum of the SOF, Length, Command and the Data-bytes.
EOF <CR> EOF byte marks the end of the command.
(End of Frame)

If data byte 0 is set to 0xFF, the BTR values are used to set nonstandard baud rates. If
a standard baud rate is used, the BTR values are not necessary, if they are used
anyway, they are ignored!

If you need to set a baud rate that is not supported by the standard settings of the
device, please contact our support for further information:
→ ifm weltweit • ifm worldwide • ifm à l’échelle internationale (→ S. 32)

The usage as extended command is possible (→ Extended Command Format (Byte Mode)
(→ S. 8)).

21
ifm Programmer’s Guide Byte Command Protocol API Description 2017-08-08
Byte Mode Commands CAN Controller setup messages

2.6.4 CAN controller reset


23745

Value Description
Byte(s)
SOF ‘C’ SOF marks the beginning of the command.
(Start of Frame)
Length xx The length byte contains the number of data bytes + the number of command bytes
following.
Command 0x58 CAN controller reset (no additional data bytes)
Checksum xx Contains the XOR checksum of the SOF, Length, Command and the Data-bytes.
EOF <CR> EOF byte marks the end of the command.
(End of Frame)

The "CAN Controller Reset" command performs a complete reset of the CAN controller,
including the timestamp value, receive and transmit buffers.

The CAN controller reset also resets the error status of the device. For this reason, after
the CAN controller reset, an error status message is generated, to update the error
status.

The usage as extended command is possible (→ Extended Command Format (Byte Mode)
(→ S. 8)).
>

2.6.5 Set / request active / passive mode


23747

Value Description
Byte(s)
SOF ‘C’ SOF marks the beginning of the command.
(Start of Frame)
Length xx The length byte contains the number of data bytes + the number of command bytes
following.
Command 0x5A Request active / passive mode (no additional data bytes)
0x5B Set active passive mode
Data 0x00-0x01 0x00 device = active mode
0x01 device = passive mode
Checksum xx Contains the XOR checksum of the SOF, Length, Command and the Data-bytes.
EOF <CR> EOF byte marks the end of the command.
(End of Frame)

The usage as extended command is possible (→ Extended Command Format (Byte Mode)
(→ S. 8)).

22
ifm Programmer’s Guide Byte Command Protocol API Description 2017-08-08
Byte Mode Commands CAN Controller setup messages

2.6.6 Change / request receive channel cycle time


23748

Value Description
Byte(s)
SOF ‘C’ SOF marks the beginning of the command.
(Start of Frame)
Length xx The length byte contains the number of data bytes + the number of command bytes
following.
Command 0x5C Request CAN cycle time parameters (no additional data bytes)
0x5D Set CAN cycle time parameters
Data 0x00-0xFF Byte 0:
Receive object number (range depends on gateway device)
0…15

0x00-0xFF Byte 1:
Cycle Time in 10 ms
Checksum xx Contains the XOR checksum of the start byte, the length byte, the command byte and
the data bytes.
EOF <CR> EOF byte marks the end of the command.
(End of Frame)

The usage as extended command is possible (→ Extended Command Format (Byte Mode)
(→ S. 8)).

23
ifm Programmer’s Guide Byte Command Protocol API Description 2017-08-08
Byte Mode Commands Host interface configuration messages

2.7 Host interface configuration messages


23749
>

2.7.1 Feedback / output settings


23750

Value Description
Byte(s)
SOF ‘C’ SOF marks the beginning of the command.
(Start of Frame)
Length xx The length byte contains the number of data bytes + the number of command bytes
following.
Command 0x60 Request feedback settings (no additional data bytes)
0x61 Set feedback settings
Data 0x00-0x07 Byte 0:
bit 0: 1 = CAN output on / 0 = CAN output off
bit 1: 1 = Transmit can message feedback on / 0 = feedback off
bit 2: 1 = Server feedback on / 0 = server feedback off
bit 3: 1 = RS232 interface on / 0 = RS232 interface off
Checksum xx Contains the XOR checksum of the SOF, Length, Command and the Data-bytes.
EOF <CR> EOF byte marks the end of the command.
(End of Frame)

If the serial output is disabled, the received CAN messages are stored in the RAM of
the CAN device. If this buffer is full, a buffer overflow error is indicated. If the output is
enabled, all stored messages are transmitted immediately to the host interface.

The usage as extended command is possible (→ Extended Command Format (Byte Mode)
(→ S. 8)).

24
ifm Programmer’s Guide Byte Command Protocol API Description 2017-08-08
Byte Mode Commands Device parameter settings

2.8 Device parameter settings


23751
>

2.8.1 Change / request Timestamp settings


23752

Value Description
Byte(s)
SOF ‘C’ SOF marks the beginning of the command.
(Start of Frame)
Length xx The length byte contains the number of data bytes + the number of command bytes
following.
Command 0xA0 Request timestamp settings (request: no additional data bytes)
0xA1 Set timestamp settings
Data 0x00-0x13 Byte 0:
bit 0: 1 = Timestamp on ,
0 = Timestamp off
bit 1: 1 = Relative timestamp,
0 = Absolute timestamp
bit 4: 1 = Error and Echo Feedback timestamp on
0 = Error and Echo Feedback timestamp off
Checksum xx Contains the XOR checksum of the SOF, Length, Command and the Data-bytes.
EOF <CR> EOF byte marks the end of the command.
(End of Frame)

If the "Timestamp-Mode" is selected, a 32 bit counter (100 µs resolution) value is inserted after the last
data byte of each received CAN message. All messages on the host interface side which contain a
timestamp are in the correct chronological order.

If a timestamp should be inserted after the echoed messages ("Transmit Server Feedback" or "Send
CAN Message Feedback") and the error messages, The ‘Error and Echo Feedback timestamp’ has to
be activated additionally.

The difference between "relative-" and "absolute-mode" is that the counter value is reset after each
received message in "relative-mode".

The "Error and Echo Feedback" timestamp is only transmitted if the timestamp mode is
enabled.

The usage as extended command is possible (→ Extended Command Format (Byte Mode)
(→ S. 8)).

25
ifm Programmer’s Guide Byte Command Protocol API Description 2017-08-08
Byte Mode Commands Device parameter settings

2.8.2 CANopen object dictionary access


23756

Value Description
Byte(s)
SOF ‘C’ SOF marks the beginning of the command.
(Start of Frame)
Length xx The length byte contains the number of data bytes + the number of command bytes
following.
Command 0xA5 Read / Write in the object dictionary
Data 0x00-0xFF Request:
Byte 0:
Command: 0x01 write ,0x00 read (no additional data bytes)
Byte 1-2:
Index (LSB first)
Byte 3:
Sub-index
additional data bytes:
Data (LSB first)

Response
Byte 0:
Result: 0x40 read success
0x80 read failure (no additional data bytes)
0x41 write success (no additional data bytes)
0x81 write failure (no additional data bytes)
Byte 1-2:
Index (LSB first)
Byte 3:
Sub-index
additional data bytes:
Data (LSB first)
Checksum xx Contains the XOR checksum of the SOF, Length, Command and the Data-bytes.
EOF <CR> EOF byte marks the end of the command.
(End of Frame)

26
ifm Programmer’s Guide Byte Command Protocol API Description 2017-08-08
Byte Mode Commands Hardware access commands

2.9 Hardware access commands


23757
>

2.9.1 Reset device


23758

Value Description
Byte(s)
SOF ‘C’ SOF marks the beginning of the command.
(Start of Frame)
Length xx The length byte contains the number of data bytes + the number of command bytes
following.
Command 0xC0 Set reset device
Data --
Checksum xx Contains the XOR checksum of the SOF, Length, Command and the Data-bytes.
EOF <CR> EOF byte marks the end of the command.
(End of Frame)

The devices respond to this command with the Command Device ID (→ S. 15).

For some device this command does not lead to a hardware reset since the
communication to the host would be lost otherwise:
 CANwireless
>

2.9.2 Request analog channel value


23759

Value Description
Byte(s)
SOF ‘C’ SOF marks the beginning of the command.
(Start of Frame)
Length xx The length byte contains the number of data bytes + the number of command bytes
following.
Command 0xC2 Request analog channel value (needs 1 additional data byte containing the channel
number)
Data 0x00-0x03 Byte 0 (channel number):
0x00: Supply voltage
0x00-0xFF Byte 1: analog value (for channel 0…2, see description below)
Checksum xx Contains the XOR checksum of the SOF, Length, Command and the Data-bytes.
EOF <CR> EOF byte marks the end of the command.
(End of Frame)

27
ifm Programmer’s Guide Byte Command Protocol API Description 2017-08-08
Byte Mode Commands Hardware access commands

2.9.3 Set Communication password


23761

Value Description
Byte(s)
SOF ‘C’ SOF marks the beginning of the command.
(Start of Frame)
Length xx The length byte contains the number of data bytes + the number of command bytes
following.
Command 0xC6 Request communication password check
Data xx Command
Byte 0…n:
Password string (default: "GSMONLIN")
Response
Byte 0:
0 = password checked and OK
If password check failed, there is no response from the device
Checksum xx Contains the XOR checksum of the SOF, Length, Command and the Data-bytes.
EOF <CR> EOF byte marks the end of the command.
(End of Frame)

This message is very important to unlock the whole functionality of byte mode interface
at CANremote GSM/UMTS. A session is only possible with a check of the correct
communication password!
>

2.9.4 Reset Communication password


23762

Value Description
Byte(s)
SOF ‘C’ SOF marks the beginning of the command.
(Start of Frame)
Length xx The length byte contains the number of data bytes + the number of command bytes
following.
Command 0xC7 Reset communication password check
Checksum xx Contains the XOR checksum of the SOF, Length, Command and the Data-bytes.
EOF <CR> EOF byte marks the end of the command.
(End of Frame)

This message locks the byte mode interface. This command should be send at the end
of a communication session.

28
ifm Programmer’s Guide Byte Command Protocol API Description 2017-08-08
Commands and Devices Hardware access commands

3 Commands and Devices


23763

The table below gives a summary of all existing commands and indicates which device supports them.
The usability of a command for a device is marked with a "S", "E" or "S / E".
these acronyms stand for:
S The device supports this command only in the standard command format (→ Command
Format (Byte Mode) (→ S. 6))
E The device supports this command only in the extended command format (→ Extended
Command Format (Byte Mode) (→ S. 8)).
S/E The device supports this command in the standard command format and in the extended
command format.

Command CANwireless CANremote


Message Type
(CR3130 / CR3131) (CR3114)

Process Data Messages (→ S. 9) 0x00 S S


0x01 S S
0x02 S S
0x03
S S

0x04 S S
0x05 S S
0x06
S S

0x07 S S
0x09 S
Feedback messages (→ S. 14) 0x20 S S
0x21 S S
0x22
S S

0x23 S S
0x24 S S
0x25 S S
0x26 S S
0x27 S S
Diagnosis data messages (→ S. 15) 0x40 S S
0x41 S S
0x42 S S
0x44 S S
0x48 S S
CAN Controller setup messages (→ S. 19) 0x50 S S
0x51 S S
0x52 S S
0x53 S S
0x56 S S
0x57 S S
0x58 S S
0x5A S S
0x5B S S
0x5B S S
0x5C S S
0x5D S S

29
ifm Programmer’s Guide Byte Command Protocol API Description 2017-08-08
Commands and Devices Hardware access commands

Command CANwireless CANremote


Message Type
(CR3130 / CR3131) (CR3114)

Host interface configuration messages 0x60 S S


(→ S. 24) S
0x61 S
Device parameter settings (→ S. 25) 0xA0 S S
0xA1 S S
0xA5 S
Hardware access commands (→ S. 27) 0xC0 S S
0xC0 S
0xC6 S S
0xC7
S S

30
ifm Programmer’s Guide Byte Command Protocol API Description 2017-08-08
Index

Reset Communication password ...........................................................28


4 Index Reset device ..........................................................................................27

B S
Byte Mode Commands ............................................................................6 Set / request active / passive mode ......................................................22
Set Communication password ...............................................................28
C Symbols and formats used ......................................................................5
CAN baud rate .......................................................................................21 T
CAN controller reset ..............................................................................22
CAN Controller setup messages ...........................................................19 Transmit CAN data frame ......................................................................11
CAN data frame reception .......................................................................9 Transmit CAN remote frame..................................................................13
CAN message transmission feedback ..................................................14
CAN remote frame reception .................................................................12
CANopen object dictionary access........................................................26
Change / request receive channel cycle time .......................................23
Change / request receive channel ID settings ......................................19
Change / request receive channel mask settings .................................20
Change / request Timestamp settings...................................................25
Command Format (Byte Mode) ...............................................................6
Commands and Devices .......................................................................29
Copyright..................................................................................................3

D
Device busy / command not supported .................................................18
Device ID ...............................................................................................15
Device parameter settings .....................................................................25
Diagnosis data messages .....................................................................15

E
Error status ............................................................................................17
Example – Command Format ...............................................................7
Example – Extended Command..............................................................8
Example – Reading Hardware / Software version ................................16
Example – request - response...............................................................10
Extended Command Format (Byte Mode) ..............................................8

F
Feedback / output settings ....................................................................24
Feedback messages .............................................................................14

G
General ....................................................................................................4

H
Hardware / Software version .................................................................15
Hardware access commands ................................................................27
History of the instructions ........................................................................5
Host interface configuration messages .................................................24

I
ifm weltweit • ifm worldwide • ifm à l’échelle internationale...................32
Interfaces version ..................................................................................18

P
Preliminary note .......................................................................................3
Process Data Messages..........................................................................9

R
Request analog channel value ..............................................................27

31
5 ifm weltweit • ifm worldwide • ifm à l’échelle
internationale
Stand: 2016-11-29 8310

ifm electronic gmbh • Friedrichstraße 1 • 45128 Essen


www.ifm.com • E-Mail: info@ifm.com
Service-Hotline: 0800 16 16 16 4 (nur Deutschland, Mo...Fr, 07.00...18.00 Uhr)
ifm Niederlassungen • Sales offices • Agences
D Niederlassung Nord • 31135 Hildesheim • Tel. 0 51 21 / 76 67-0
Niederlassung West • 45128 Essen • Tel. 02 01 / 3 64 75 -0
Niederlassung Mitte-West • 58511 Lüdenscheid • Tel. 0 23 51 / 43 01-0
Niederlassung Süd-West • 64646 Heppenheim • Tel. 0 62 52 / 79 05-0
Niederlassung Baden-Württemberg • 73230 Kirchheim • Tel. 0 70 21 / 80 86-0
Niederlassung Bayern • 82178 Puchheim • Tel. 0 89 / 8 00 91-0
Niederlassung Ost • 07639 Tautenhain • Tel. 0 36 601 / 771-0

A, SL ifm electronic gmbh • 1120 Wien • Tel. +43 16 17 45 00


AUS ifm efector pty ltd. • Mulgrave Vic 3170 • Tel. +61 3 00 365 088
B, L ifm electronic N.V. • 1731 Zellik • Tel. +32 2 / 4 81 02 20
BG ifm electronic eood • 1202 Sofia • Tel. +359 2 807 59 69
BR ifm electronic Ltda. • 03337-000, Sao Paulo SP • Tel. +55 11 / 2672-1730
CH ifm electronic ag • 4 624 Härkingen • Tel. +41 62 / 388 80 30
CL ifm electronic SpA • Oficina 5032 Comuna de Conchalí • Tel. +55 11 / 2672-1730
CN ifm electronic (Shanghai) Co. Ltd. • 201203 Shanghai • Tel. +86 21 / 3813 4800
CND ifm efector Canada inc. • Oakville, Ontario L6K 3V3 • Tel. +1 800-441-8246
CZ ifm electronic spol. s.r.o. • 25243 Průhonice • Tel. +420 267 990 211
DK ifm electronic a/s • 2605 BROENDBY • Tel. +45 70 20 11 08
E ifm electronic s.a. • 08820 El Prat de Llobregat • Tel. +34 93 479 30 80
F ifm electronic s.a. • 93192 Noisy-le-Grand Cedex • Tél. +33 0820 22 30 01
FIN ifm electronic oy • 00440 Helsinki • Tel . +358 75 329 5000
GB, IRL ifm electronic Ltd. • Hampton, Middlesex TW12 2HD • Tel. +44 208 / 213-0000
GR ifm electronic Monoprosopi E.P.E. • 15125 Amaroussio • Tel. +30 210 / 6180090
H ifm electronic kft. • 9028 Györ • Tel. +36 96 / 518-397
I ifm electronic s.a. • 20041 Agrate-Brianza (MI) • Tel. +39 039 / 68.99.982
IL Astragal Ltd. • Azur 58001 • Tel. +972 3 -559 1660
IND ifm electronic India Branch Office • Kolhapur, 416234 • Tel. +91 231-267 27 70
J efector co., ltd. • Chiba-shi, Chiba 261-7118 • Tel. +81 043-299-2070
MAL ifm electronic Pte. Ltd • 47100 Puchong Selangor • Tel. +603 8063 9522
MEX ifm efector S. de R. L. de C. V. • Monterrey, N. L. 64630 • Tel. +52 81 8040-3535
N Sivilingeniør J. F. Knudtzen A/S • 1396 Billingstad • Tel. +47 66 / 98 33 50
NA ifm elctronic (pty) Ltd • 25 Dr. W. Kulz Street Windhoek • Tel. +264 61 300984
NL ifm electronic b.v. • 3843 GA Harderwijk • Tel. +31 341 / 438 438
NZ ifm efector pty ltd • 930 Great South Road Penrose, Auckland • Tel. +64 95 79 69 91
P ifm electronic s.a. • 4410-136 São Félix da Marinha • Tel. +351 223 / 71 71 08
PL ifm electronic Sp. z o.o. • 40-106 Katowice • Tel. +48 32-608 74 54
RA, ROU ifm electronic s.r.l. • 1107 Buenos Aires • Tel. +54 11 / 5353 3436
RO ifm electronic s.r.l • Sibiu 557260 • Tel. +40 269 224550
ROK ifm electronic Ltd. • 140-884 Seoul • Tel. +82 2 / 790 5610
RUS ifm electronic • 105318 Moscow • Tel. +7 495 921-44-14
S ifm electronic a b • 41250 Göteborg • Tel. +46 31 / 750 23 00
SGP ifm electronic Pte. Ltd. • Singapore 609 916 • Tel. +65 6562 8661/2/3
SK ifm electronic s.r.o. • 835 54 Bratislava • Tel. +421 2 / 44 87 23 29
THA SCM Allianze Co., Ltd. • Bangkok 10 400 • Tel. +66 02 615 4888
TR ifm electronic Ltd. Sti. • 34381 Sisli/Istanbul • Tel. +90 212 / 210 50 80
UA TOV ifm electronic • 02660 Kiev • Tel. +380 44 501 8543
USA ifm efector inc. • Exton, PA 19341 • Tel. +1 610 / 5 24-2000
VN ifm electronic • Ho Chi Minh city 700000 • Tel. +84-8-35125177
ZA ifm electronic (Pty) Ltd. • 0157 Pretoria • Tel. +27 12 345 44 49
Technische Änderungen behalten wir uns ohne vorherige Ankündigung vor.
We reserve the right to make technical alterations without prior notice.
Nous nous réservons le droit de modifier les données techniques sans préavis.

32

You might also like