Intro to CANopen Networks E. Zivi Nov 6, 2014 References: 1. 2. 3. 4. 5. 6. 7. 8. A CAN Physical Layer Discussion Microchip Application Note AN00228a Controller Area Network (CAN) Implementation Guide Analog Devices Application Note AN-1123 Controller Area Network, CANPRES Version 2.0 , Siemens Microelectronics, Inc., October 98 http://www.kvaser.com/en/about-can/the-can-protocol.html CAN physical layer ref: http://www.can-cia.org/index.php?id=systemdesign-can-physicallayer Controller Area Network Physical Layer Requirements, TI SLLA270–January 2008 CAN Tutorial, http://www.computer-solutions.co.uk/download/Peak/CAN-Tutorial.pdf CANopen Introduction, ref: http://www.canopensolutions.com/english/about_canopen/about_canopen.shtml 1. Embedded Networking with CAN and CANopen, by Pfeiffer, Ayre and Keydel 2. CANopen Implementation: Applications to Industrial Networks, by Farsi and Barbosa 3. CAN in Automation, http://www.can-cia.org/ Recall CAN & ISO/OSI Reference Model 2 CAN in Automation (CiA) CANopen & ISO / OSI Reference Models CiA 401 Generic I/O Profile CiA 402 Motion Control Profile IEC 61131-3 Programmable Devices Profile CiA 4xx Device Profiles CiA 302 CANopen Framework for CANopen Managers & Programmable Devices Application CiA 301 CANopen Application Layer & Communication Profile Not Implemented by CAN or CANopen ISO 11898 CAN Data Link Layer ISO 11898 CAN Physical Layer High level CAN Protocols implement Application layer and skip the four intervening layers 3 CAN &CANopen Protocol Layers Application Layer Device profile for generic I /O modules (CiA 401, V3.0) Device profile drives and motion control (CiA 402, V2.0) Interface and device profile for IEC 61131... 3 programmable devices (CiA 405, V2.0) ... CANopen application layer and communication profile (CiA 301, V4.1, EN 50325-4) CANopen framework for CANopen managers and programmable CANopen devices (CiA 302, V3.4) CAN data link layer (ISO 11898:2003) CAN physical layer (ISO 11898:2003) CAN Bus We’ll investigate CANopen high level protocols after we have a basic understanding of CAN 4 CAN Higher Level Protocol Examples 1. CANopen : In the late 1990’s CANopen device profile specifications where established. CANopen includes a. A node addressing scheme b. Communication protocols supporting network management, device monitoring and communication between nodes c. Application layer device profiles 2. SAE J1939 : In 1998, the Society of Automotive Engineers (SAE) published the J1939 application layer protocols on top of CAN for vehicle applications. J1939 based standards include: truck and trailer communication (ISO 11992), agriculture and forestry vehicles (ISO 11783) and marine navigation systems (NMEA 2000). 3. ARINC 825 : Newer commercial aircraft such as the Airbus A380 and the Boeing 787 4. DeviceNet : Allen-Bradley (now Rockwell Automation) created DeviceNet as an application layer protocol on top of CAN in the 1990’s. DeviceNet CONFORMANCE TESTED® products have been certified by the Open DeviceNet Vendors Association (ODVA) to conform to the specification. 5 CANopen Attributes 1. Unique node IDs 1. 7 bits of 11-bit CAN Message ID is node address 2. 4 bits of 11-bit CAN Message ID is CANopen message type 2. Network Management (NMT) including NMT state machine, Boot-up, Heartbeat 3. Service Data Objects (SDOs) for network management 4. Process Data Objects (PDOs) for real-time process data 5. Each node contains an Object Dictionary with pre-defined entries for: 1. Node configuration 2. Process data 3. Mapping of process data to PDO messages 6. Electronic Data Sheets to automation network systems integration CANopen Network Management State Machine PDO SDO Sync Timestamp Emcy NMT Error control Stopped Operational Preoperational Available Services Network States MicroMod CANopen I/O MicroMod CANopen Preprogrammed I/O Implements subset of DS401 CANopen Generic I/O Specifications. Electronic Data Sheet Configures system. MicroMod CANopen Generic I/O Message Implementation Comm Obj Message # of Data Elements TPDO 1 Message Data Type I/O Definitions 1 unsigned byte Digital In 0..7 RPDO 1 1 unsigned byte Digital Out 0..6 TPDO 2 4 10 bits in unsigned ints Analog In 0..3 RPDO 2 4 8 bit duty cycle in unsigned ints PWM Out 0..3 TPDO 3 4 10 bits in unsigned int Analog In 4..7 MicroMod CANopen DS-401 Generic Digital I/O TPDO 1 & RPDO 1 Message Mapping Transmit Process Data Object TPDO1 on change of any of 8 digital inputs Digital Input (8 bits) TPDO1 (1 byte) CID: 0011 nnnnnnn2 Data: bbbbbbbb2 Update 7 bits of digital output upon Reception of Receive Process Data Object RPDO 1 Digital Output (7bits) RPDO1 (1 byte) CID: 0100 nnnnnnn2 Data: xbbbbbbb2 MicroMod CANopen DS-401 Generic Analog Input TPDO 2 Message Mapping Transmit Process Data Object TPDO 2 on change of any of Analog Inputs 0 thru 3 Resolution = 5V range / (210 – 1) Data transmitted in little endian (Least Significant Byte First) form Analog Input 3 Analog Input 3 TPDO3 Provides a second bank of 4 Analog inputs Analog Input 3 Analog Input 3 TPDO2 (2 bytes) (2 bytes) (2 bytes) (2 bytes) 10-bit Analog input is backed into 16 bit data words CID: 0101 nnnnnnn2 Data: BBBBBBBB16 MicroMod CANopen DS-401 Generic Analog (PWM) Output RPDO 2 Message Mapping Receive Process Data Object RPDO 2 changes Duty Cycle of PWM outputs 0 thru 3 Resolution = 1 / (28 – 1) Data transmitted in little endian (Least Significant Byte First) form PWM Output3 PWM Output3 PWM Output3 PWM Output3 RPDO2 (2 bytes) (2 bytes) (2 bytes) (2 bytes) 8-bit PWM duty cycle is packed into every other byte CID: 0101 nnnnnnn2 Data: BBBBBBBB16 Constructing DS-401 Generic IO Message IDs 4-bit Msg ID + 7-bit Node ID CANopen DS-401 Generic I/O 11-bit Message ID Format Comm Objects 4-bit Msg ID 7-bit Node ID DS-401 Generic I/O Msg bits b10 … b7 b10 b9 b8 b7 b6 b5 b4 b3 b2 b1 b0 Definitions NMT Service 0x000 0 0 0 0 0 0 0 0 0 0 0 SYNC Msg 0x080 0 0 0 1 0 0 0 0 0 0 0 Emergency 0x080 0 0 0 1 n6 n5 n4 n3 n2 n1 n0 Time Stamp 0x100 0 0 1 0 0 0 0 0 0 0 0 TPDO 1 0x180 0 0 1 1 n6 n5 n4 n3 n2 n1 n0 Digital In 0..7 RPDO 1 0x200 0 1 0 0 n6 n5 n4 n3 n2 n1 n0 Digital Out 0..6 TPDO 2 0x280 0 1 0 1 n6 n5 n4 n3 n2 n1 n0 Analog In 1..4 RPDO 2 0x300 0 1 1 0 n6 n5 n4 n3 n2 n1 n0 Analog Out 1..4 TPDO 3 0x380 0 1 1 1 n6 n5 n4 n3 n2 n1 n0 Analog In 5..8 RPDO 3 0x400 1 0 0 0 n6 n5 n4 n3 n2 n1 n0 Analog Out 5..8 TPDO 4 0x480 1 0 0 1 n6 n5 n4 n3 n2 n1 n0 Analog In 8..11 RPDO 4 0x500 1 0 1 0 n6 n5 n4 n3 n2 n1 n0 Analog Out 8..11 TSDO 0x580 1 0 1 1 n6 n5 n4 n3 n2 n1 n0 RSDO 0x600 1 1 0 0 n6 n5 n4 n3 n2 n1 n0 Heartbeat 0x700 1 1 1 0 n6 n5 n4 n3 n2 n1 n0 CANopen Motor Lab Configuration CANopen Magic Node Graphical User Interface Bench Power Supply CAN Messages Shaft Rotation Power CANopen MicroMod Node PWM L298 Driver Board Motor Modulated Power Encoder Position Pulse Analog Voltage Proportional to Motor Speed Train Frequency to Voltage Converter Maxon Motor Tachometer Calibration Angular Velocity (rad. / sec. ) = 37.41 (rad. / sec. / V) × Tachometer Output (V) Tachometer Output is connected to MicroMod input Ain4 Maxon Motor Transfer Function Using CAN Lab #3 Procedure CAN Lab #3 CANopen Magic Window Configuration MicroMod Heartbeat, Operational & PWM Duty Cycle (with Function key) messages added New Process Data visual display Filtered Trace windows added