logo资料库

CANOpen_memento-2.03.pdf

第1页 / 共13页
第2页 / 共13页
第3页 / 共13页
第4页 / 共13页
第5页 / 共13页
第6页 / 共13页
第7页 / 共13页
第8页 / 共13页
资料共13页,剩余部分请下载后查看
LIVIC – Laboratoire de recherche sur les Intéractions Véhicule - Infrastructure - Conducteur INRETS – Institut National de Recherche sur les Transports et leur Sécurité LCPC – Laboratoire Central des Ponts et Chaussées Ministères Recherche & Transport CANOpen Memento Francis Dupin, November 2005 Version 1.2 I have put on this document some of the tips to test a node or to configure a CANOpen network. If you do not know how works CANOpen, this document will not help you at all. Feel free to redistribute this paper ... and to report the errors and missings to francis.dupin@inrets.fr LIVIC – 14, route de la Minière. 78000 Versailles Satory. France http://www.inrets.fr/ur/livic 1
The CAN message id rtr do d1 ...... d7 Id : the CAN identifiant of the message. Usually on 11 bits. rtr : 0 : normal message 1 : Remote Transmit Request message. Cannot contain data dn : data byte. A normal message can contain 0 to 8 bytes of data The CAN message in CANOpen cobId rtr do d1 ...... d7 The data are put in CAN frame in lsb first (ie little endian). Example : the number 0x01020304 should be embeded like this : cobId rtr 04 03 02 01 Fct code 4 bits 7 bits 0001 Fct Code (binary) : EMCY : 0011, 0100, 0101, 0110, 0111, 1000, 1001, 1010 PDO : 1011 SDOrx : 1100 SDOtx : 1110 NMT error control : 0000 NMT : SYNC : 0001 TIME STAMP : 0010 Note : In this document, - All the numbers are in hexadecimal notation. - If not specified, the CAN messages are « normals » (rtr = 0) LIVIC – 14, route de la Minière. 78000 Versailles Satory. France http://www.inrets.fr/ur/livic 2
NMT protocol To put a node in operational mode To put a node in stop mode 000 0 01 nodeId 000 0 02 nodeId To put a node in pre-operational mode 000 0 80 nodeId To put a node in reset-application mode 000 0 81 nodeId To put a node in reset-communication mode 000 0 82 nodeId Note : To command all the nodes, use nodeId = 00 Examples To put the node 0x6 in operational mode : 000 01 06 To put all the nodes in pre-operational mode : 000 80 00 LIVIC – 14, route de la Minière. 78000 Versailles Satory. France http://www.inrets.fr/ur/livic 3
Node guard protocol To ask for a node its state, the master sends : The node responds : 700 + nodeID 700 + nodeID 1 0 t state One byte t : toggle 0,1,0,1.... state : 4 = stopped 5 = operational 7F = pre-operational Examples To ask for the node 5 its state, the master sends a CAN request (rtr = 1) : 705 The node 5 which is in stopped mode responds : 705 05 The master sends a NMT to put the node in pre-operational mode : 000 80 05 The master sends a new CAN request : 705 The node 5 which is now in pre-operational mode responds : 705 FF because the toggle = 1 Heartbeat protocol The node transmit cyclically its state, without the need of a request frame : 700 + nodeID 0 0 state One byte state : 4 = stopped 5 = operational 7F = pre-operational Examples The node 5, in pre-operational mode sends cyclically : 705 7F Beware : There is no toggle bit. Bootup protocol When a node enters in pre-operational mode after being in initializing mode, it sends : 700 + nodeID 0 00 LIVIC – 14, route de la Minière. 78000 Versailles Satory. France http://www.inrets.fr/ur/livic 4
SDO protocol SDO are used to read or write to the object dictionary of a node. The node which request a read or a write is the client node. The node in which the data is read or written is the server node. Read = upload protocol Write = download protocol To read or write a data of 4 bytes or less, the simplest way is to use the SDO upload/download expedited protocol. All the SDO have the same CAN frame length : 8 bytes of data and rtr = 0. SDO Download expedited protocol To write the data 0xd0d1... in the server node object dictionary, the client node sends : Data length = 1 byte Data length = 2 bytes Data length = 3 bytes Data length = 4 bytes The client request : 600 + Serv NodeId 0 2F The client request : 600 + Serv NodeId 0 2B The client request : The client request : 600 + Serv NodeId 0 27 The client request : 600 + Serv NodeId 0 23 Index Sub index d0 x x x X : undefined. Put 0 Index Sub index d1 d0 x x X : undefined. Put 0 Index Sub index d2 d1 d0 x X : undefined. Put 0 Index Sub index d3 d2 d1 d0 The server responds (if success) : 580 + Serv NodeId 0 60 Index Sub index 00 00 00 00 The server responds (if failure) : 580 + Serv NodeId 0 80 Index Sub index SDO abort code error Examples To write the 1 byte data : 0xFD in the object dictionary of node 5, at index 0x1400, subindex 2, sends : 605 2F 00 14 02 FD 00 00 00 If success, the node 5 responds : 585 60 00 14 02 00 00 00 00 To write the 4 bytes data : 0x60120208 in the object dictionary of node 5, at index 0x1603, subindex 1, sends : 605 23 03 16 01 08 02 12 60 If success, the node 5 responds : 585 60 03 16 01 00 00 00 00 LIVIC – 14, route de la Minière. 78000 Versailles Satory. France http://www.inrets.fr/ur/livic 5
SDO Upload expedited protocol To read the data 0xd0d1... in the server node object dictionary, the client node sends : The client request : 600 + Serv NodeId 0 40 Index Sub index 00 00 00 00 The server responds (if success) : Data length = 1 byte 580 + Serv NodeId 0 4F Index Sub index d1 x x x The server responds (if success) : X : undefined. Should be 0 Data length = 2 bytes 580 + Serv NodeId 0 4B Index Sub index d1 d0 x x The server responds (if success) : X : undefined. Should be 0 Data length = 3 bytes 580 + Serv NodeId 0 47 Index Sub index d2 d1 d0 x The server responds (if success) : X : undefined. Sould be 0 Data length = 4 bytes 580 + Serv NodeId 0 43 Index Sub index d3 d2 d1 d0 The server responds (if failure) : 580 + Serv NodeId 0 80 Index Sub index SDO abort code error Examples To read the 1 byte data : 0xFD in the object dictionary of node 5, at index 0x1400, subindex 2, sends : 605 40 00 14 02 00 00 00 00 If success, the node 5 responds : 585 4F 00 14 02 FD 00 00 00 To read the 4 bytes data : 0x60120208 in the object dictionary of node 5, at index 0x1603, subindex 1, sends : 605 40 03 16 01 00 00 00 00 If success, the node 5 responds : 585 43 03 16 01 08 02 12 60 LIVIC – 14, route de la Minière. 78000 Versailles Satory. France http://www.inrets.fr/ur/livic 6
SDO abort protocol Abort code (hexa) 0503 0000 0504 0000 0504 0001 0504 0002 0504 0003 0504 0004 0504 0005 0601 0000 0601 0001 0601 0002 0602 0000 0604 0041 0604 0042 0604 0043 0604 0047 0606 0000 0607 0010 0607 0012 0607 0013 0609 0011 0609 0030 0609 0031 0609 0032 0609 0036 0800 0000 0800 0020 0800 0021 0800 0022 0800 0023 Toggle bit not alternated SDO protocol timed out Client/server command specifier not valid or unknown Invalid block size (block mode only) Invalid sequence number (block mode only) CRC error (block mode only) Out of memory Unsupported access to an object Attempt to read a write only object Attempt to write a read only object Object does not exist in the object dictionary Object cannot be mapped to the PDO The number and length of the objects to be mapped whould exeed PDO length General parameter incompatibility reason General internal incompatibility in the device Access failed due to a hardware error Data type does not match, length of service parameter does not match Data type does not match, length of service parameter too hight Data type does not match, length of service parameter too low Sub-index does not exist. Value range of parameter exceeded (only for write access) Value of parameter written too hight Value of parameter written too low Maximum value is less than minimum value General error Data cannot be transferred or stored to the application Data cannot be transferred or stored to the application because of local control Data cannot be transferred or stored to the application because ofthe present device state Object dictionary dynamic generation fails or no object dictionary is present. LIVIC – 14, route de la Minière. 78000 Versailles Satory. France http://www.inrets.fr/ur/livic 7
How to configure a PDO Transmit ? Example : - Configuring the PDO 0x1800 + n - Its cobId must be 0x387 (why not ?) - The PDO is transmitted on synchro - It must contains the data : data X (2 bytes) and data Y (4 bytes) in this order - dataX is defined at index 0x6000 subindex 03 - dataY is defined at index 0x2010 subindex 21 1 – Index 1800 + n, subindex 01 : write the cobId (4 bytes) 2 – subindex 02 : write the transmission type « t » (1 byte) t = 1 to 0xF0 : The PDO is transmitted every reception of « t » SYNC t = FD : Transmission after reception of a request PDO (rtr = 1) t = FF : Transmission on event. The nodes sends the PDO spontaneously 3 – Index 1A00 + n : define the mapping of the nth data. Subindex 0 : write the number of data embeded in the PDO (1 byte). For this example, write « 2 » Subindex 1 : define where to find the first data embeded and the size. (8 bytes) The format is : index (2 bytes) – subindex (1 byte) – size in bits (1 byte) For this example, write « 60000308 » Subindex 2 : define where to find the second data embeded an the size (8 bytes) For this example, write « 20102120 To configure the PDO 1802 of the node 5 to be transmitted every 3 synchro, the SDO(s) to send should be (I have not tested) : 605 23 02 18 01 00 00 07 38 605 2F 02 18 02 03 00 00 00 605 2F 02 1A 00 02 00 00 00 605 23 02 1A 01 08 03 00 60 605 23 02 1A 02 20 21 10 10 The PDO : 387 0 dataX dataY Note : a PDO may contains less than 8 bytes of data. What is a PDO Transmited « on request » ? It is a PDO which must be transmited when the node is receiving a remote transmit request (rtr) with the same COBID than the PDO. Example : PDO request : 384 1 If the PDO with the COBID 384 is « on request », it must be transmited. LIVIC – 14, route de la Minière. 78000 Versailles Satory. France http://www.inrets.fr/ur/livic 8
分享到:
收藏