introduction

Can (controller area network) is one of the most widely used Fieldbus in the world. As a remote network communication control mode with advanced technology, high reliability, perfect function and reasonable cost, can bus has been widely used in various automatic control systems, and has incomparable advantages.

The new 16 bit dsPIC30F6014 digital signal controller combines the control advantages of single chip microcomputer and the high-speed operation characteristics of digital signal processor (DSP) to provide a single chip solution for embedded system.

In this paper, based on CAN protocol, combined with the outstanding performance of dsPIC30F6014, the design method of CAN node based on dsPIC30F6014 digital signal controller is proposed in the process of communication interface design.

1. DsPIC30F6014 digital signal controller and can bus

1.1 features of dsPIC30F6014 digital signal controller

DsPIC30F6014 digital signal controller (DSC) is a single-chip embedded controller. It integrates the control function of MCU and the computing power and data throughput of DSP. The operation speed can reach 20 and 30 MIPs. It is equipped with self programming flash memory, and can work in the range of industrial temperature and expansion temperature. DsPIC30F6014 digital signal controller based on 16 bit MCU not only has powerful peripheral equipment and fast interrupt processing ability, but also integrates the functions of digital signal processor which can manage high-speed computing activities. DsPIC30F CPU module adopts 16 bit (data) improved Harvard architecture with enhanced instruction set, including strong support for DSP. The CPU has 24 bit instruction words with variable length opcode fields. The program counter (PC) is 24 bit wide and can address up to 4m × 24 bit user program memory space. Single cycle instruction prefetching is used to help maintain throughput and provide predictable execution. Equipped with 144K byte enhanced flash memory, 8K byte static RAM and 8K byte EEPROM, it can support large and complex applications. DsPIC series products are different from the existing embedded systems. The system integrates oscillator, low voltage detection and watchdog timer. The products do not need to use additional components, which can reduce the area of the motherboard and the cost of the system. It provides a single chip solution for embedded systems. In addition, it also has a series of on-chip functions, including I / O port, timer, input capture, output comparison, UART, 12 bit a / D converter, SPI interface, I2C interface and can communication module. The structure diagram is shown in Figure 1

These characteristics make it an ideal solution for motor control applications requiring higher accuracy, faster speed or sensorless control, such as non sensing brushless DC motor, reluctance conversion and induction motor. In addition, it can also be applied to Internet access devices and automotive products; Biometric detection and protection, such as fingerprint identification; Uninterruptible power supply, power management and voice switch (voice recognition system) and other fields.

Software and hardware design of CAN node based on dsPIC30F6014 single chip solution

1.2 technical features of CAN bus

Can is a kind of network which is mainly used for monitoring and controlling various processes (equipments). It was originally designed by Bosch Company of Germany for the monitoring and control system of automobile. Because of its excellent characteristics and high reliability, can is especially suitable for the interconnection of monitoring equipment in industrial process. Therefore, it has been paid more and more attention by the industry. Specifically, can has the following characteristics:

(1) Can can work in multi master mode, any node in the network can actively send information to other nodes in the network at any time, regardless of master and slave, and the communication mode is flexible;

(2) Can can transmit and receive data in point-to-point, point to multipoint (Group) and global broadcast mode;

(3) The node information in can network can be divided into different priorities to meet different real-time requirements;

(4) Can uses non-destructive bus technology. When two nodes send data to the network at the same time, the node with lower priority stops sending data actively, while the node with higher priority can continue to transmit data without being affected, which greatly saves the bus load conflict time and will not cause network paralysis in the case of heavy network load;

(5) The maximum direct communication distance of can is 10km (the rate is less than 5Kbps), and the maximum communication rate is 1mkbps (the maximum distance is 40m).

2. Design of CAN node

2.1 can node hardware design

