M6 - Modicon M340 : CANopen field bus
CANopen generalities
CANopen Hardware implementationB
A
M6 - Modicon M340 : CANopen field bus
Stategy and communication 2
Software Configuration
E
C
C
Programming
Debug and Diagnostic
A – CANOpen generalities
Stategy and communication 3
C Ope ge e a t es
CANopen architecture overview
� Canopen field bus is used to exchange datawith equipement connected to the bus.
– Implicit exchanges ( through %QW, %IW )– Explicit exchanges ( through write/read var )
Stategy and communication 4
� CANopen field bus is available on someprocessors equipped with an integratedCANopen port.
– BMX P34 2010 / 2030 processors– SubD 9 points connector as physical interface
CA
Nop
en
Characteristic of integrated channel
Baud rate
Equipments
Bus length
Services
Character mode
20, 50, 125, 250, 500, 1000 kbds ( according with the lenght )
63 Equipments max
0 to 2500 meters
NMT, PDO, SDO, SYNC, EMCY
Stategy and communication 5
Speed / Lenght
( the speed isdirectly linkedwith the bus’slength )
1 Mbits 20 m500 Kbits 100 m250 Kbits 250 m125 Kbits 500 m50 Kbits 1000 m20 Kbits 2500 m
OSI model dedicated for the CAN bus
CANopen defines the applicationlayer
Not used
7 : Application Layer
6 : Presentation Layer
5 : Session Layer
4 : Transport Layer
Stategy and communication 6
The Controller Area Network (CAN) protocoldefines the data link layer and part of thePhysical layer in the OSI model.
3 : Network Layer
2 : Data link Layer
1 : Physical Layer
OSI model
Communication protocol principle
@127
�CAN is based on the
“broadcast communication mechanism”
@ 5
@ 2
Stategy and communication 7
@ 2 @ 3 @ 4 @ 5@ 6 @ 7
Communication protocol principle
@127
Priority : The identifier withthe lowest COBid number hasthe highest priority.
@ 5 @ 3@ 5 @ 3�The priority, is given according with theCOBid ( @ + index ),
�Highest priority lowest COBid
Stategy and communication 8
@ 2 @ 3 @ 4 @ 5@ 6 @ 7
Communication protocol principle
@1@ 5 @ 3@ 5 @ 3
�The priority, is given according with theCOBid ( @ + index ),
�Highest priority lowest COBid
Priority : The identifier withthe lowest COBid number hasthe highest priority.
Stategy and communication 9
@ 2 @ 3 @ 4 @ 5@ 6 @ 7
PDO ( Process Data Objects )
�PDOs are implicits exchanges between a Producer and one or moreConsumer ( For this exchange M340 uses the %QW and %IW objets )
�PDOs ( Process Data Objects) are mapped to a single CAN frame using data 8bytes max.
Stategy and communication 10
PDO Producer PDO Consumer
Max 8 bytes / PDO
PDO Consumer
PDO Consumer
PDO ( Process Data Objects )
�PDOs exchange may be driven by an internal event, by an internal timer, byremote request or by the Sync message .
event
timer
event and sync message
Each x sync message
Stategy and communication 11
Each x sync message
PDO Producer PDO Consumer PDO Consumer
PDO Consumer
SDO ( Service Data Object )
� SDOs are explicit exchanges and use the READ_VAR and WRITE_VARcommands
� SDO (Service Data Object ) reads or writes the Objects predifined in theDictionary ( EDS file ).
� The SDO transport protocol allows transmitting objects of any size.
Client
Stategy and communication 12
Client
Server
request
answer
or
NMT ( Network ManagemenT )
� The NMT (Network management) include three services:
1. NMT message
2. Boot up message
3. The Error Control service1. The NMT message :
Transmitted by the NMT masterNMT - Master
Stategy and communication 13
forces one node or all the nodesto transit to another NMT state.
NMT - Master
NMT - Slave NMT - SlaveNMT - Slave NMT - Slave
� The NMT (Network management) include three services :
1. NMT message
2. Boot up message
3. The Error Control service1. The NMT message :
The CANopen state machine ( NMTInitialization
NMT ( Network ManagemenT )
Stategy and communication 14
The CANopen state machine ( NMTstate ) specifies the states :
- Initialization
- Pre-Operational SDO allowed
- Operational SDO and PDO allowed
- Stopped. SDO and PDO are not allowed
Pre-Operational
Operational
Stopped
Boot-up
Initialization
� The NMT (Network management) include three services :
1. NMT message
2. Boot up message
3. The Error Control service2. The BOOT UP message
A device sends the Boot-up
NMT ( Network ManagemenT )
Stategy and communication 15
Pre-Operational
Operational
Stopped
Boot-up
message to indicate to the NMTmaster that it has reached thestate Pre-operational.
� The NMT (Network management) include three services :
1. NMT message
2. Boot up message
3. The Error Control service3. The Error Control service
Through this service the NMT
3. The Error Control service
Through this service the NMT
NMT ( Network ManagemenT )
Stategy and communication 16
detect the error on the field busThe Error control service canmanage :
The Heartbeat protocol
Periodically the slave sendits state to the master
Periodically the slave send its state tothe master after the :
Heartbeat Producer Time
detect the error on the field busThe Error control service canmanage :
The Node guarding protocol
Periodically the master send a requestto the slave in order to know its state
EDS file ( Electronical Data Sheets )
� Goal : The EDS file describes the capabilities of CANopen nodes:- General information about the node.- Informations of all dictionary object of the node.- Configuration of the PDO communication.
The EDS file is an ASCII file, and can be acquired from the manufacturer of thedevice.
�Ex : Part of the MFBLXM15.eds
Mapping of
Stategy and communication 17
Mapping ofthe
TransmitPDO1
B – Hardware implementation
Stategy and communication 18
a d a e p e e tat o
Processors with an integrated CANopen
� Modules BMX P34 2010 / 2030
1
2
1
2
Value DesignationDisplayUSB t
1
2
Stategy and communication 19
3
5
4
5
USB portEth portSerial portCANopenport
2
3
4
5
Wiring on the processor
� The connection is done on a SUBD 9 pts pin maleconnector of the processor
PIN SIGNAL12 CAN-L3 CAN-GND
Stategy and communication 20
Subd9
456 GND7 CAN-H89
Wiring ( a global offer )
4
5
9
5
1
2
25 7
12
13
Stategy and communication 21
106
14
65 7
(1) TSX CAN TD M4 (2) TSX CAN KCDF xxxT(4) TSX CAN KCDF 90TP (5) TSX CAN Cx xx(6) TSX CAN CxDx (7) FTX CN 31 xx(9) VW3 CAN TAP2 (10) VW3 CANN CARRxx(12) FTX CN 32 xx (13) FTX CNTL 12(14) AMO 2CA 001V000
Example :
Wiring ( a global offer )
A specif catalog
Stategy and communication 22
MKTED 205101EN or FR
A specif cataloglist all theCANopenaccessories torealize a quickwiring
Visual diagnostic of CANopen
State
The information provided by the the CAN RUN lamp
Fa FaFast
Comment
Operationnal state
Initialization in progress
Stategy and communication 23
0Flashing 0
1Flashing 1
SlSlow
0
1
Sl
Pre Operationnal state
Stopped state
Check & init the slave
-
Visual diagnostic of CANopen
State
The information provide by the The CAN ERR lamp
Fast
Fl hi 0
Comment
Bus stopped
Speed automatic detection
Error counter overflow0
Fa
0
Fa
Stategy and communication 24
Flashing 0
Flashing 1
Slow
Heartbeat fault
No Sync message
Canopen can’t startFlashing 2
0
1
Sl
2
No ERROR
1
Sl
2
C – Software configuration
Stategy and communication 25
C So t a e co gu at o
Software Configuration
� The configuration for CANopen is fully integreted in UNITY (no externalconfigurator need )
� Here is the main steps to respect in order to configure the CANopenbus.
Configuration du Bus CANopen :
Stategy and communication 26
g p
step 1 : Master Configuration ( Speed, @, PDO Offset )step 2 : Slave Configuration ( PDO and exchanges )
• Standard• Expert
step 1 : Master Configuration Processor configuration
Creating an IODDTstructure forCANopen
Define IODDT1
yes
noDon’t use the IODDT
Using the symbol forprogramming
Modify the datasreserved for PDO
Define theOFFSET
2
yes
noI will modify later
I know the Nb words andbits
Stategy and communication 27
OFFSET no
Select the Busspeed
Define the speed3
yes
noI will modify later
I adjust the speedaccording with the device
Select the CPUTASK
Define the task4
yes
noThe MAST is Ok ( given bydefault )
I want exchange the PDOvalues in the FAST
END
step 1 : Master Configuration Processor configuration
Creating an IODDTstructure forCANopen
Define IODDT1
yes
noDon’t use the IODDT
Using the symbol forprogramming
Modify the datasreserved for PDO
Define theOFFSET
2
yes
noI will modify later
I know the Nb words andbits
Stategy and communication 28
OFFSET no
Select the Busspeed
Define the speed3
yes
noI will modify later
I adjust the speedaccording with the device
Select the CPUTASK
Define the task4
yes
noThe MAST is Ok ( given bydefault )
I want exchange the PDOvalues in the FAST
END
We must select the device1
step 2 : Slave Configuration
According with mydevice select the
profil
PDO folder
Logical node CANopen
Select thefunction
2
yes
noProfil knowneg:FTB, OTB, LEXIUM
Complex Profileg:STB, ATV
Stategy and communication 29
config folder
My deviceneed a initialconfiguration
I want to mapthe PDO
noPDO mapping withthe configurator
yes
Using the predefined PDOeg:MFB3
Free mapping
ENDno
Select the initialvalues needed
yes
4Already configure with aspecific tool.eg: Power suite, Advantis
Configure the initial valuewith the configurator
We must select the device1
step 2 : Slave Configuration
According with mydevice select the
profil
PDO folder
Logical node CANopen
Define a profil2
yes
noProfil knowneg:FTB, OTB, LEXIUM
Complex Profileg:STB, ATV
Stategy and communication 30
config folder
My deviceneed a initialconfiguration
I want to mapthe PDO
noPDO mapping withthe configurator
yes
Using the predefined PDOeg:MFB3
Free mapping
ENDno
Select the initialvalues needed
yes
4Already configure with aspecific tool.eg: Power suite, Advantis
Configure the initial valuewith the configurator
step 2 : Expert Configuration
According with the lenght ofthe bus or the version used for
the slave I want adjust theWATCHDOG
Error control folder
Logical node CANopen
noModify the value
yes
No fault on the bus(Heartbeat / node guarding)
5
Heartbeat or node guarding fault
Stategy and communication 31
I want adjustthe PDO
transmission
END
PDO folder
noSelect thetransmission needed
yes
The configuration by default isok.( send when change )6
According with the specificneed of the customer I mustexchange the PDO on SYNC,or x SYNC message …..
step 2 : Expert Configuration
According with the lenght ofthe bus or the version used for
the slave I want adjust theWATCHDOG
Error control folder
Logical node CANopen
noModify the value
yes
No fault on the bus(Heartbeat / node guarding)
5
Heartbeat or node guarding fault
Stategy and communication 32
I want adjustthe PDO
transmission
END
PDO folder
noSelect thetransmission needed
yes
The configuration by default isok.( send when change )6
According with the specificneed of the customer I mustexchange the PDO on SYNC,or x SYNC message …..
Step 1: Master configuration
Stategy and communication 33
Step 1 : Master configurationIn the CAN screen we have :1. A overview of the bus specifications2. The I/O configuration3. The master configuration
Stategy and communication 34
According with the processorit’s possible to configure the
bus.Here : CANopen
Step 1 : Master configuration ‘IODDT’In the CAN screen we have :1. A overview of the bus specifications2. The I/O configuration3. The master configuration
1
Stategy and communication 35
According with the processorit’s possible to configure the
bus.Here : CANopen
Step 1 : Master configurationIn the CAN screen we have :1. A overview of the bus specifications2. The I/O configuration3. The Master configuration
2
Stategy and communication 36
According with the processorit’s possible to configure the
bus.Here : CANopen
3
4
Step 1 : Master configuration
� Map the The PDO’s to memoryword (%mw) and bit (%m)location (mainly dedicated for theMODBUS communication ).
2
Stategy and communication 37
� Bus Parameters :
1. Set speed according tothe length of the bus.
2. Period of the SyncMessage
3
� Task assigned to the PDOs3
Step 2: Slave configuration
Stategy and communication 38
Step 2 : Slave Configuration
When the master’sconfiguration is done we
Newdevice:
yes
My device:
Stategy and communication 39
configuration is done wemust to define the Slave on
the Field bus
My device:FTB_1CN08E08CM
0 @2 1
Step 2 : Slave Configuration
Stategy and communication 40
� At the end Slaveis present on thefield bus @2
Step 2 : Slave Configuration
In L11 Unity includesfollowing Schneiderdevices.
Stategy and communication 41
The possibility to add athird party product will beadded in L12.
� In the configuration screen according with the deviceused we can select a specific function.
Step 2 : Slave Configuration
This function is used mainly for :
the complex devices such as ( ATV 71 )
or
Stategy and communication 42
a device with variable configuration suchas ( Advantys STB )
in this case it will be possible to reserve more orless data for the PDO exchange.
Step 2 : Slave Configuration
Stategy and communication 43
� PDO : In this screen it is possible to map the PDOcommunication.� This screen is divided in 3 parts :
Step 2 : Slave Configuration
Transmits PDOs(slave transmits aninformation to themaster)
Receives PDOs
Stategy and communication 44
Receives PDOs(Slave receives aninformation fromthe Master)
A list of thevariables thatcan be mappedin the PDOs
� PDO : In this screen it is possible to map the PDOcommunication.
� This screen is divided in 3 parts :
Step 2 : Slave Configuration
Transmits PDOs(slave transmits aninformation to themaster)
Receives PDOs
� According to theEDS file somesPDOs are alreadymapped
�The PDOs used
Stategy and communication 45
Receives PDOs(Slave receives aninformation fromthe Master)
One part with allthe variablesyou can map inthe PDOs
Topologicsaddresses %Ix or%Qx.andInternals variables%MW ( thesevariables are alwayspresent in theproduct for theMODBUScommunication )
With the CANopen configurator if I add a PDO or if I modify aPDO, the mapping for the %Q/I and %MW will never change, so
it’s not necessary to adjust your application.
Step 2: Slave configurationHow to do the PDO configuration
Stategy and communication 46
Stategy and communication 47
� Particularity : For the STB devices.
Step 2 : Slave Configuration
For the STB configurationit’s possible to associatea specif file created withADVANTYS ( version 2.3mini ) in order to design
Stategy and communication 48
exactly the configurationdone on STB, this file iscalled xxx.DCF.If we don’t used this fileit’s always possible tomanage thecommunication manually
Step 2 : Slave Configuration
Stategy and communication 49
� The goal here is to provide a methodof configuring the node without anexternal configuration software ( hereADVANTIS )
� if the value is different to 0 the valuewill be send during the initialisationphase
Step 2: Slave configuration ‘EXPERT’
Stategy and communication 50
right
Step 2 : Slave Configuration ‘EXPERT’
Stategy and communication 51
Through this service the NMT detectthe error on the field bus, we canselect Heartbeat or node guardingprotocol, and adjust the Timeout
5
� In this screen it is possible to map the PDOcommunication.
� This screen is divided in 3 parts :
Bi left
Step 2 : Slave Configuration ‘EXPERT’
Stategy and communication 52
Select Type, Inhibit or event on thePDO line in order to define thePDO communication :
SynchronousAsynchronous
Bi left
6
�The PDO are exchanges according with theconfiguration done .(example transmission type )
Synchronous acyclic PDO :A transmission type of 0 means that themessage shall be transmitted synchronouslywith the SYNC message but not periodically
Step 2 : Slave Configuration ‘EXPERT’
6
Stategy and communication 53
according to the value. Mainly used for drives.
Synchronous cyclic PDO :A value between 1 and 240 means that thePDO is transmitted synchronously andcyclically, the transmission type valueindicating the number of SYNC messagesbetween two PDO transmissions.
�The PDO are exchanges according with theconfiguration done .(example transmission type )
Asynchronous PDO:The transmission type 254 means that thePDO is transmitted asynchronous. It is fullydepending on the implementation in thedevice Mainly used for digital I/O
Step 2 : Slave Configuration ‘EXPERT’
6
Stategy and communication 54
device. Mainly used for digital I/O.
Asynchronous PDO:The transmission type 255 means that thePDO is transmitted asynchronous when thevalue change.
�The PDO are exchanges according to theconfiguration. (example transmission type )
Inhibit time :masks the communication during this time.Nota: With the MFB we can only adjust thisvalue according with the traffic and the length
Step 2 : Slave Configuration ‘EXPERT’
6
Stategy and communication 55
value according with the traffic and the lengthof the bus
Event timer :Time to manage an event in order to start aPDO
Reminder : How to realize a completeconfiguration
� In this example we will configure one device :
LEXIUM 05
@2
Speed 500KbWith
Stategy and communication 56
PDO4 In receive:
JOG-Activate
PDO4 in transmit
IO-act
Stategy and communication 57
D – Programming
Stategy and communication 58
og a g
PDOs allow the implicit data management between the Master, in our case theM340 CPU and the slave by read/write words.
Management Implicit exchanges PDO
Stategy and communication 59
PDO receive
CANopen
PDO Transmit
Addressing
� On Modicon M340, PDO variable addresses can be defined as word,double word and floating point types.
% I, IW, ID, IF, Q, x y 0 0 ch i j
QW , QD, QF, M,
MW, MD, MF
Stategy and communication 60
Sym Object type 3 Node@ 0 0 channel rank bit
Ebool, Bool, Int,Dint,Real
3 is a specific address for thePDO ( For the SDO we will use
the Channel number : 2 )
Addressing
� Example.
% I, IW, ID, IF, Q, 3 y 0 0 ch i j
QW , QD, QF, M,
MW, MD, MF
Stategy and communication 61
1. Read an input on an ADVANTYS @ 4, channel 2, Word 3, bit2
%IW \ 3. 4 \ 0 . 0 . 2 . 3 . 2
2. Write control word on an LEXIUM @ 9, channel 4, Word 3
%QW \ 3. 9 \ 0 . 0 . 4 . 3
PLC Management of the request READ_VAR request
SDOs allow the management of the explicit data between the Master, in our casethe M340 and the slave using of request READ_var / WRITE_var
Management explicit exchanges SDO
Stategy and communication 62
WRITE_VAR request CANopen
INDEX / Ss INDEX Concept .
� All requests on CANopen are defined with an INDEX / Ss INDEX.
� Here is an example on a CANopen device ‘ LEXIUM 15x ‘– INDEX : Define the function wished .
– Ex : 2022 => Position data for the ‘ position ’ mode .2020 => Position Controller
Management explicit exchanges SDO
Stategy and communication 63
– Ss INDEX: Define the object in the function .
Index
Ss Index
Management explicit exchanges SDO� Syntax to program a SDO ( Write var ) :
Parameters descriptions
ADDM(‘0.0.2.node’) Address of the exchange destination0.0 : processor slot in the rack (0 )2 : channel (always 2 for CANopen)2: Device adress.
‘SDO’ SDO object type (always SDO in capitals)
Subindex / index: Double word or immediate value
Stategy and communication 64
Subindex / index: Double word or immediate valueidentifying the CANopen SDO index orsubindex:
Offset Number of Word to write
%MWi:L Table of words containing the data to besent (minimum length = 1)
%MWk:4 Exchange management parameters
Management explicit exchanges SDO� Syntax to program a SDO ( Read var ) :
Parameters descriptionsADDM(‘0.0.2.node’) Address of the exchange destination
0.0 : processor slot in the rack (0 )2 : channel (always 2 for CANopen)2: Device adress.
‘SDO’ SDO object type (always SDO in capitals)
Subindex / index: Double word or immediate valueidentifying the CANopen SDO index or
Stategy and communication 65
identifying the CANopen SDO index orsubindex:
Offset Number of word to Read
%MWk:4 Exchange management parameters
%MWi:L Table of words containing the data to bereceived (minimum length = 1)
Management explicit exchanges SDO
Stategy and communication 66
Management explicit exchanges SDO
�Performances :�For all the processors we can manage :
16 messages in Input / Output by scan time of the MAST task.
� For CANopen message channel ( SDO ) we are limited to :
1 message in Input / Output by scan time of the MAST task.
16 Buffers read
Stategy and communication 67
If xxx
Then..………………….
IN
OUT
Scantime
x16
and write / CPUscan time
1 Buffer read andwrite / CPU scantime for CANopen
SDO
SDO
SDOEF ….
E – Debug & Diagnostic
Stategy and communication 68
ebug & ag ost c
Debug and Diagnostic Screen
�On the processor it’s possible to realize a quick diagnostic on the CANopen bus
Fault onCANopen
Stategy and communication 69
Who providesthe fault
What’s fault !
Debug and Diagnostic Screen
� We can also obtain a quickdiagnostic on the CANopenbus with the CANopen Tree.
Stategy and communication 70
Debug and Diagnostic Screen� On BUS editor It is possible to :
�Read and Write all the SDO through the INDEX / SUB INDEX of the device.
�Read the Emergency message ( Information provides by the device )
�Read the I/O object Available on the device.
�Read and Write all the PDO used.
Stategy and communication 71
LeftIf you selectthe NIM we
can ……
Debug and Diagnostic Screen� On BUS editor It is possible to :
�Read and Write all the SDO through the INDEX / SUB INDEX of the device.
�Read the Emergency message ( Information provides by the device )
�Read the I/O object Available on the device.
�Read and Write all the PDO used.
Stategy and communication 72
In this screen the Index and Sub index are provide bythe system ( according with the EDS file ) with a
comment associated
In this screen the Index and Sub index are provide bythe system ( according with the EDS file ) with a
comment associated
Debug and Diagnostic Screen� On BUS editor Tree It is possible to :
�Read and Write all the SDO through the INDEX / SUB INDEX of the device.
�Read the Emergency message ( Information provides by the device )
�Read the I/O object Available on the device.
�Read and Write all the PDO used.
Stategy and communication 73
Debug and Diagnostic Screen� On BUS editor It is possible to :
�Read and Write all the SDO through the INDEX / SUB INDEX of the device.
�Read the Emergency message ( Information provides by the device )
�Read the I/O object Available on the device.
�Read and Write all the PDO used.
Stategy and communication 74
Debug and Diagnostic Screen� On BUS editor Tree It is possible to :
�Read and Write all the SDO through the INDEX / SUB INDEX of the device.
�Read the Emergency message ( Information provides by the device )
�Read the I/O object Available on the device.
�Read and Write all the PDO used.
Stategy and communication 75
If you select the channelyou can …….
CANOpen
Stategy and communication 76
Top Related