can-buscanopenindustrial

How to setup PDO mapping?


I basically understand the concept of PDO mapping in CANopen networks. It allows to to broadcast real-time data with small header.

how it is made? How do I setup my devices to know how to send/receive PDO's? Do I need some kind of software for that?


Solution

  • A lot the answers to your questions depend on the specific devices you are using, but in general...

    Do I need some kind of software for that?

    You do not need specialized software to configure a CANopen device. They can be configured over CANbus using SDOs. A USB CANbus dongle is more than sufficient although manuually constructing SDOs is tedious. Companies exist that provide software to configure any CANopen device e.g. Vector. Often vendors will provide a specialized GUI to configure their devices e.g. AMC's DriveWare. If one is available you should probably use it.

    How is it made?

    PDOs (Process Data Objects) in contrast to SDOs (Service Data Objects) do not include meta-data about the contents of the message and TPDOs may be transmitted without a specific request from the master. This allows PDOs to use the bus more efficiently. The trick is that the contents of PDO messages must be agreed upon ahead of time. This agreement is specified using the PDO Communications Parameters and PDO Mapping Parameters entries of your devices Object Dictionary. How they may be configured or if they can be configured at all is device dependent. Most commonly PDOs can be configured at run-time during pre-operational mode through SDOs. Though this may be (and is likely to be) unnecessary if the defaults provided by your device are sufficient.

    The contents of a PDO is configured through its corresponding "Mapping Parameters" in the devices Object Dictionary. TPDO Mapping parameters start at index 0x1A00. TPDO0 corresponds to 0x1A00, TPDO1 to 0x1A01 etc. The mappings are held in the sub-indexes and are encoded as 32-bit unsigned integers. The format is first the 16-bit index then the 8-bit sub-index and lastly the size in bits of the parameter to use. The granularity of the size is device dependent. Some may only provide byte level granularity. E.g. if you had a REAL32 variable in the object dictionary at 0x2000,0x02 you wanted sent as the only parameter of TPDO0 you would set 0x1A00,0x01 to 0x20000220. RPDOs are configured in the same fashion with their indexes starting at 0x1600.

    The next piece in the puzzle are the communication parameters. RPDOs usually do not need to be configured in this fashion. TPDOs do need configuration. The indexes start at 0x1800 and correspond to the TPDOs in the same fashion as the mapping parameter indexes.

    COBID        (0x01) UNSIGNED32 Arbitration/COB-ID PDO will use.
    XMIT_TYPE    (0x02) UNSIGNED8 When PDO is transmitted
    INHIBIT_TIME (0x03) UNSIGNED16 Minimum time between PDO messages (useconds)
    EVENT_TIME   (0x05) UNSIGNED16 Timeout for sending (mseconds)
    

    PDO message layout takes the associated TPDOnCOMPARAM,COBID for the arbitration ID and appends each of the mapped parameters from TPDOnMAPPARAMS. For TPDOs this is done internally by the device and is sent. For RPDOs the master does this, sends the PDO and device decodes the message writing each parameter to its Object Dictionary.

    How do I setup my devices to know how to send/receive PDO's?

    The default connection set includes four TPDOs (transmitted from node), and four RPDOs (received by node). More can be specified (up to 512 each) depending on your device.

    PDOs are only transmitted/received when a CANopen node is brought into "Operational Mode". To do this you need to send an NMT (Network ManagemenT) start command (Code Specifier = 1). Using 0 for the node ID indicates a broadcast message that all nodes will respond to. NMT Messages: Have a COB-ID of 0 Have a payload of 2 bytes

    NMT Message Format (CAN-bus payload):
    +--------------------------+
    | Code Specifier | Node ID |
    +----------------+---------+
    |       ff       |    ff   |
    +----------------+---------+