Design a vehicle-mounted CAN bus fault diagnosis instrument based on 2.4G radio frequency, introduce its working principle and system hardware circuit in detail, and finally explain the software modules of the receiving end, transmitting end and PC end respectively.
The solution uses the 2.4G air protocol with automatic frequency hopping. The bit error rate is kept within the effective range after testing and statistics, and it can still work normally within 14m. USB is used as the receiving end and PC interface to ensure the plug-and-play of the system and high-speed data transmission.
Controller Area Network (CAN) provides a unified data exchange channel for various complex electronic devices, controllers, measuring instruments, etc. inside the car, and has been widely used. At present, most automotive components provide CAN bus communication interfaces.
CAN bus technology is used in today's mid-range and high-end cars. Aiming at the faults that may occur in the vehicle CAN bus, this paper proposes a design scheme for a vehicle CAN bus fault diagnosis instrument based on the fault code specified by the KWP2000 application layer, combining the advantages of radio frequency and USB. This scheme is low-cost, easy to carry, and has strong flexibility and adaptability.
1. Solution design
Due to the use of radio frequency technology, the car CAN bus data acquisition part and the CAN bus data diagnosis part can be separated, without the need for wiring, not limited by space, and easy to install and carry. According to relevant ISO standards, the CAN bus transmission rate can reach up to 1 Mbps; but due to the special environment inside the car, the vehicle-mounted CAN bus rate is generally 250 kbps. The radio frequency rate of this system can reach up to 1 Mbps, which can well meet the data transmission requirements.
The transmitting end uses USB as the receiving module and PC interface. Compared with RS232 or PCI interface, USB has the advantages of user convenience, automatic device identification, automatic installation of drivers and configuration, support for dynamic access and dynamic configuration, etc. Its transmission rate can reach tens of Mbps, and it supports synchronous and asynchronous transmission modes, ensuring bandwidth and low transmission distortion.
The PC application layer software integrates the application layer protocol of KWP2000. KWP2000 is a vehicle fault diagnosis protocol developed by Sweden, which has been widely used in microcomputer-controlled automatic transmissions, anti-lock braking systems, airbags, and cruise systems. It is based on the OSI seven-layer protocol and complies with the IS07498 standard. Layers 1 to 6 implement the functions of communication services, and layer 7 implements the functions of diagnostic services. Its application layer proposes a complete and standardized set of diagnostic codes. This system uses the application layer protocol of KWP2000 to analyze the collected CAN bus data to realize the function of fault diagnosis.
2. Hardware Implementation
2.1 Introduction to the chips used in the system
2.1.1 nRF2401 chip
nRF240l is a single-chip RF transceiver chip that operates in the 2.4-2.5GHz ISM band. It has built-in frequency synthesizer, power amplifier, crystal oscillator, modulator and standard SPI functional modules. The output power and communication channel can be configured through software. There are 125 channels available, and the maximum rate can reach 1 Mbps. The chip has a wide operating voltage of 1.9-3.6 V and very low operating energy consumption. When transmitting at a power of -5 dBm, the operating current is only 10.5 mA; when receiving, the operating current is only 18 mA.
nRF240l has 4 working modes: transceiver mode, configuration mode, idle mode, and shutdown mode. Its working mode is determined by the three pins PWR_UP, CE, and CS and the lowest bit TX_EN of the configuration byte.
The transceiver mode is divided into DirectMode and ShockBurst. The former does not process the signal in any way in the chip, which is the same as other RF transceivers. The latter uses the on-chip FIFO stack, and the data is sent in from the MCU at a low speed, but transmitted at a high speed, and all high-speed signal processing related to the RF protocol is performed in the chip. For example, nRF240l automatically processes the header and CRC check code in the ShockBurst transceiver mode, and automatically removes the packet header and CRC check code when receiving; it automatically adds the header and CRC check code when sending data.
2.1.2 TMU3100 chip
TMU3100 is a RISC core microcontroller launched by Taiwan Tenx in 2005. It embeds a USB controller that is fully compatible with the USB1.1 protocol and provides a low-speed USB interface and three endpoints, including one control input/output endpoint and two interrupt input endpoints.
TMU3100 can be configured as a standard HID class and can use the HID class driver that comes with the Windows operating system. This saves the work of developing device drivers and shortens the development cycle. The TMU3100 chip structure is shown in Figure 2.
2.1.3 PIC18F2682 chip
PICl8F2682 is a new 8-bit low-power CAN microcontroller launched by Microchip. Its main resources include: built-in standard CAN module, 80KB flash program memory, 1 KB data E2PROM, 3.3 KBRAM memory, 8-channel ADC, 1 8-bit and 3 16-bit T1MER, 1 SPI and I2C serial communication port, and programmable brown-out reset function and low voltage detection circuit.
PIC18F2682 has an enhanced CAN bus module built in, which includes a CAN protocol engine, message buffering, and message control. The CAN protocol engine automatically processes all messages received and sent on the CAN bus, and it can parse data frames when receiving or sending messages. You only need to set the appropriate registers first to send information, and the status of information transmission can be obtained through the relevant registers.
2.2 Hardware Circuit
2.2.1 Transmitter circuit principle
This is the circuit principle of the system transmitter. The CAN bus interface uses the PIC18F2682 microcontroller with built-in CAN module from Microchip, and the bus is isolated by the optical coupler 6N137; the CAN bus transceiver uses MCP2551.
The communication between PIC18F2682 and RF chip nRF2401 is completed through the standard SPI interface SCK, SDI, SDO, which can greatly improve the transmission rate. The configuration control enable CS and the receive and transmit enable CE of nRF2401 are controlled by RB4 and RB5 respectively. When nRF2401 receives a data packet, DR1 will be set to a high level, so PIC18F2682 can determine whether the data is received by querying the status of INT0.
2.2.2 Principle of receiving circuit
Since TMU3100 is powered by PC and the voltage VDD provided by the USB interface of PC has large interference, VDD is π-filtered.
Since TMU3100 does not have
SPI module, so it can communicate with the SPI port of nRF2401 through PB[1] and PB[0] according to the SPI protocol. The configuration control enable CS and the receive and transmit enable CE of nRF2401 are controlled by KSO[3] and KSO[13] respectively. After nRF2401 receives the data packet, DR1 will be set to a high level, so TMU3100 can determine whether the data is received by querying the status of KS16.
3. Software Design
The system's software design includes transmitter software design, receiver software design and PC software design.
3.1 Transmitter software design
The transmitter process is shown in Figure 5. The software design mainly realizes two functions: the first is to realize the collection of data on the CAN bus; the second is to realize the transmission of the collected data through radio frequency.
After power-on, the CAN module is initialized first. Then the nRF2101 is initialized and a connection is established with the receiving end. When no ACK signal is received after sending CAN data, the frequency is hopped; then the sending end is notified to prepare to receive the retransmitted CAN data until an ACK signal is received.
In order to prevent air interference, an automatic frequency hopping air protocol is adopted, that is, frequency hopping is performed regardless of whether an ACK signal is received. Therefore, strong interference in a certain frequency band can be prevented, thereby reducing the bit error rate.
3.2 Receiver Software Design
The software flow of the receiving end is shown in Figure 6. The software design mainly implements two functions: the first is to realize enumeration; the second is to realize uploading the received data to the PC via USB. After power-on, first complete the configuration of TMU3100 and enumerate with the PC; after the enumeration is successful, configure nRF2401 and establish a connection with the transmitter. When a data packet is received, first determine whether it is CAN data or a retransmission data command. If it is a CAN data packet, return an ACK signal to the transmitter and hop the frequency, and then transfer the received data to the PC via USB; if it is a retransmission command, first hop the frequency, and then set the retransmission flag, indicating that the next data packet is a retransmission data packet.
TMU3100 is configured as a standard HID class, so you do not need to develop a driver for the device, but instead use the standard HID class driver provided by Windows.
3.3 PC software design
The PC software consists of application programs and device drivers. Windows provides a complete built-in driver for standard USB devices. This system uses the Windows built-in HID class driver. As long as the TMU3100 is configured as the HID class, it can complete the communication with the PC. This eliminates the need to develop device drivers and greatly simplifies the development of the host computer software.
Previous article:Design of car light node based on μPD780822 single chip microcomputer and CAN bus module
Next article:Using MCU, CAN controller and transceiver to realize intelligent node of fuel cell vehicle air conditioner
Recommended ReadingLatest update time:2024-11-16 10:14
- Popular Resources
- Popular amplifiers
- Radio Frequency Identification (RFID) System Technology and Application (Written by Ci Xinxin, Wang Subin, and Wang Shuo)
- Virtualization Technology Practice Guide - High-efficiency and low-cost solutions for small and medium-sized enterprises (Wang Chunhai)
- usb_host_device_code
- Image acquisition and processing system for panoramic map applications
- Huawei's Strategic Department Director Gai Gang: The cumulative installed base of open source Euler operating system exceeds 10 million sets
- Analysis of the application of several common contact parts in high-voltage connectors of new energy vehicles
- Wiring harness durability test and contact voltage drop test method
- Sn-doped CuO nanostructure-based ethanol gas sensor for real-time drunk driving detection in vehicles
- Design considerations for automotive battery wiring harness
- Do you know all the various motors commonly used in automotive electronics?
- What are the functions of the Internet of Vehicles? What are the uses and benefits of the Internet of Vehicles?
- Power Inverter - A critical safety system for electric vehicles
- Analysis of the information security mechanism of AUTOSAR, the automotive embedded software framework
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
- Submit your idea, experience MPS products or evaluation boards for free, and win a backpack, Bluetooth wireless headset, and 10,000 yuan in cash!
- Microchip Spring Sale, popular development tools up to 60% off!
- The 3 big benefits of the start of the Year of the Tiger are brought to you by Murata Tmall flagship store
- Power supply obstacles + small mistakes in charging management
- [NXP Rapid IoT Review] + The mobile APP can finally connect to the kit
- A novice asks for advice, how can a switching power supply achieve a regulated output without using a 431?
- MSP430F5438+DTH11 Example Code
- [Project source code] Altera Altium format device library and package including Cyclone V
- 【Qinheng RISC-V core CH582】Upgrade program via Bluetooth
- Several parameter issues of audio playback equipment