logo资料库

CiA 309-2 DS V1.1 Interfacing CANopen with TCPIP - Part 2 ModbusTCP mapping(IGCO_309_2v01010001)(英文原版协议).pdf

第1页 / 共66页
第2页 / 共66页
第3页 / 共66页
第4页 / 共66页
第5页 / 共66页
第6页 / 共66页
第7页 / 共66页
第8页 / 共66页
资料共66页,剩余部分请下载后查看
CiA Draft Standard 309 CANopen Interfacing CANopen with TCP/IP Part 2: Modbus/TCP mapping Version 1.1 12 December 2006 © CAN in Automation (CiA) e. V.
CiA 309-2 Interfacing CANopen with TCP/IP - Part 2: Modbus/TCP mapping Version 1.1 HISTORY Date Changes 2004-09-30 Publication of version 1.0 as draft standard proposal Publication of version 1.1 as draft standard Minor editorial corrections and clarifications. 2006-12-12 General information on licensing and patents CAN in AUTOMATION (CiA) calls attention to the possibility that some of the elements of this CiA specification may be subject of patent rights. CiA shall not be responsible for iden- tifying any or all such patent rights. The use of this document requires a license. This license can be accepted when you download the document from the CAN in Automation e. V. or the Modbus-IDA website, by use of the document you accept the license terms posted thereon, or you may make a written request for a license from either organization. The use or the implementation of the specification is not permitted without your acceptance of the license agreement. Because this specification is licensed free of charge, there is no warranty for this specifica- tion, to the extent permitted by applicable law. Except when otherwise stated in writing the copyright holder and/or other parties provide this specification “as is” without warranty of any kind, either expressed or implied, including, but not limited to, the implied warranties of merchantability and fitness for a particular purpose. The entire risk as to the correctness and completeness of the specification is with you. Should this specification prove failures, you assume the cost of all necessary servicing, repair or correction. © CiA 2008 All rights reserved. Unless otherwise specified, no part of this publication may be reproduced or utilized in any form or by any means, electronic or mechanical, including photocopying and micro- film, without permission in writing from CiA at the address below. CAN in Automation e. V. Kontumazgarten 3 DE - 90429 Nuremberg, Germany Tel.: +49-911-928819-0 Fax: +49-911-928819-79 Url: www.can-cia.org Email: headquarters@can-cia.org 2 © CiA 2008 - All rights reserved
CiA 309-2 Interfacing CANopen with TCP/IP - Part 2: Modbus/TCP mapping Version 1.1 Contents 1 Scope.................................................................................................................................................. 5 2 References ......................................................................................................................................... 5 3 Abbreviations and definitions............................................................................................................ 5 3.1 Abbreviations .............................................................................................................................. 5 3.2 Definitions.................................................................................................................................... 5 3.2.1 General................................................................................................................................. 5 3.2.2 CANopen general reference command.............................................................................. 5 3.2.3 Request and response definition ........................................................................................ 6 4 Network access command specification ........................................................................................ 11 4.1 SDO access commands........................................................................................................... 11 4.1.1 General............................................................................................................................... 11 4.1.2 Upload SDO command ..................................................................................................... 12 4.1.3 Download SDO command................................................................................................. 13 4.1.4 Configure SDO timeout command.................................................................................... 14 4.2 PDO access commands........................................................................................................... 15 4.2.1 General............................................................................................................................... 15 4.2.2 Configure RPDO command .............................................................................................. 15 4.2.3 Configure TPDO command............................................................................................... 15 4.2.4 Read PDO data command................................................................................................ 15 4.2.5 Write PDO data command ................................................................................................ 15 4.2.6 RPDO received command ................................................................................................ 15 4.3 CANopen NMT commands ...................................................................................................... 16 4.3.1 General............................................................................................................................... 16 4.3.2 Start node command ......................................................................................................... 16 4.3.3 Stop node command ......................................................................................................... 18 4.3.4 Set node to pre-operational command............................................................................. 19 4.3.5 Reset node command ....................................................................................................... 21 4.3.6 Reset communication node command............................................................................. 23 4.3.7 Enable node guarding command...................................................................................... 24 4.3.8 Disable node guarding command..................................................................................... 26 4.3.9 Start heartbeat consumer command................................................................................ 27 4.3.10 Disable heartbeat consumer command ......................................................................... 28 4.3.11 Error control event received............................................................................................ 29 4.4 Device failure management commands.................................................................................. 30 4.4.1 General............................................................................................................................... 30 4.4.2 Read device error command............................................................................................. 30 4.4.3 Emergency event received command.............................................................................. 32 4.5 CANopen interface configuration commands ......................................................................... 32 4.5.1 General............................................................................................................................... 32 4.5.2 Initialize gateway command.............................................................................................. 32 4.5.3 Store configuration command........................................................................................... 34 4.5.4 Restore configuration command....................................................................................... 35 © CiA 2008 - All rights reserved 3
CiA 309-2 Interfacing CANopen with TCP/IP - Part 2: Modbus/TCP mapping Version 1.1 4.5.5 Set heartbeat producer command.................................................................................... 37 4.5.6 Set node ID ........................................................................................................................ 38 4.6 Gateway management command ........................................................................................... 39 4.6.1 General............................................................................................................................... 39 4.6.2 Set default network ............................................................................................................ 39 4.6.3 Set the default node ID command.................................................................................... 40 4.6.4 Get version ......................................................................................................................... 41 4.7 Controller management command .......................................................................................... 42 4.7.1 General............................................................................................................................... 42 4.7.2 Controller reset command................................................................................................. 43 4.7.3 Start controller command .................................................................................................. 44 4.7.4 Stop controller command .................................................................................................. 45 5 CANopen general reference exception PDU................................................................................. 46 5.1 CANopen general reference standard exception PDU .......................................................... 46 5.2 CANopen general reference extended exception PDU ......................................................... 47 5.2.1 Unsupported options exception PDU ............................................................................... 48 5.2.2 SDO/PDO services, network management and server services complete ................... 49 6 Usage ............................................................................................................................................... 49 6.1 General...................................................................................................................................... 49 6.2 Simple Modbus request ........................................................................................................... 50 6.3 Extended request...................................................................................................................... 50 6.3.1 General............................................................................................................................... 50 6.3.2 Extended request with the counter field........................................................................... 50 6.3.3 Extended request – Invalid fragment................................................................................ 52 6.3.4 Incomplete extended request............................................................................................ 53 6.3.5 Extended request – Missing fragment.............................................................................. 57 6.3.6 Receiving extended SDO request from a 2nd client while performing extended request from a 1st client................................................................................................................................ 57 6.3.7 Simple modbus request cannot be satisfied with a simple Modbus response.............. 59 Appendix A.............................................................................................................................................. 60 Appendix B.............................................................................................................................................. 63 Appendix C ............................................................................................................................................. 64 Appendix D ............................................................................................................................................. 65 4 © CiA 2008 - All rights reserved
CiA 309-2 Interfacing CANopen with TCP/IP - Part 2: Modbus/TCP mapping Version 1.1 1 Scope This specification specifies the services and protocols to interface CANopen networks to a TCP/IP- based network. This set of specifications is organized as follows: • Part 1: General principles and services • Part 2: Modbus/TCP mapping • Part 3: ASCII mapping This part of the specification defines the mapping of services defined in /CiA 309-1/ on Mod- bus/TCP. It is intended to access CANopen devices via a gateway device from a remotely Mod- bus/TCP connected device (e.g. PLC or tool). 2 References The references given in part 1 shall apply to this part, too. /CiA309-1/ CiA 309:2006, Interfacing CANopen with TCP/IP – Part 1: General principles and services (V1.1) Modbus Application Protocol: December 2002 (www.modbus.org) (V1.1) Request for comments (RFC) 791 internet protocol: September 1981 /MAP/ /RFC/ 3 Abbreviations and definitions 3.1 Abbreviations The abbreviations given in part 1shall apply to this part, too. ADU PDU MEI MEC Application Data Unit Protocol Data Unit Modbus Encapsulated Interface Modbus Exception Codes General CANopen general reference command 3.2 Definitions 3.2.1 The definitions given in /CiA 301/ and part 1 shall apply to this part, too. 3.2.2 The services defined in part 1 are mapped to a Modbus function code known as the CANopen general reference command. The CANopen general reference command is an encapsulation of the services defined in /CiA 309- 1/ that is used to access (read from or write to) the entries of a CANopen object dictionary as well as controlling/monitoring the gateway device, and other CANopen devices. The networked system is intended to work within the limitations of existing Modbus networks. Therefore, the information needed to query or modify the object dictionaries in the CANopen de- vices is mapped into the format of a Modbus message. The command has the 253-byte limitation in both the request and the response message. Figure 1 illustrates how the CANopen general refer- ence MEI type is incorporated into the Modbus encapsulated interface function code. © CiA 2008 - All rights reserved 5
CiA 309-2 Interfacing CANopen with TCP/IP - Part 2: Modbus/TCP mapping Version 1.1 Fig. 1: Device view of both the client and server modules The Network interface can be any communication stack used to send Modbus PDUs, such as TCP/IP, serial line, or Modbus Plus. When TCP/IP is used, the Modbus service is available at TCP port 502 /MAP/. The MEI Transport Service is a general service used to encapsulate and transport interface meth- ods associated with a particular Modbus encapsulation interface type. 3.2.3 3.2.3.1 General This chapter defines the CANopen general reference request and response PDU. Like other Mod- bus request PDUs, this function has the 253-byte limit in both the request and the response mes- sage ADU /MAP/. Request and response definition Field name Function code MEI type Protocol option fields Address and data fields Byte size and order 1 byte 1 byte 1 to m byte n byte Example/range 43 (2Bh) 13 (0Dh) See 3.2.3.4 refer to description 3.2.3.2 Function code The function code is 43 (2Bh). 3.2.3.3 MEI type The MEI type for the CANopen general reference is 13 (0Dh). 3.2.3.4 Protocol option fields 3.2.3.4.1 General The following fields are defined: Field name Protocol control Reserved field [Optional] Counter byte [Optional] Network ID [Optional] Encoded data Byte size and order 1 to 2 byte 1 byte 1 byte 1 byte 1 byte Example/range See 3.2.3.4.2 See 3.2.3.4.3 See 3.2.3.4.4 See 3.2.3.4.5 See 3.2.3.4.6 6 © CiA 2008 - All rights reserved ModbusNetwork InterfaceMEI Transport (FC 43.13)CANopen General ReferenceClient interfaceClient ApplicationNetwork InterfaceCANopen General ReferenceServer interfaceCANopen General ReferenceServer Interface BackendModbusMEI Transport (FC 43.13)Network
CiA 309-2 Interfacing CANopen with TCP/IP - Part 2: Modbus/TCP mapping Version 1.1 3.2.3.4.2 Protocol control The protocol control field contains the flags needed to control the message protocol. The protocol control bytes is defined as follows: 0 7 MSB 8 MSB Protocol control byte 1 Protocol control byte 2 LSB 15 LSB The most significant bit (MSB) is bit 0 for protocol control byte 1, and bit 8 for protocol control byte 2. The least significant byte (LSB) is bit 7 for protocol control byte 1, and bit 15 for protocol control byte 2. The bits are numbered in transmission order following the data transmission order defined in Appendix B in /RFC/. Note: This bit numbering is used throughout this specification. Bit 0 Field name Extend flag 1 2 3 4 5 6 7 Extend protocol control Counter byte option Reserved Reserved Network ID option Encoded data option Access flag 8 to 15 Reserved Extend flag Description 0 = No multiple message transaction, or end of multiple message transaction; 1 = Part of a multiple message transaction 0 = 1 byte, 1 = 2 byte See description below 0 0 See description below See description below 0 = read, 1 = write 0 This bit is used when the object dictionary data set is larger than what fits in one Modbus command. The data set is then extended over multiple Modbus messages, each message being a fragment of the data set. Extend protocol control This bit indicates the length of the protocol control. Counter byte option This bit is set to 1 to indicate that the counter byte field is used in this message. If this bit is set to 0 the counter byte does not exist in this message. Network ID option This bit is set to 1 to indicate that the network ID field is used in this message. If this bit is set to 0 the network ID does not exist in this message. Encoded data option This bit is set to 1 to indicate that the encoded data field is used in this message. If this bit is set to 0 the encoded data does not exist in this message. Access flag This bit indicates the access method of the request command. © CiA 2008 - All rights reserved 7
CiA 309-2 Interfacing CANopen with TCP/IP - Part 2: Modbus/TCP mapping Version 1.1 3.2.3.4.3 Counter byte This byte is intended for a rolling counter to be used during extended read and write operations. This bit counter increases for each subsequent fragment that is downloaded. The first fragment sets the counter byte to 0. The counter byte is the same for the request and it’s response message. After reaching 255, the counter rolls over to 0. If the receiver detects a gap, it aborts the processing of the extended read/write with an exception response (see chapter 5.2 and Appendix A). 3.2.3.4.4 Reserved field This byte is reserved. 3.2.3.4.5 Network ID This byte is used to identify a particular CANopen network interface for a gateway managing sev- eral CANopen networks. If the receiver receives a request with a network ID not corrresponding to an existing network, it aborts the processing with an extended exception response (see chapter 5.2 and Appendix A). Networks are numbered from 1 to 255. The network ID option bit controls the existence of this field in the CANopen general reference command. 3.2.3.4.6 Encoded data This byte is used to encode the data types. The following shows encoding values for data types in the encoded fields when selected for Download SDO and Upload SDO commands as well for PDO access command. Note: The data is encoded as defined in /CiA301/. Data types Boolean Unsigned8 Unsigned16 Unsigned24 Unsigned32 Unsigned40 Unsigned48 Unsigned56 Unsigned64 Integer8 Integer16 Integer24 Integer32 Integer40 Integer48 Integer56 Integer64 Real32 Real64 Time of day Visible string Domain Values 30h 00h 01h 02h 03h 04h 05h 06h 07h 10h 11h 12h 13h 14h 15h 16h 17h 20h 21h 40h 50h 60h 8 © CiA 2008 - All rights reserved
分享到:
收藏