Design of CAN bus interface conversion card based on MSP430 series single-chip microcomputer

The MSP430 series single-chip microcomputer is an ultra-low-power mixed-signal controller with abundant on-chip peripherals and a very wide range of applications. Introduce the design and implementation of the RS232/RS485 CAN bus communication conversion interface based on MSP430 series single-chip microcomputers, focus on the discussion of its hardware configuration and software functions, and give the electrical principle and software flow.

1 Introduction

Controller Area Network (CAN for short) is a serial communication protocol developed by Mercedes-Benz in Germany in the 1980s to solve the data exchange between numerous control devices and instruments in automobiles. As a kind of field bus, it is widely used in various industrial scenes, and works in a master-slave mode or a multi-master mode according to different needs. The communication medium used by CAN bus is twisted pair or other cables, and the transmission rate can reach 1Mb/s. There are two differences between CAN bus and other communication networks: First, the message transmission does not contain the target address. It is based on the whole network broadcast. Each receiving station filters the messages according to the identifier reflecting the nature of the data in the message. Accept what should be collected, discard what should not be collected and don’t use it. The advantage is that it can go online and offline, plug-and-play and multi-station reception; second, it particularly strengthens the attention to data security and meets the needs of control systems and other systems with higher data requirements. In view of its extremely high reliability, unique design, high speed and long transmission distance, it is especially suitable for the interconnection of industrial field monitoring equipment.

2 System introduction

The CAN bus uses a bus network topology, as shown in Figure 1. Using the unique multi-master transmission method of the CAN bus, each extension will actively send when there is data as needed, without the need for continuous polling by the host, thereby saving data traffic on the network and improving transmission efficiency.

Design of CAN bus interface conversion card based on MSP430 series single-chip microcomputer

Most of the existing monitoring equipment uses RS-232 or RS-485 serial communication. In order to build a CAN communication network on this basis, the author designed a portable CAN bus interface conversion card, which can use lithium batteries as Power supply, low power consumption, small size, light weight, can meet the needs of portable.

3 System hardware structure design

The MSP430 series microcontroller from Texas Instruments is an ultra-low-power microcontroller with a voltage range of 1.8V to 3.6V. The processor achieves maximum code efficiency through a 16-bit RISC system, 16-bit CPU, integrated registers, and constant generator. The MSP430 series of ultra-low power consumption microcontrollers are ideal microcontrollers used in industrial control, digital motor control, handheld instruments and other equipment. This design uses the MSP430F449 single-chip microcomputer, which has a wealth of on-chip modules: up to 8 channels of 12-bit A/D converters, 48 ​​I/O ports, 2 UART watchdogs, 2 built-in 16-bit timers, and online simulation Flash memory, 7-channel PWM output, LCD driver, etc.

The schematic block diagram of the electrical structure of the portable CAN bus interface conversion card is shown in Figure 2. It is composed of a power supply module, a CAN communication interface circuit, a serial port level conversion circuit, a buffer and an LCD module.

Design of CAN bus interface conversion card based on MSP430 series single-chip microcomputer

3.1 CAN communication interface circuit

The system hardware is based on Philips’ SJA1000 CAN bus controller, which is an independent CAN bus controller, mainly used in industrial environments. It is also an alternative product of Philips Semiconductors PCA82C200 CAN controller (Basic CAN). SJA1000 connected via a simple bus can complete all functions of the physical layer and data link layer of the CAN bus. SJA1000 is composed of CAN core module, sending buffer, interface FIFO, acceptance filter and interface management logic. The CAN core module is mainly responsible for the sending and receiving of CAN message frames and the realization of the CAN protocol, and the interface management logic is responsible for the interface between the SJA1000 and the main controller. During data transmission, the main controller sends the identifier and data into the sending buffer and then requests sending, thereby starting the CAN core module to read the data in the sending buffer, and then encapsulate it into a complete CAN message frame according to the CAN protocol. The transceiver sends to the bus, and the capacity of the sending buffer is 13 bytes. The acceptance filter unit processes the received information and sends it to the receiving FIFO. The receiving FIFO is 64 bytes. The PCA82C250 CAN bus transceiver is the interface between the CAN controller and the physical bus. It provides the CAN controller with the ability to send and receive differentially to the bus. The transceiver can choose 3 different working modes depending on the different connections of pin 8 (RS): high speed, slope control and standby mode. A resistor connected to the ground through the RS pin can control the slope of the bus, and the slope is proportional to the current output on the pin RS. For applications that require a higher transmission rate, usually pin 8 is directly grounded to select the high-speed mode. In this way, the transmitter output transistor simply opens and closes as fast as possible, and no measures are taken to limit the rising and falling slopes. Therefore, shielded cables must be used to avoid radio frequency interference. The sending and receiving ports of the CAN controller are respectively connected to the PCA82C250 through a photoelectric isolation circuit, which effectively suppresses the interference introduced by the bus.
Disturb.

3.2 Serial port level conversion module

In this design, MSP430F449 only uses one USART interface, while the CAN conversion card integrates two communication modules, RS232 and RS485. The interface type is selected through the DIP switch in the design. The RS232 and RS485 serial port level conversion modules use Maxim’s MAX3221 and MAX3485 respectively.

3.3 Power module

In addition to being powered by lithium batteries, the entire system can also be powered by external power sources such as small transformers to meet the needs of different occasions. Select TPS7333 as the regulated power supply of MSP430F449 to output the system power supply voltage of 3.3V. In order to ensure the normal data transmission, the power circuit is also equipped with a bq24012 battery charging management circuit, so that when the battery power is low, it may affect the normal data transmission to give an alarm in time to remind the battery to be replaced or recharged.

3.4 Cache and LCD module

In order to save the working time of the PC, the TMS44400 dynamic memory is used to expand the dynamic storage area when designing, and the header information is first read when transmitting data to determine whether it is real-time transmission or buffer operation. MSP430F449 has a liquid crystal drive module. The EDS805 liquid crystal Display module of Dongxian Company is used in the design to display the status characteristics of the system, data transmission speed, remaining time, etc. in real time, and it can also carry out power undervoltage alarms.

4 Software design

The core structure of MSP430 adopts the reduced instruction (RSIC) design with highly transparent format. The receiving and sending of CAN information is done automatically by the CAN controller, and the program only needs to read the corresponding data from the corresponding buffer, and then perform the corresponding processing. In this system, the microcontroller enters a low-power sleep state after completing the initialization task, any interrupt can wake it up, and then execute the corresponding interrupt service subroutine. The two interrupt sources of the system are PC serial port transmission and lower computer CAN message reception respectively. The advantage of doing so is to avoid data retransmission caused by data overrun as much as possible. Figure 3 shows the system CAN initialization flow, and Figure 4 shows the sending interrupt service routine flow. Due to space limitations, this article omits the receiving interrupt service program process, which is roughly the opposite of the sending process.

Design of CAN bus interface conversion card based on MSP430 series single-chip microcomputer

Design of CAN bus interface conversion card based on MSP430 series single-chip microcomputer

5 concluding remarks

This article introduces the software and hardware design of CAN bus communication interface conversion card, and hopes to provide some reference and help to designers who study CAN bus applications. The introduced CAN bus communication interface conversion card has a simple structure and strong anti-interference ability, which is very suitable for forming a small and medium-sized distributed measurement and control network. As the devices supporting the CAN protocol continue to increase, the price of CAN devices will be further reduced, and the application in the field of automation will become more and more extensive.

The Links:   BSM100GB120DLCK 1DI480A-055

We will be happy to hear your thoughts

Leave a reply

Enable registration in settings - general
Compare items
  • Total (0)
Compare
0