当前位置:网站首页>First acquaintance with CANopen
First acquaintance with CANopen
2022-06-25 12:46:00 【zhaodong_ jack】
What is? CANOpen
CANOpen It's located in CAN An application layer protocol on the bus .CAN The bus only specifies the physical layer and the data link layer , With these two layers , Data can be found in CAN On the bus . We will make an agreement with which device we communicate with , Which one? ID What is the , Which byte represents what , But in this way , Each manufacturer's equipment defines its own protocol , It's a mess . If an open , Standardized protocols , Manufacturers follow this agreed standard , Then it is easy for devices to communicate with each other .
CANOpen Protocols are usually divided into user application layer 、 Object dictionary 、 The three parts of communication .
CANOpen agreement
CANOpen It consists of a series of protocols . such as CiA301、CiA401、CiA402 Protocol, etc .
CANOpen The basic agreement is CiA 301 agreement . Each industry has its own equipment sub agreement ,
CANOpen Protocol message classification
NMT Network management message , The role is to manage the network , Switch the state of the node . Generally, it is sent by the master station NMT Network management message .
SDO Service data object message , It is used to set equipment parameters , Or the transmission of some key data . Generally, it is initiated by the master station SDO message , Slave station response SDO message . The slave station can also initiate SDO, The master station responds , For example, the transmission of key data .
PDO Process data object message , The function is to transmit process data of some equipment , Such as transmission temperature , Speed and so on . Both master and slave stations send .
EMCY Emergency message , The function is to transmit equipment fault information . Both master and slave stations send .
SYNC Synchronous message , The function is to synchronize data , Used to synchronize the slave station TPDO data . Generally, it is sent by the master station . For example, from the station TPDO The transmission type is in synchronous mode , When the slave station receives the set number of SYNC After the message , The slave station will send TPDO. This will be elaborated in a subsequent article .
NODE GUARDING Node protection message , The function is that the master station requests the status of the slave station , The master station asks , Slave station response . This model has been phased out , Because it takes up too much CAN Bus network bandwidth .
HeartBeat Heartbeat message , The function is that the device actively sends heartbeat , Show yourself online . Both master and slave stations can send .
CANOpen State machine
CANOpen The nodes include : initialization 、 Pre operation 、 operation 、 Stop these four states . The state machine can go through NMT Services switch to each other . Here's the picture :
NMT message
Only CANOpen The master station will send NMT message .NMT The message does not need to be answered , Is the producer consumer model .NMT The message ID Fixed is 0, The data field has two bytes , The first byte is the command , The second byte is Node-ID.Node-ID by 0 Indicates all slave stations . Here's the picture 
Node protection message
The master station can monitor the current status of each slave node through the node protection message . The master station periodically sends node protection messages to inquire about the status of the slave station , After receiving the inquiry from the master station, the slave station returns its status to the master node .
The master station sends remote frames , Request the status of the slave station . The data answered by the slave station is only one byte , This byte bit7 Is alternating 0、1 The emergence of .bit0~bit6 Indicates the status of the slave station .
The master request format and the slave response format are shown in the following figure :
The status word of the slave station response is shown in the figure below :

The node protection message is 0x700+Node-ID , This Node-ID It's from the station Node-ID, Each node must request and respond once . Node protection takes up too much network bandwidth compared to heartbeat .
Heartbeat message :
Heartbeat message is the message that the slave node actively sends to the master node . Heartbeat messages are periodic , The master node sets a timeout for each slave node , If the heartbeat message of the slave node is not received when the timeout period expires , The master station will perform corresponding actions on the slave station .
Node online message
The slave station takes the initiative to send the node online message to inform the master station that it has entered the pre operation state from the initial state . The startup message is as follows :
SYNC Synchronous message
Synchronization message CAN-ID Fixed is 0x80, Data length is 0 or 1. Synchronous message is a producer consumer model , From master station , Synchronize the slave station TPDO.

EMCY Emergency message
When an error occurs inside the device , Trigger the object , The format of emergency message is as follows :

Emergency message COB-ID Stored in 0x1014 The index , It is generally defined as 0x80+Node-ID.
Emergency message ECC( Emergency error code ) as follows :
The error register of the emergency message is located at 0x1001 Index .
Production prohibition time of emergency message , Stored in index 0x1015 in , Prevent sending emergency messages all the time , Occupy CAN Bus bandwidth .
SDO message
SDO Is the client server model . By using the indexer index SDO The client can access objects in the device object dictionary .
SDO Generally, the length of the transmitted data does not exceed 4 Bytes , When the data length exceeds 4 Bytes are sent by splitting them into several messages .
SDO Read the message as follows :


SDO Write the message as follows


If you use SDO Return when reading or writing 0x80 Wrong words , You can query the back of the returned data frame 4 Bytes , after 4 Bytes are called abort code , The cause of the error is known by the abort code . The abort code is as follows :
About PDO Communication is covered in the next article .
边栏推荐
- Wechat forbids sharing
- 线上服务应急攻关方法论
- 使用Visio画立方体
- 架构师需要具备的能力
- (7) Pyqt5 tutorial -- > > window properties and basic controls (continuous update)
- 2021-10-21
- Ubuntu uninstalling PHP
- Zhangxiaobai's way of penetration (V) -- detailed explanation of upload vulnerability and parsing vulnerability
- 2021-09-22
- Connect with the flight book and obtain the user information according to the userid
猜你喜欢

laravel 9

初识CANOpen

How to implement a high-performance load balancing architecture?

20220620 面试复盘

PPT绘图之AI助力论文图

(7) Pyqt5 tutorial -- > > window properties and basic controls (continuous update)

Happy shopkeeper source code -- Introduction to happy shopkeeper system development mode

架构师需要具备的能力

(3) Pyqt5 tutorial -- > signal and slot preliminary test

高性能负载均衡架构如何实现?
随机推荐
Thinkphp3 count ` *'problem
Some fields are ignored in tp6 query
Error while sending STMT_ PREPARE packet. PID=29294
2021-09-30
Circular exercises of JS
Total number of MySQL statistics, used and unused
Initialize the project using the express framework
画图常用配色
Flutter automatically disappears after receiving push
Go novice exploration road 1
torch.tensor拼接与list(tensors)
Micro engine generates QR code
JS uses the for loop in the function to insert and delete the array at the specified position
ECSHOP commodity wholesale multi attribute multi specification multi inventory batch purchase ECSHOP wholesale plug-in ECSHOP multi attribute order
el-select clear 清空内容时触发事件
Shell learning notes (latest update: 2022-02-18)
Node child processes and threads
Micro engine remote attachment 7 Niu cloud upload
Talk about 11 key techniques of high availability
Jeecgboot startup popup configuration is still incorrect