Emergency telegrams and diagnostics

The status of the CAN slave is indicated by NodeState. The DiagFlag is set if an emergency telegram was received. The EmergencyCounter is incremented with each emergency telegram.

NodeState, DiagFlag and EmergencyCounter

NodeState value

Description

0

No error

1

Node deactivated

2

Node not found

4

SDO syntax error at Start Up

5

SDO data mismatch at Start Up

8

Node start up in progress

11

SSB Bus off

12

Pre-Operational

13

Severe bus fault

14

Guarding: toggle error

20

TxPDO too short

22

Expected TxPDO is missing

23

Node is Operational but not all TxPDOs were received

ADS Port 153

Reading of emergency telegrams with AdsRead

Input parameters

Description

NETID

local NetId of BX

Port number

153

IDXGRP

16#xxxxF180 (xxxx) NodeId, the Diag flag is only reset when at least 106 bytes are read
16#xxxxF181 (xxxx) NodeId, the Diag flag is reset immediately

IDXOFFS

Byte Offset

Description of the array

Offset

Bit

Value / description

0 - 1

Bit 0

reserved

Bit 1

Boot up message not received or incorrect

Bit 2

Emergency-Overflow

Bit 3 - 15

reserved

2 - 3

Bit 0 - 14

TX-PDO (i+1) received

Bit 15

All TX PDOs 16-n received

4 - 5

Bit 0 - 4

1: Incorrect TX PDO length

2: Synchronous TX PDO absent

3: Node signaling PRE-OPERATIONAL

4: Event timer timed out for TX PDO

5: No response and guarding is activated

6: Toggling missed several times and guarding activated

Bit 5 - 15

Associated COB ID

6

Bit 0 - 7

1: Incorrect value during SDO upload

2: Incorrect length during SDO upload

3: Abort during SDO up/download

4: Incorrect date during a boot-up message

5: Timeout while waiting for a boot-up message

7

Bit 0 - 7

2: Incorrect SDO command specifier

3: SDO toggle bit has not changed

4: SDO length too great

5: SDO-Abort

6: SDO-Timeout

8 - 9

Bit 0 - 7

SDO up/download index

10

Bit 0 - 7

SDO up/download subindex

11

Bit 0 - 7

reserved

12

Bit 0 - 7

errorClass des Aborts

13

Bit 0 - 7

errorCode des Aborts

14 - 15

Bit 0 - 15

Abort additionalCode

16 - 19

 

Read value (if offset 6 = 1)

20 - 23

 

Expected value (if offset 6 = 1)

24 - 25

 

Number of consecutive emergencies

26 - n

 

Emergencies (8 bytes each)

Emergency telegrams and diagnostics 1: Download BX (sample file)

Emergency telegrams and diagnostics 2: Download sample System Manager file BX (sample file)

emergencymessage.prx

emergencymessage.tsm

Reading the number of PDO telegrams with AdsRead

Input parameters

Description

NETID

local NetId of BX

Port number

153

IDXGRP

16#xxxxF930 (xxxx) NodeId

IDXOFFS

0

Emergency telegrams and diagnostics 3: Download BX (sample file)

Emergency telegrams and diagnostics 4:

Configuration of the node ID required

The node ID must be configured before the ADS function blocks is called in the TwinCAT configuration.

can_counter_pdo.prx

Sending a CAN message

This ADSWRITE command enables any CAN message to be sent.

Input parameters

Description

NETID

local NetId of BX

Port Nummer

153

IDXGRP

16#0000F921

IDXOFFS

0

LEN

11 bytes

SRCADDR

Pointer to an 11 byte ARRAY

Structure of the 11 byte CAN data

Byte

Description

Example Node 7 SDO 0x607
Len 8 Download Request 0x2100 (Index)
Sub Index 1 - Value "1"

1

COB-ID LowByte

0x06 (SDO Low Byte)

2

COB-ID HighByte

0x07 (SDO High Byte)

3

LEN (length)

0x08 (LEN, may be 5 in this case)

4

Data[1]

0x22 (Download Request)

5

Data[2]

0x00 (Index Low Byte)

6

Data[3]

0x21 (Index High Byte)

7

Data[4]

0x01 (Sub Index)

8

Data[5]

0x01 (Value "1")

9

Data[6]

0x00

10

Data[7]

0x00

11

Data[8]

0x00