Figure 2 shows an example of a CAN bus network. There are three ways to realize can network: microcontroller + can controller + can transceiver; Microcontroller integrated with CAN controller + can transceiver; Can serial I / O device + can transceiver. Node 1 is composed of dsPIC30F6014 integrated can controller and mcp2551can transceiver of microchip company; Node 2 is composed of PIC MCU of microchip company, mcp2550 serial can controller with SPI interface and mcp2551can transceiver; The CAN node of PC is composed of SJA1000 can controller of Philips company and PCA82C250 can transceiver. The research and experimental results of this paper are completed under this network framework.

Obviously, dsPIC30F6014 can be connected to can communication network only by adding can bus transceiver circuit, which greatly simplifies the design of communication system and reduces the probability of communication nodes being interfered. The can module is connected to the physical bus through the CAN controller interface chip mcp2551. Mcp2551 is a fault-tolerant high-speed can device, which can be used as can protocol controller and physical bus interface. Mcp2551 can provide differential transceiver capability for CAN protocol controller. It fully meets iso-11898 standard, including the requirement of 24 V voltage. It works at a rate of up to 1 MB / s.

2.2 can node software design

The three-layer structure model of CAN bus is physical layer, data link layer and application layer. The software design of CAN bus node mainly includes three parts: can node initialization, message sending and message receiving. The initialization program design is very important for the normal operation of CAN bus node. It mainly includes the setting of working mode, the setting of receive mask register and receive code register, the setting of bus timer and interrupt allow register. Microchip company provides developers with rich development tools and application libraries, which greatly improves the efficiency of code development. Since can protocol does not specify the assignment of information identifier, different methods can be used according to different applications, so it is very important to determine the assignment of can identifier when designing a communication system based on can. The allocation and location of identifier is also one of the main projects of higher-level solutions. Currently, CANopen protocol and DeviceNet protocol are the most popular can application layer protocols. DeviceNet protocol is suitable for factory automation control, CANopen protocol is suitable for all machinery embedded network. Modbus protocol is a good solution for small networks (Figure 2). Modbus protocol is a common language used in electronic controllers. Through this protocol, controllers can communicate with each other and with other devices via network (such as Ethernet). It has become a general industry standard. With it, the control equipment produced by different manufacturers can be connected into an industrial network for centralized monitoring. Modbus protocol supports master / slave communication and peer-to-peer communication. Therefore, MODBUS protocol can not only support RS232 and RS485 network, but also give full play to the performance and communication efficiency of CAN bus network.

3. Problems in system application

In actual operation, we often encounter the phenomenon of CAN bus failure and frame loss in the process of data transmission

(1) In order to further improve the anti-interference measures, the isolation circuit composed of high-speed isolation devices such as 6n137 should be used between CAN controller and transceiver, and the DC-DC module should be used to isolate the power supply, so as to enhance the anti electromagnetic interference ability and protect the system circuit from the influence of network.

(2) Two 120 ohm resistors at both ends of the bus play an important role in matching the bus impedance. If they are ignored, the anti-interference and reliability of data communication will be greatly reduced, even unable to communicate.

(3) In software design, the setting of CAN bus timer is very important. All controllers on CAN bus must have the same baud rate and bit length. However, different controllers do not require the same master oscillator clock. If the clock frequency of each controller is different, the baud rate must be adjusted by adjusting the time shares of each segment. Here are some requirements for time period programming:

Propagation section + phase buffer section 1 “= phase buffer section 2

· phase buffer 2 “synchronous jump width

Generally, bit sampling should take place about 60-70% of bit time, depending on system parameters.

epilogue

The innovative point of this paper is: the implementation scheme of dsPIC30F6014 digital signal controller can node is introduced in detail. The research and experimental results show that the CAN node composed of dsPIC30F6014 digital signal controller has many excellent performances, and can give full play to the function of the node, which provides a new practical scheme for the design of embedded system can node.

Editor in charge: GT

Leave a Reply

Your email address will not be published. Required fields are marked *