Introduction
Fieldbus technology has been widely used in industrial control, especially CAN (Control Area Network) bus, which has the advantages of high reliability, low cost and easy implementation, and occupies a large share in the actual engineering application of fieldbus. With the development of bus technology, LIN (Local Interconnect Network) bus is a low-cost serial communication network, whose goal is to provide auxiliary functions for the existing fieldbus control network, especially the bus application in the automobile control network. Therefore, there must be a LIN bus and other bus communication interface implementation. Taking CAN bus as an example, this paper proposes a CAN-LIN gateway design based on AT89C51CC03 single-chip microcomputer.
LIN is a low-cost serial communication network used to control distributed electronic systems in automobiles. The goal of LIN is to provide auxiliary functions for existing automobile networks (such as CAN bus). Therefore, LIN bus is an auxiliary bus network. In situations where CAN bus bandwidth and multi-function are not required, such as communication between smart sensors and brake devices, using LIN bus can greatly save costs. LIN communication is based on SCI (UART) data format, using single master controller/multiple slave device mode, using only one 12V signal bus and a node synchronization clock line without a fixed time reference.
Gateway Hardware Design
The entire gateway module includes six submodules: LIN interface, CAN interface, CAN baud rate setting, LIN baud rate setting, power module, and status light (Figure 1).
Figure 1 System structure block diagram
AT89C51CC03 is an 8-bit microcontroller with built-in CAN controller from Atmel. This design is based on the AT89C51CC03 microcontroller, selects TJA1020 as the LIN bus transceiver, uses the microcontroller UART interface, and selects PCA82C250 as the CAN bus transceiver in the CAN module design part. The specific circuit connection is shown in Figure 2, Figure 3, and Figure 4.
Figure 2 Microcontroller circuit
Figure 3 CAN interface circuit
Figure 4 LIN interface circuit
We designed a 5-bit DIP switch in the circuit. Since the LIN bus and CAN bus transmission are different in different working systems, the software needs to be changed. Therefore, a 5-bit DIP switch is used for baud rate setting in this design, three bits for LIN baud rate setting, and two bits for CAN baud rate setting. At the same time, in order to show the working status of the gateway, a working indicator light is specially designed. It flashes at a certain frequency when receiving and sending signals. When a fault occurs, the two lights are lit at the same time.
To enhance the anti-interference capability of CAN nodes, the TXDC and RXDC pins of the microcontroller are not directly connected to the TXD and RXD pins of the PCA82C250AT, but are connected through the high-speed optocoupler 6N137 (Figure 3). This achieves good electrical isolation between nodes on the bus. The two power supplies VCC and VDD used in the optocoupler circuit must be completely isolated, otherwise the use of optocouplers will lose its meaning.
Gateway software design
The gateway software design mainly includes the main control program module, CAN module software design and LIN module software design. The CAN module software design mainly has three sub-functions, one is CAN initialization CAN_INIT(), and the other two are CAN_RE_ISR() and CAN_SEND(). CAN_INIT() is mainly used to set the CAN communication baud rate and CAN basic settings. The baud rate can be set according to the value of the dip switch. After the system is powered on, it will automatically scan through the self-test program, check the pre-set baud rate table, and set the CAN communication baud rate.
CAN_RE_ISR() is responsible for information reception and processing, and CAN_SEND() is responsible for information sending.
The LIN module software design mainly includes several files: LIN.H, LIN.C, TEMR0.H TEMRO.C, where LIN.H and LIN.C respectively implement LIN specification settings, UART baud rate settings, and LIN information reception and transmission, and TEMR0.H TEMRO.C is used to generate the LIN bus baud rate. The main control program design mainly completes the entire gateway information forwarding function. When a CAN receive interrupt occurs, the LIN send flag is set to prepare to forward the CAN information to the LIN network; similarly, when a LIN receive interrupt occurs, the CAN send flag is set to prepare to send LIN information to the CAN network. [page]
The entire software is written in C51 and debugged using KEIL's simulation software. Finally, the complete program is burned into the AT89C51CC01 flash space.
Conclusion
This paper proposes a CAN-LIN gateway design based on AT89C51CC01 single-chip microcomputer, which solves the problem of information transmission between CAN bus control network and LIN bus control network in field bus control, and provides a basis for flexible application of field bus. This design has been tested on site, and the experimental results show that the gateway runs well, works reliably and stably, and has been applied to actual work.
Previous article:Design of multifunctional electronic password lock based on AT89S51
Next article:Wireless identification device system based on 51 single chip microcomputer
Recommended ReadingLatest update time:2024-11-16 17:37
- Popular Resources
- Popular amplifiers
- 西门子S7-12001500 PLC SCL语言编程从入门到精通 (北岛李工)
- Siemens Motion Control Technology and Engineering Applications (Tongxue, edited by Wu Xiaojun)
- New Energy Vehicle Control System Inspection and Maintenance (Edited by Bao Pili)
- Detailed explanation of big data technology system: principles, architecture and practice (Dong Xicheng)
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
- [Iprober 520 current probe] Calibration and use in PCB mode
- A brief history of hard disk interface evolution
- Hot plug and unplug
- EEWORLD University ---- STM32CubeMX and STM32Cube HAL basics
- [TI mmWave Radar Evaluation]_3_AWR1843BOOST Corridor Ranging Test Environment
- What is the relationship between the Internet of Things and embedded systems?
- [NXP Rapid IoT Review] + Mobile Synchronizer
- How to use ATA-L series underwater acoustic power amplifier?
- Live broadcast at 10 am today [Infineon Smart Door Lock Solution]
- [GD32E231 DIY Contest] Getting Started