CANopen NOTE 2

Source: Internet
Author: User
Tags event timer sdo

    • Pdo

Process data objects are used to transfer process data between nodes, such as I/O module I/O status reading and setting, analog acquisition and analog output, and so on, the protocol considers slave hardware limits to support up to 4 sets of PDO, each containing one rpdo and one tpdo. The Gold Drive supports 4 tpdo and 4 rpdo. Each PDO contains up to 8 bytes of data.

I am now taking an I/O module as an example: the I/O module has 24 inputs and 24 outputs. 24 input through the TPDO to the monitoring terminal or other nodes, 24 output through RPDO by the control node to set it, the use of sending and receiving PDO1 group, that is, the identifier tpdo:0x180+node_id,rpdo:0x200+node_id, With 3 bytes You can represent 24 I/O, so sending and receiving PDO can be represented as follows (assuming node_id=1):

  I/o node → monitoring Terminal (TPDO)

I/O node ← Monitoring terminal (RPDO)

PDO Mapping

PDO is just a carrier, it is like a van, what is loaded in the compartment, is configurable, which is done by the PDO mapping. The PDO mapping is used to specify which objects in the object dictionary are loaded into PDO, or to place data into those objects from the received PDO. PDO Mapping is a convention this assigns (maps) an object from the object dictionary (data payload) to a PDO. once mapped, the PDO can carry the assigned data items without explicit reference to the object dictionary, thereby Savin G on communication and CPU overhead.

Some of the objects in the object dictionary can is mapped to a PDO, which can either receive (RPDO) or transmit (TPDO). The mapping of an RPDO enables reception of commands and variables-for example, efficient transmission of high-speed onl Ine motion commands to the drive-whereas the mapping of a TPDO enables the drive to send a predefined message in respons E to an event such as end of motion.

  An rpdo is buffered upon reception; It is sent for interpretation immediately (when defined as asynchronous) or upon receipt of the next SYNC signal (when def Ined as synchronous).

Objects 0x1a00 0x1a03 contain the Objects mapped to tpdos. Objects 0x1600–0x1603 contain the Objects mapped to rpdos. The data type of PDO mapping is described in Object 0x21. The following table shows that sub-index 0 corresponds to the number of objects to be mapped, and the child index 1~8 corresponds to the object to be mapped.

Transmission Type  

PDO communication has three trigger modes: Internal event driven or internal timer trigger, synchronous trigger, remote request trigger.

1) Trigger synchronously. Synchronous triggering PDO refers to the CANopen node receiving a synchronization message from the Management node (Sync object Sync), which sends a PDO message to the bus based on the triggering message condition. Synchronous transmission is also divided into periodic and non-cyclical, periodic refers to the CANopen node received a certain number of synchronization messages before the start of sending; the non-periodic PDO refers to the PDO trigger condition after it is set up and the PDO is sent as soon as the next synchronization object is received. Synchronous transmission in the actual application of the advantages of many, it can provide a consistent system beat, so that the bus data as far as possible to ensure synchronization. Synchronous transmission of the most important application is multi-axis synchronization control, there is no such synchronization mechanism, multi-axis drive function is not possible to achieve.
Sync is the equivalent of a network beat, the data according to the rhythm of the fixed cycle of process data transmission. For example, there is a pressure sensor, a temperature sensor, a level sensor in the network, a monitoring terminal in the network to monitor the data collected by three sensors in real time. The pressure sensor may detect a rapid pressure change, which can be updated every 200ms data, the temperature may require 1s update data, the level may be 5s update data. Now I can set a 200ms cycle of sync messages, the pressure sensor transmits the data once every sync is received, the temperature sensor can transmit data every 5 sync, the same level sensor is sent every 25 sync data. This kind of communication means more rules, good management, high efficiency of system operation, suitable for the application of periodic data update.

2) Internal event-driven or internal timer trigger. A communication is triggered by an event. For example, the status of the digital I/O port changes, exceeding pre-set values, timer interrupts, etc. will trigger the node to send a PDO. This mode minimizes the bus load and achieves high communication characteristics at relatively low baud rates. Internal timing sending is different from Sync sync trigger, it is a periodic send on this node, by setting the PDO parameter, determine a period, every fixed time to send a PDO to the network, it is not related to sync. In the network design, the timing period is set according to the data acquisition speed and the updating requirement of the sensor.

3) Remote request trigger. The PDO consumer can send a remote PDO request to the PDO producer, and the corresponding PDO producer responds to the remote frame and sends the corresponding PDO data to the bus.

