1 Introduction
Controller Area Network (CAN) is a serial communication protocol developed by Mercedes-Benz in Germany in the 1980s to solve the data exchange between many automotive control devices and instruments. As a field bus, it is widely used in various industrial sites, and works in master-slave mode or multi-master mode according to different needs. The communication medium used by the CAN bus is twisted pair or other cables, and the transmission rate can reach 1Mb/s. There are two differences between the 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 message according to the identifier reflecting the nature of the data in the message, and accepts the messages that should be received and discards the messages that should not be received. Its advantages are that it can be online and offline, plug-and-play, and multi-station receiving; second, it particularly strengthens the attention to data security to meet 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 particularly suitable for the interconnection of industrial field monitoring equipment.
2 System Introduction
CAN bus adopts bus network topology, as shown in Figure 1. Using the CAN bus's unique multi-master transmission method, each extension will actively send data when it needs it, without the need for the host to constantly poll, thereby saving data traffic on the network and improving transmission efficiency.
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. The conversion card can use a lithium battery as the power supply, with low power consumption, small size and light weight, which can meet the portable needs.
3 System Hardware Structure Design
Texas Instruments' MSP430 series microcontroller 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, a 16-bit CPU, integrated registers and constant generators. The MSP430 series ultra-low power microcontroller is an ideal microcontroller for industrial control, digital motor control, handheld instruments and other equipment. This design uses the MSP430F449 microcontroller, which has a wealth of on-chip modules: up to 8 12-bit A/D converters, 48 I/O ports, 2 UART watchdogs, 2 built-in 16-bit timers, Flash memory that can be simulated online, 7-way PWM output, LCD driver, etc.
The electrical structure principle block diagram of the portable CAN bus interface conversion card is shown in Figure 2. It consists of a power module, a CAN communication interface circuit, a serial port level conversion circuit, a cache and an LCD module.
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 a substitute for Philips Semiconductor PCA82C200 CAN controller (Basic CAN). SJA1000 connected by a simple bus can complete all the functions of the physical layer and data link layer of the CAN bus. SJA1000 consists of CAN core module, send buffer, interface FIFO, acceptance filter and interface management logic. The CAN core module is mainly responsible for the transmission and reception of CAN information frames and the implementation of CAN protocol, and the interface management logic is responsible for the interface between SJA1000 and the main controller. When transmitting data, the main controller sends the identifier and data into the send buffer and requests to send, thereby starting the CAN core module to read the data in the send buffer, and then encapsulates it into a complete CAN information frame according to the CAN protocol, and sends it to the bus through the transceiver. The capacity of the send buffer is 13 bytes. The acceptance filter unit processes the received information and sends it to the receive FIFO. The receive 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 differential signals to the bus. The transceiver can select three different operating modes depending on the different connections of pin 8 (RS): high speed, slope control, and standby mode. The slope of the bus can be controlled by connecting the resistor to the ground through the RS pin, and the slope is proportional to the current output on the RS pin. For applications with high transmission rate requirements, pin 8 is usually directly connected to the ground to select the high-speed mode. In this mode, the transmitter output transistor is simply turned on and off as fast as possible, and no measures are taken to limit the rising and falling slopes, so shielded cables must be used to avoid radio frequency interference. The transmit and receive ports of the CAN controller are connected to the PCA82C250 through an optoelectronic isolation circuit, which effectively suppresses the interference introduced by the bus
.
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. The RS232 and RS485 serial port level conversion modules are 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 supplies such as small transformers to meet the needs of different occasions. TPS7333 is selected as the regulated power supply of MSP430F449 to output a 3.3V system power supply voltage. To ensure normal data transmission, the power supply circuit is also equipped with a bq24012 battery charging management circuit to promptly alarm when the battery power is low and may affect normal data transmission, reminding you to replace the battery or charge it.
3.4 Cache and LCD module
In order to save the working time of PC, TMS44400 dynamic memory is used to expand the dynamic storage interval during design. When transmitting data, the header information is read first to determine whether it is real-time transmission or cache operation. MSP430F449 has a liquid crystal driver module. The EDS805 liquid crystal display module of Dongxian Company is selected in the design to display the system status characteristics, data transmission speed, remaining time, etc. in real time. It can also provide power undervoltage alarm.
4 Software Design
The core structure of MSP430 adopts the reduced instruction set (RSIC) design with a highly transparent format. The reception and transmission of CAN information are automatically completed by the CAN controller. 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 execute the corresponding interrupt service subroutine. The two interrupt sources of the system are PC serial port transmission and lower computer CAN information reception. The advantage of this is to avoid data retransmission caused by data exceeding the limit as much as possible. Figure 3 shows the system CAN initialization process, and Figure 4 shows the transmission interrupt service program process. Due to space constraints, this article omits the reception interrupt service program process, and its process is roughly the opposite of the transmission process.
5 Conclusion
This article introduces the software and hardware design of the CAN bus communication interface conversion card, hoping to provide some reference and help for designers studying CAN bus applications. The CAN bus communication interface conversion card introduced has a simple structure and strong anti-interference ability, and is very suitable for forming small and medium-sized distributed measurement and control networks. As the number of devices supporting the CAN protocol continues to increase, the price of CAN devices will further decrease, and their application in the field of automation will become more and more extensive.
Previous article:Grayscale image chaos secure communication based on single chip microcomputer
Next article:Design and implementation of digital controlled DC voltage regulated power supply based on single chip microcomputer
Recommended ReadingLatest update time:2024-11-16 19:31
- Popular Resources
- Popular amplifiers
Professor at Beihang University, dedicated to promoting microcontrollers and embedded systems for over 20 years.
- Innolux's intelligent steer-by-wire solution makes cars smarter and safer
- 8051 MCU - Parity Check
- How to efficiently balance the sensitivity of tactile sensing interfaces
- What should I do if the servo motor shakes? What causes the servo motor to shake quickly?
- 【Brushless Motor】Analysis of three-phase BLDC motor and sharing of two popular development boards
- Midea Industrial Technology's subsidiaries Clou Electronics and Hekang New Energy jointly appeared at the Munich Battery Energy Storage Exhibition and Solar Energy Exhibition
- Guoxin Sichen | Application of ferroelectric memory PB85RS2MC in power battery management, with a capacity of 2M
- Analysis of common faults of frequency converter
- In a head-on competition with Qualcomm, what kind of cockpit products has Intel come up with?
- Dalian Rongke's all-vanadium liquid flow battery energy storage equipment industrialization project has entered the sprint stage before production
- Allegro MicroSystems Introduces Advanced Magnetic and Inductive Position Sensing Solutions at Electronica 2024
- Car key in the left hand, liveness detection radar in the right hand, UWB is imperative for cars!
- After a decade of rapid development, domestic CIS has entered the market
- Aegis Dagger Battery + Thor EM-i Super Hybrid, Geely New Energy has thrown out two "king bombs"
- A brief discussion on functional safety - fault, error, and failure
- In the smart car 2.0 cycle, these core industry chains are facing major opportunities!
- The United States and Japan are developing new batteries. CATL faces challenges? How should China's new energy battery industry respond?
- Murata launches high-precision 6-axis inertial sensor for automobiles
- Ford patents pre-charge alarm to help save costs and respond to emergencies
- New real-time microcontroller system from Texas Instruments enables smarter processing in automotive and industrial applications
- [RVB2601 creative application development] + light intensity detection
- 【DIY Creative LED】Effect Demonstration
- [GD32450I-EVAL] USART and DMA variable length reception
- ESP32-S3 Technical Reference Manual Latest Manual
- 【DSP】TMS320F28035 ADC routine (software trigger + query)
- Ask for help either
- STEVAL-MKI109V3 Unico-GUI cannot connect, prompting The adapter board has not been recognized
- [Xianji HPM6750 Review] +LVGL modified the touch screen, but failed, there was a problem with the touch
- 【GD32L233C-START review】+ external LCD screen debugging
- Leisure