1 Introduction
Sensor equipment is one of the most widely used equipment in industrial automation, instrumentation and other production activities. The use of sensors is also the main way and means to obtain information in the fields of nature and production. Early sensor devices were all directly connected to the controller, and communication between each sensor device was impossible. In a huge control system, there may be a variety of sensor devices, and the traditional point-to-point communication method will lead to complicated wiring, low operation efficiency and high maintenance cost of the entire system. The introduction of CAN bus has improved the system wiring to the greatest extent. The CANopen protocol based on the application layer of the CAN bus not only changes the communication mode between the equipment and the control system, but also increases the equipment-level diagnostic function. The CANopen device sub-protocol CiA DSP410 describes the inclination sensor as a standard CANopen device and defines a series of specifications for the inclination sensor.
This article will introduce how to use the XGate-COP10 module to design the CANopen slave interface of the inclination sensor.
2 Introduction to XGate-COP10
XGate-COP10 is a CANopen slave protocol conversion module, which integrates the CANopen slave protocol stack and is designed in accordance with CiA DS301 V4.02. It integrates network management (NMT), service data (SDO), process data ( PDO), error management and other functions. At the same time, it also follows the DS303-3 indicator light and DS305 layer setting (LSS) and other related protocols, making the module more powerful. All functions are tested by the conformance testing software provided by CiA, which ensures good compatibility with other CANopen devices.
The XGate-COP10 is a DIP24 package with a small footprint (6 cm2) and is very easy to integrate into user equipment. Its appearance is shown in Figure 1.

Fast Realization of CANopen Communication of Inclination Sensor

3. Hardware design of CANopen interface of tilt sensor
The hardware design block diagram of XGate-COP10 is shown in Figure 2.
The MCU of the sensor control board is connected to the XGate-COP10 through the serial port (TTL level); the user can use an I/O port of the MCU to connect to the reset pin (/RST) of the XGate-COP10 to realize the reset control of the module. In some cases, it is also necessary to connect the XGate-COP10 interrupt signal output pin to the MCU interrupt input pin in order to process RPDO data in a timely manner. MCU only needs to reserve 1 serial port, 1 interrupt input and 1 I/O port. Since the CAN transceiver is not integrated in the XGate-COP10, it is recommended to use the CAN transceiver module CTM8251T with isolation. XGate-COP10 adopts the standard CANopen protocol. You can use external DIP switches to set the node address and baud rate of the device, and external LED indicators to indicate the current CANopen status of the module.
4. Resource allocation of tilt sensor parameters
For real-time data, XGate-COP10 has 96 B input storage area and 96 B output storage area for users to use, these storage areas can be used to exchange various real-time parameters between the sensor and other CANopen devices.
For non-real-time data, XGate-COP10 provides a serial port command to directly access the object dictionary. Users can read and write the module’s object dictionary through this command, so that the sensor MCU can access the non-real-time parameters of the CANopen network.
In this way, the communication between the CANopen master device or other devices and the sensor becomes very convenient.
(1) Resource allocation
The distribution of sensor-related parameters in the XGate-COP10 storage area is shown in Table 1. The user only needs to write the measured angle value into the corresponding data input storage area, and the XGate-COP10 will process the data according to the definition of the CANopen protocol. Parse processing and send to CAN bus through TPDO.

Fast Realization of CANopen Communication of Inclination Sensor

(2) Real-time data transmission configuration
The PDO data in XGate-COP10 can be mapped to any input and output data storage area of ​​the data storage area. The data mapping example is shown in Table 2.

Fast Realization of CANopen Communication of Inclination Sensor

5 Operation of XGate-COP10 by tilt sensor MCU
XGate-COP10 provides a serial port to connect with the sensor MCU. In order to facilitate the user to quickly and reliably realize the communication between the module and the MCU, Guangzhou Zhiyuan Electronics Co., Ltd. provides the driver source code of the XGate-COP10 serial port protocol. Users can write real-time updated sensor data into the input buffer, and XGate-COP10 automatically sends it to the master or other slave devices. An example of the user program software operation flow is shown in Figure 3.

6 Conclusion
After the above steps, we quickly realized the CANopen interface of the inclination sensor, and can communicate with other CANopen devices. The emergence of XGate-COP10 makes developers no longer worry about the development of CANopen protocol stack, which greatly shortens the development cycle. I believe that with the help of XGate-COP10, developers can achieve greater success.
Guangzhou Zhiyuan Electronics Co., Ltd. provides CANopen interface cards with various interfaces, CANopen terminal equipment (including data acquisition, motor control, etc.), CANopen analyzers, gateways and bridges, OPC servers, and a complete set of networking solutions and application development based on CANopen protocol. .

The Links:   LM150X08-A4K8 DMF-50840NF-FW