PDO Transport type definition table:

  If The Rpdo transmission type is 1, the received message was buffered but actually transmitted For execution at the next SYNC message. With Tpdos, the message was transmitted according to transmission type value, which can range from 1 to 1 indicates on all single SYNC, 2 means every second SYNC message, and soon.

Communication Parameter

Each PDO is described by two objects in the object dictionary: Communication parameters and Mapping parameters. The PDO communication parameters indicate which Cob-id, transmission type, disabling time, and timing time are used, and the PDO mapping parameter is used to set the mapping of data in the PDO message and to determine the location of the data to be transmitted in the CAN packet data domain.

A PDO can specify a forbidden time, which defines the minimum interval between two consecutive PDO transmissions, avoiding the high-priority data is too large to occupy the bus at all times, leaving other lower-priority data powerless to compete for bus problems. The forbidden time is defined by a 16-bit unsigned integer in the unit 100us. If Sub Index 3 is set to 0 and then the minimum time interval to transmit tpdo is disabled.

A PDO can specify an event timing cycle, when a PDO transfer can be triggered after a timed time has passed used. The timer defines the maximum interval for tpdo transmission. The event occurs when  the time is elapsed. The event timer resolution is 1ms. The event causes the transmission of  this tpdo in addition to other Asynchronou S events. The occurrence of an event sets the timer  again. A value of 0 disables this function.

The PDO communication parameters are configured before starting the PDO transfer, and the format is described at 0x20. Transmit PDO communication parameter:objects 0x1800-0x1803;Receive PDO Communication parameter:< /c5>Objects 0x1400-0x1403

=====================================================================================

PDO Mapping Case: Map 3 objects in the following table to Pdo1-transmit, asynchronous recurring type, cycle time 10ms, Forbidden time 2ms

1)   ①clear Mapping TPDO1(to change the PDO mapping, sub-index 0 must are set to 0 (mapping is deactivated). Only then can the objects be remapped)

Number_of_mapped_objects (1A00 h:00 h) = 0
Disable TPDO1
in order to set the communication parameters, it is necessary to first place the 31st position of the communication Parameter object sub-address 1h 1, that is, the TPDO1 must be invalidated before it can configure its communication parameters, otherwise it will produce an error. It is a allowed to change bit 0 to a while the PDO exists and is valid (bit = 0b). In the if attempting to change the values from bit 0 to bit a, the devise responds with the SDO abort transfer s Ervice. Send the following command to invalidate the TPDO1 :

  2) Set the mapping object parameters (Modify mapping by changing the values of the corresponding sub-indices.)
Index = 6041h Subindex = 00h Length = 10h? 1st_mapped_object (1A00 h:01 h) = 60410010 h
Index = 6061h Subindex = 00h Length = 08h? 2st_mapped_object (1A00 h:02 h) = 60610008 h
Index = 6064h Subindex = 00h Length = 20h? 3st_mapped_object (1A00 h:03 h) = 60640020 h

Note: The sub-indexes from 1 to number of entries contain the information is about the mapped application variables. These entries describe the PDO contents by their index, sub-index and length. That is, when you set the mapping object parameter to the format shown below (Map object address + Object sub-address + map data length, in small-end mode send)

Assuming the device node ID is 1, send a Frame full SDO message configuration PDO, which needs to be sent in the following format:

  3) Set number_of_mapped_objects (Enable mapping by setting sub-index 0 to the number of mapped objects.)
Number_of_mapped_objects (1A00 h:00 h) = 3

Note: When sub-index 0 was set to a value greater than 0, the device may validate the new PDO mapping before transmitting the Response of the SDO service. If An error is detected, the Elmo drive transmits the abort SDO Transfer Service with abort codes.

  4) Set the PDO communication parameters
Pdo1-transmit is an asynchronous recurring type? Transmission_type (1800 h:02 h) = FF h
Forbidden Time 2ms (20X100US)? Inhibit_time (1800 h:03 h) = + H
Cycle time 10ms (10x1ms)? Event_time (1800 h:05 h) = 0A h
Set Cob-id (pdo1-transmit)? Cob-id (1800 h:01 h) = 0181 h

Communication Parameter Object sub address 1h contains Cob-id, but its data type is 32 bits (referring to the 0x20 description), several other definitions are as follows:

  The bit valid (bit) enables Tpdos. There may is tpdos configured but not used, and therefore set to not valid.

The following command is sent to enable TPDO1:

  5) PDO mapping completed (Finally, the PDO is created by writing to its communication parameter Cob-id.)

Reference:

http://blog.csdn.net/iamplane/article/details/49931319

CANopen NOTE 2

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.