You are on page 1of 5

11/21/2016

TheBasicsofCANopenNationalInstruments

TheBasicsofCANopen
PublishDate:Aug21,2013

TableofContents

1.CANopenIntroduction
2.TheBasicsoftheCANopenApplicationLayer
3.NICANopenInterfaces
1.CANopenIntroduction

CANopenisahighlevelcommunicationprotocolanddeviceprofilespecificationthatisbasedontheCAN(ControllerArea
Network)(http://www.ni.com/whitepaper/2732/en)protocol.Theprotocolwasdevelopedforembeddednetworking
applications,suchasinvehiclenetworks.TheCANopenumbrellacoversanetworkprogrammingframework,device
descriptions,interfacedefinitionsandapplicationprofiles.CANopenprovidesaprotocolwhichstandardizescommunication
betweendevicesandapplicationsfromdifferentmanufacturers.Ithasbeenusedinawiderangeofindustries,withhighlights
inautomationandmotionapplications.
IntermsoftheOSIcommunicationsystemsmodel,CANcoversthefirsttwolevels:thephysicallayerandthedatalinklayer.
Thephysicallayerdefinesthelinesused,voltages,highspeednature,etc.ThedatalinklayerincludesthefactthatCANisa
framebased(messages)protocol.CANopencoversthetopfivelayers:network(addressing,routing),transport(endtoend
reliability),session(synchronization),presentation(dataencodedinstandardway,datarepresentation)andapplication.The
applicationlayerdescribeshowtoconfigure,transferandsynchronizeCANopendevices.Theconceptsoftheapplication
layer,coveredinspecificationCiADS301(http://www.cancia.org/index.php?id=downloads),arecoveredinthisdocument.
TheintentionistogiveusersabriefoverviewoftheconceptsofCANopen.

CANandCANopenintheOSIModel
2.TheBasicsoftheCANopenApplicationLayer

ThefollowingsectionexplainsthebasicconceptsrelatedtotheCANopenprotocolapplicationlayer.Thisdocumentis
intendedasabasicoverviewonly,andusersareencouragedtoreviewtheCiADS301specification(http://www.can
cia.org/index.php?id=downloads)formoreinformation.
ObjectDictionary

OneofthecentralthemesofCANopenistheobjectdictionary(OD),whichisessentiallyatablethatstoresconfigurationand
processdata.ItisarequirementforallCANopendevicestoimplementanobjectdictionary.TheCANopenstandarddefinesa
16bitbitindexandan8bitsubindex.Thatis,itispermissibletohaveupto65536indicesandupto256subentriesateach
index.Thestandarddefinesthatcertainaddressesandaddressrangesmustcontainspecificparameters.Forexample,the
standarddefinesthatindex1008h,subindex00h,mustcontainthedevicename.Assuch,anyCANopenmastercanreadthis
indexfromanetworkofCANopenslavesinordertouniquelyidentifyeachslavebyname.Someobjectdictionaryindices,
suchasthedevicetype(1000h)aremandatory,andothers,suchasthemanufacturersoftwareversion(100Ah)areoptional.
Thecollectionofmandatoryindicesrepresentstheminimumobjectdictionary,whichisrequiredtobrandadeviceCANopen
compliant.
TheobjectdictionaryisthemethodbywhichaCANopendevicecanbecommunicatedwith.Forexample,onecouldwritea
truetotheindexinthemanufacturerspecificsectionoftheobjectdictionary(2000h5FFFh),whichthedevicecouldinterpret
asanenablesignalforacquiringdatafromavoltageinput.Conversely,themastermayalsowanttoreadinformationfromthe
objectdictionarytogettheacquireddata,ortofindouthowtodeviceiscurrentlyconfigured.Thetwocommunication
mechanismsforaccessingtheobjectdictionaryareServiceDataObjects(SDOs)andProcessDataObjects(PDOs),which
willbeexplainedlaterinthisdocument.
Thebasicdatatypesincludedintheobjectdictionaryare:Boolean,void(placeholder),unsignedinteger,signedinteger,
floatingpointandcharacter.Morecomplexdatatypes,suchasstrings,dateandtimecanbeconstructedfromthebasicdata
types.ThesedatatypescanbeusedtodefinecustomdatatypesspecifictoCANopen,suchasthePDO/SDOParameter
RecordandthePDOmappingparameter.TheuserisencouragedtoreviewtheCANopenspecificationformoredetailsonthe
componentsofcomplexandcustomdatatypes.
CANopenMessageFormat

ThemessageformatforaCANopenframeisbasedontheCANframeformat.IntheCANprotocol,thedataistransferredin
framesconsistingofan11bitor29bitCANID,controlbitssuchastheremotetransferbit(RTR),startbitand4bitdata
lengthfield,and0to8bytesofdata.TheCOBID,commonlyreferredtoinCANopen,consistsoftheCANIDandthecontrol
bits.InCANopen,the11bitCANIDissplitintotwoparts:a4bitfunctioncodeanda7bitCANopennodeID.The7bitsize
limitationrestrictstheamountofdevicesonaCANopennetworkto127nodes.

http://www.ni.com/whitepaper/14162/en/

1/5

11/21/2016

TheBasicsofCANopenNationalInstruments

limitationrestrictstheamountofdevicesonaCANopennetworkto127nodes.

CANopenFrameFormat(bitsshownexceptfordatafield)
AllCOBID'smustbeuniquetopreventconflictsonthebus.InSDOcommunication,thereshouldalwaysbeonlyonenode
thatneedstoaccesstheindividualobjectdictionaryindicesoftheslavenodes.
ServiceDataObjects(SDOs)

TheCANopenprotocolalsospecifiesthateachnodeonthenetworkmustimplementaserverthathandlesread/writerequests
toitsobjectdictionary.ThisallowsforaCANopenmastertoactasaclienttothatserver.Themechanismfordirectaccess
(read/write)totheserversobjectdictionaryistheServiceDataObject(SDO).Thenodewhoseobjectdictionaryisaccessed
isreferredtoastheSDOserver,andthenodegrabbingthedataisreferredtoastheSDOclient.Thetransferisalways
startedbytheSDOclient.
Typically,themasterCANopennodewillsendarequesttothenetwork,andthenodeofinterestwillrespondwiththedata
requested.CANopenusesreservedmessageIDstofacilitatethiscommunication.WhentheSDOclientwantstorequest
informationfromtheserver,itsendsanSDOrequestusingaCANIDof600h+NodeID.Theserverwillthenrespondusinga
CANIDof580h+NodeID.TheNodeIDspecifieswhichslavenodethemessageiscomingfrom.Fortheexampleillustrated
below,themasternode(theSDOclient)sendsamessageouttothenetworkwithaCANIDof603h.Althoughallnodessee
thismessage,allnodesbutthetargetednodeignoreitbecausethemessageisnotintendedforthem.Thetargetednode
understandsthatthemessagewithID603hmeansthatthemessageisintendedforthatnode,whichisanSDOrequest.The
datafieldofthemessagewillspecifytheindexandsubindexoftheobjectwhichthemasterwouldliketoaccessdata.The
targetednodethenrespondswithmessageID583h.Thedatafieldoftheresponsemessagewillcontainthedatarequested.

SDOExample
InadditiontohavingaspecificCANID,thedatasectionoftheCANopenframealsofollowsaspecificformatforSDO.The
datasectionoftheCANframeissplitintothreeparts:onebyteforthespecifier,threebytesforthenodeindexandsubindex,
andfourbytesfortheactualdatainthetransfer.Thespecifierbyteisbrokenoutinthediagramshownabove.Thethreebitsof
thespecifierbytearereferredtoastheclientcommandspecifier(ccs),whichindicateswhattypeofmessageisbeing
transferred(i.e.read,write,andabort).Thefourthbitisreserved.Thefifthandsixthbitsindicatethenumberofbytesinthe
datapartofthemessagethatdonotcontainactualdata.Theseventhbitindicateswhetherthetransferisanexpedited
transferorasegmentedtransfer.Thefinalbitindicateswhethertheamountofdataisspecifiedinbitfive/sixorwhetheritis
specifiedinthedatapartofthemessage.

http://www.ni.com/whitepaper/14162/en/

2/5

11/21/2016

TheBasicsofCANopenNationalInstruments

SDOFrameDataSectionDetail
Asegmentedtransferisselectedwhenallthedatathatneedstobetransferreddoesnotfitintoasinglemessage,and
thereforethedatamustbetransferredusingmultiplemessagesor"segments".Onthecontrary,anexpeditedtransferiswhere
alldataissentasasinglemessage.Intheinitializationphase(seeNMTsection),SDOscantransferuptofourbytesofdata.
Optionally,anSDOtransfercanalsooccurinaseriesofblocks.Eachblockconsistsofupto127segments.Ablocktransferis
fasterthanasegmentedtransferforlargedatasets.
ProcessDataObjects(PDOs)

Processdatarepresentsdatathatcanbechangingintime,suchastheinputs(i.e.sensors)andoutputs(i.e.motordrives)of
thenodecontroller.Processdataisalsostoredintheobjectdictionary.However,sinceSDOcommunicationonlyallows
accesstooneobjectdictionaryindexatatime,therecanbealotofoverheadforaccessingcontinuallychangingdata.In
addition,theCANopenprotocolhastherequirementthatanodemustbeabletosenditsowndata,withoutneedingtobe
polledbytheCANopenmaster.Thus,adifferentmethodisusedtotransferprocessdata,usingacommunicationmethod
calledProcessDataObjects(PDOs).
TherearetwotypesofPDOs:transferPDOs(TPDOs)andreceivePDOs(RPDOs).ATPDOisthedatacomingfromthenode
(produced)andaRPDOisthedatacomingtothenode(consumed).Inaddition,therearetwotypesofparametersforaPDO:
theconfigurationparametersandthemappingparameters.ThesectionoftheobjectdictionaryreservedforPDOconfiguration
andmappinginformationareindices1400h1BFFh.
TheconfigurationparametersspecifytheCOBID,thetransmissiontype,inhibittime(TPDOonly)andtheeventtimer,which
areexplainedinthissection.TherearedifferentmethodsthroughwhichaPDOtransfercanbeinitiated.Thesemethods
includeeventdriven,timedriven,individualpollingandsynchronizedpolling.Thetypeoftransmissionisspecifiedinthe
configurationparametersofthePDO.Ineventdriventransmission,thePDOtransferisinitiatedwhentheprocessdatainit
changes.Intimedriventransmission,thePDOtransferoccursatafixedtimeinterval.Inindividualpolling,thePDOtransferis
initiatedusingamechanismcalledremoterequest,whichisnotcommonlyused.Insynchronizedpolling,thePDOtransferis
initiatedusingaSYNCsignal.Thesyncsignalisfrequentlyusedasaglobaltimer.Forexample,iftheCANopenmastersends
outaSYNCmessage,multiplenodesmaybeconfiguredtoseeandrespondtothatSYNC.Inthisway,themasterisableto
geta"snapshot"ofmultipleprocessobjectsatthesametime.

http://www.ni.com/whitepaper/14162/en/

3/5

11/21/2016

TheBasicsofCANopenNationalInstruments

EventDrivenPDOsTransferExample
ThemappingparametersspecifywhichobjectdictionaryvaluesaresentbyasinglePDOmessage.Forexample,asingle
PDOmessagemaycontaindatafromobjectindex2001h,2003hand2005h.

TPDOObjectDictionaryExample
NetworkManagement(NMT)Overview

Networkmanagementservicesincludetheabilitytochangethestateofaslavebetweeninitializing,preoperational,
operationalandstopped.TheNMTprotocolallowsfortheCANopennetworktocontrolthecommunicationstateofindividual
nodes.ThepreoperationalstateismainlyusedtofortheconfigurationofCANopendevices.Assuch,PDOcommunicationis
notpermittedinthepreoperationalstate.PDOcommunicationbecomespossibleintheoperationalstate.Inthestopped
state,anodecanonlydonodeguardingorheartbeats,butcannotreceiveortransmitmessages.CertaintypesofCANopen
communicationareallowedindifferentstates.Forexample,SDOsareallowedinthepreoperationalstate,butPDOsarenot.
ThisisbecauseSDOsareoftenusedtoinitializeobjectdictionaryparameters,whereasPDOsareoftenusedtotransfer
continuallyupdatingdata.
GuardingandHeartbeats

TheCANopenspecificationrequiresthatnodesmustusesomemethodtocheckwhetheranodeis"alive"ornot.Thetwo
methodsavailableare:nodeguardingandheartbeats,withthelatterbeingthepreferredmethod.
Intheheartbeatprotocol,aCANopennodeperiodicallysendsoutaheartbeatmessagewhichletstheCANopenmasterorthe
heartbeatconsumer,knowthatthenodeisstillalive.Ifaheartbeatmessagedoesnotarrivewithinacertainperiodoftime,the
mastercantakeaspecificaction.Suchanactionmightbetoresetthenodeortoreportanerrortoanoperator.Theheartbeat
messageisidentifiedbyaCANIDof0x700+thenodeID,wherethefirstdatabyteisequalto1110.
Inthenodeguardingprotocol,theCANopenmasterpollstheslavenodesfortheircurrentstateinformation.Ifthenodedoes
notrespondinaspecificperiodoftime,themasterassumesthenodeisdeadandwilltakeanaction.
Theheartbeatprotocolisthepreferredmethodbecauseithaslessoverheadthannodeguarding.
EmergencyMessages

EachnodeinaCANopennetworkisassignedasingleemergency(EMCY)messagethatcommunicatesthenode'sstatus.
Notethattheheartbeatsandnodeguardingprotocolareintendedtobeusedtoconveycommunicationfailures,whereas
emergencymessagesareusedtoconveyerrorswithinthenode(i.e.sensorfailure).AnEMCYmessageisidentifiedbya
COBIDof80h+NodeID.ThedataportionofanEMCYmessagecontainsinformationabouttheerrorthatoccurred.
3.NICANopenInterfaces

NationalInstrumentsoffersCANopenmasterinterfacesforCompactRIO(http://www.ni.com/compactrio),PXI,andPCIform
factors.EachinterfaceissupportedbytheIndustrialCommunicationsforCANopen
(http://joule.ni.com/nidu/cds/view/p/id/3077/lang/en)driver,whichfeaturessupportforSDOs,PDOs,NMT,heartbeats,node
guardingandsynchronization.ThedriveralsofeaturesaBatchSDOeditor,whichallowsausertoeasilyconfigurethenodes
ontheCANopennetwork.TheBatchSDOEditorhassupportforEDSfileintegrationandLSSservicessupportforslavenode
configuration.
NI9881:1PortCANopenModuleforNICompactRIO

TheNI9881isa1port,highspeedCANopenCSeriesmoduleinterfacefordevelopingCANopenapplicationsinNILabVIEW
softwareonNICompactRIO(http://www.ni.com/compactrio)hardware.TheNI9881isexternallypoweredandcanattain
transferratesofupto1Mbit/s.TheCANopenportisaccessiblefromtheCompactRIORealTimecontroller.The9881module
requirestheNIcRIO911xchassisandtheLabVIEWFPGA(http://www.ni.com/fpga)Module.
http://www.ni.com/whitepaper/14162/en/

4/5

11/21/2016

TheBasicsofCANopenNationalInstruments

requirestheNIcRIO911xchassisandtheLabVIEWFPGA(http://www.ni.com/fpga)Module.

NI9881
SeeAlso
NI98811PortCANopenModuleforNICompactRIOProductPage(http://sine.ni.com/nips/cds/view/p/lang/en/nid/209998)
NIPCI/PXI8531:1PortCANopenInterfaceforPCI/PXI

TheNIPCI8531andNIPXI8531areboth1PortCANopenInterfacesforthePCIandPXIplatforms,respectively.They
featuretransferratesofupto1Mbit/s,andleveragetheIndustrialCommunicationforCANopenDriver.

NIPXI8531
SeeAlso
NIPCI85311PortCANopenInterfaceforPCIProductPage(http://sine.ni.com/nips/cds/view/p/lang/en/nid/209996)
NIPXI85311PortCANopenInterfaceforPXIProductPage(http://sine.ni.com/nips/cds/view/p/lang/en/nid/209997)
RelatedLinks
NationalInstrumentsCANopenInterfacesHomePage(http://sine.ni.com/nips/cds/view/p/lang/en/nid/209981)
KnowledgeBase5W8COLVO:SummaryofCANopenSoftwareAvailabilityandCompatibilitywithNationalInstruments
Products(http://digital.ni.com/public.nsf/allkb/13C3CB1148A2AEA4862579DB0066E66B)

http://www.ni.com/whitepaper/14162/en/

5/5

You might also like