CANopen is a high-level communication protocol in the Control LAN road (Controller area Network, CAN), including communication sub-protocols and equipment sub-protocols commonly used in embedded systems, is also commonly used in industrial control of a fieldbus.
Since the can bus only defines the physical layer and the data link layer, and does not define the application layer, the CANopen communication protocol is required to unify the measurement and standardize the various devices. CANopen implements the protocols of the OSI model over the network layer (including the network layer).
Standard CANopen Page Box:
CANopen CANbus's 11-bit ID is called the Communication object ID (Cob-id). It is divided into 4-bit function code and 7-bit CANopen node ID.
There are 128 different combinations of 7-bit IDs, where ID 0 is not used, so up to 127 devices are allowed on a CANopen network.
When applying CANopen, both the configuration information and application information that need to be passed are placed in the process data object PDO (Process database object) and the service data object SDO
Process data Object (PDO) service
PDO is divided into Tpdo and rpdo
PDO belongs to process data, unidirectional transmission, no need to receive node response can message to confirm, belong to "production consumption" model
A node has 4 Tpdo and 4 rpdo respectively.
How PDO is triggered:
When the data changes, immediately send out, do not have to wait for the host rotation to send, so real-time good, and avoid the duplication of data consumption of a large number of bus resources, as the data compression. The event-driven type of rpdo can immediately process the received data.
- To remotely request or poll RTR:
This approach is like 485 communication, where the master actively remotely requests or polls, and the sub-device sends the PDO. Because there are some can controllers that do not support remote frames, it is not recommended.
- Synchronize transfer sync:
The CAN bus has a device as a producer of sync signals, and other devices as consumers. Both the producer and the consumer are also sync counting functions, the consumer counts to a certain time (1~240), automatically sends PDO.
- if (Synchronous transfer && event trigger):
As the name implies, not only the timing also satisfies the event trigger before the PDO is sent.
Service data Object SDO
The service data object is used to read and write the object Dictionary of the node, now only realize the full speed mode of SDO download and upload, do not support the normal mode or block download and upload, because the amount of data is small, the function is sufficient, SDO full-speed download and upload using the answering service, the monitoring terminal to the node to send service requests, The reply is returned by the node.
SDO belongs to service data, "Server client" model, polling type
SDO transfer mechanism:
Accelerated transfer (expedited transfer): Up to 4 bytes of data transfer
Segmented transfer (segmented transfer): Transfer data length greater than 4 bytes
Block transfer: When the transmitted data length is greater than 4 bytes, multiple segments are answered by only one acknowledgment message to increase bus throughput
Object Dictionary OD
CANopen devices are required to have an object dictionary (Obiect Dictionary), which is used to set up the device configuration and perform non-instantaneous communication.
is an ordered set of objects, each of which is addressed with a 16-bit index value, in order to allow access to a single element in the data structure, while defining a 8-bit sub-index.
Related learning of CANopen