In view of the need for CAN bus communication quality, testing and verification, as well as the complexity of traditional CAN analyzers and the insufficiency of having to use a PC as a display terminal, a design of a CAN bus analyzer based on an ARM microcontroller and a smart phone is demonstrated. The analyzer uses a hardware circuit with an ARM microcontroller as the core to complete real-time data collection and monitoring of the CAN network; it uses Bluetooth communication to achieve communication between the analyzer and the smart phone and uses the smart phone as the terminal to complete data analysis. The article specifically designs the analyzer hardware, software and smart phone page, proposes a new baud rate automatic detection method, and finally gives the actual test results of the designed CAN bus analyzer, which can realize the functions of CAN bus baud rate automatic detection, normal monitoring and CAN bus status analysis.
CAN (controller area network) is a serial data bus with strong real-time performance, good flexibility and high standardization. It is widely used in automotive electronics, industrial automation, ships, medical equipment, industrial equipment and other fields. Its test equipment, CAN network analyzer, has become a must-have for developers. With the help of the easy-to-use CAN bus analyzer, it is possible to quickly find the design problems or abnormal interference problems in the CAN bus system during use, and eliminate the faults and problems.
Traditional CAN analyzers require the computer to be connected to the CAN analyzer via USB, and then the bus to be tested is connected to the CAN analyzer via the DB9 interface. Since the CAN bus is a popular field bus in the vehicle industry, such a debugging method is not very convenient for vehicles that need to be road tested, and it is difficult to ensure normal operation. Similarly, in the field of industrial control, the traditional CAN analyzer may cause some confusion in industrial sites with many wiring harnesses because both ends have wires. In addition, in order to ensure safety, today's equipment using the CAN bus sometimes has more than one bus. Traditional analyzers have at most two interfaces, which means that if you want to test more than two CAN buses at the same time, you need two USB interfaces. If the two CAN buses are far apart, you need a longer USB cable. For this reason, here is a Bluetooth CAN bus analyzer with low cost, small size, simple structure, wireless debugging and low environmental requirements.
1 Hardware Design
1.1 Overall design
In view of the various shortcomings of traditional CAN analyzers, this paper proposes a new CAN analyzer that uses a smartphone instead of a PC as a display terminal, uses Bluetooth wireless transmission instead of USB cable transmission, and has its own lithium battery. The overall design structure is shown in Figure 1.
Figure 1 Overall design block diagram of Bluetooth CAN analyzer
Since the CAN analyzer is a communication protocol with a high baud rate, and complex calculations are required for communication quality analysis and fault location, the Bluetooth CAN analyzer proposed in this paper includes three parts in the overall design: one part is a processing motherboard with ARM as the processing core, which is responsible for CAN bus baud rate detection, data acquisition and Bluetooth communication signal transmission; the second part is a lithium battery, which is responsible for providing power to the motherboard. The lithium battery voltage is 5V, the capacity is 3000mAh, and the size is 11.6mmX42mm×69ram, which can ensure that the system works for more than 10h; the third part is a smart phone, which is responsible for receiving CAN bus data and processing the data.
1.2 Motherboard Design
There are 4 modules on the mainboard, namely, isolated CAN interface module, ARM processor module, Bluetooth serial port module, and power circuit module. The design block diagram is shown in Figure 2, and the actual picture is shown in Figure 3.
The isolated CAN interface module is responsible for sending the ARM data to the CAN bus and sending the data on the CAN bus to the ARM processor.
Figure 2 Mainboard system design block diagram
Figure 3 Motherboard shopping map
The ARM processor module is the core of this analyzer, using the NXP LPC2119 processor. LPC2119 is based on a 16/32-bit ARM7TDMI-STM CPU that supports real-time simulation and tracing, with 128KB embedded high-speed Flash memory, and internally integrated with 2 CAN controllers. Its main features are: data transmission rate on a single bus up to 1MB/s; 32-bit register and RAM access; compatible with CAN2.0B, IS011898.1 specifications; global acceptance filter can identify all 11-bit and 29-bit identifiers; acceptance filter provides FullCAN-style automatic reception for selected standard identifiers. It is mainly responsible for processing the data on the CAN bus and then sending it to the mobile phone through the Bluetooth serial port. In addition, the ARM module is also responsible for detecting the baud rate on the unknown CAN bus and sending it to the mobile phone.
The Bluetooth serial port module is responsible for exchanging data between ARM and the mobile phone, and the communication rate of its serial port reaches 1382400bps. The power module is responsible for supplying power to each module.
2 Software Design
Software is the key to Bluetooth CAN analyzer. According to the hardware system structure, the software consists of two parts, namely, the baud rate detection and data transmission software running on the ARM processor; and the CAN analyzer operation interface running on the smartphone. For the software running in the ARM processor, this article focuses on introducing a new baud rate automatic detection method.
2.1 Design of baud rate automatic detection software
To achieve communication between the CAN bus and the CAN analyzer, the same baud rate is required, so the baud rate detection is very important. The current mainstream baud rate detection method is a baud rate detection method established using a response mechanism. It starts by listening to some recommended CAN bus preferred baud rates, namely 1Mbit/s, 800kbit/s, 500kbit/s, 250kbit/s, 125kbit/s, (100kbit/s), 50kbit/s, 20kbit/s, 10kbit/sHl: If the complete CAN message can be received without failure, it means that the baud rate detection is successful; if the baud rate of the CAN bus is not the preferred baud rate, the baud rate can be determined by the response of the host and the CAN bus. This detection method is slow, has certain errors and has a certain impact on the network under test.
In view of the shortcomings of the baud rate detection method using the response mechanism, this paper proposes a new automatic baud rate detection method. This automatic baud rate detection system cleverly uses the interrupt port of the ARM processor to record the waveform on the CAN bus into the ARM processor, and then analyzes the obtained waveform to obtain the baud rate of the system. It has a fast detection speed (less than 200ms), accurate detection (the baud rate obtained is an exact value, not a range value), does not send data to the network under test, and has a very low cost and does not require any additional chips.
The specific implementation method is: in terms of hardware, connect the RX pin of the isolated CAN interface to the timer capture port of the ARM. In terms of software, first record the interval period of two adjacent up-jumps and down-jumps of the RX pin; secondly, sort the periodic data, and the data should be in a step-like shape; then divide the data into steps and find the median of each step. The first step is the duration of 1-bit data, the second step is the duration of 2-bit data... and so on. Since the CAN bus will not have the same level for 6 consecutive bits, there are only 5 steps, and the second data is equal to 2 times the first data, the third data is equal to 3 times the first data, and so on. According to this feature, the data can be verified and the duration of the final 1-bit data can be adjusted. The final baud rate is the reciprocal of the 1-bit duration. The flow chart is shown in Figure 4.
Figure 4 Baud rate detection flow chart
2.2 Smartphone interface design
The design of the smartphone interface uses Eclipse. Eclipse is an open-source, Java-based, extensible development platform. It is just a framework and a set of services for building a development environment through plug-in components, and comes with a standard plug-in set, including Java development tools. The mobile phone operation interface is shown in Figures 5 and 6.
Figure 5 Software running interface
3 Experimental verification
In order to verify the design effect of this Bluetooth CAN analyzer, a test system including an ARM-based motherboard, a lithium battery, a smart phone (with Android system installed), and a USB-CAN simulating the system under test was built, and then actual tests were carried out. The test flow chart is shown in Figure 7.
Figure 7 Actual test flow chart
The actual test system is shown in Figure 8. The actual test shows that as long as there is data flow on the simulated CAN bus, for different CAN bus baud rate settings, the Bluetooth CAN analyzer designed in this paper can accurately and quickly automatically detect the baud rate and can realize data reception and transmission.
Figure 8 Actual test system diagram
4 Conclusion
By building a hardware system based on NXP's LPC2119 processor, smartphones, Bluetooth as a means of information transmission and corresponding software design, the baud rate of the CAN bus can be automatically detected and data received and sent, verifying the correctness of the Bluetooth CAN analyzer. The implementation of the Bluetooth CAN analyzer, with its simple operation, easy to carry, and good shock resistance, will provide great convenience for CAN bus development engineers; at the same time, it can be found that by further strengthening the design and optimization of the software, the analyzer can also provide more valuable information about the CAN bus.
Previous article:Fault Analysis of GF-D800 Semi-automatic Biochemical Analyzer
Next article:Design of Power Fiber Signal Analyzer Based on ARM and FPGA
- Popular Resources
- Popular amplifiers
- From probes to power supplies, Tektronix is leading the way in comprehensive innovation in power electronics testing
- Seizing the Opportunities in the Chinese Application Market: NI's Challenges and Answers
- Tektronix Launches Breakthrough Power Measurement Tools to Accelerate Innovation as Global Electrification Accelerates
- Not all oscilloscopes are created equal: Why ADCs and low noise floor matter
- Enable TekHSI high-speed interface function to accelerate the remote transmission of waveform data
- How to measure the quality of soft start thyristor
- How to use a multimeter to judge whether a soft starter is good or bad
- What are the advantages and disadvantages of non-contact temperature sensors?
- In what situations are non-contact temperature sensors widely used?
- LED chemical incompatibility test to see which chemicals LEDs can be used with
- Application of ARM9 hardware coprocessor on WinCE embedded motherboard
- What are the key points for selecting rotor flowmeter?
- LM317 high power charger circuit
- A brief analysis of Embest's application and development of embedded medical devices
- Single-phase RC protection circuit
- stm32 PVD programmable voltage monitor
- Introduction and measurement of edge trigger and level trigger of 51 single chip microcomputer
- Improved design of Linux system software shell protection technology
- What to do if the ABB robot protection device stops
- 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
- From probes to power supplies, Tektronix is leading the way in comprehensive innovation in power electronics testing
- From probes to power supplies, Tektronix is leading the way in comprehensive innovation in power electronics testing
- 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
- Working principle and function of encoder
- 【LuatOS-ESP32】Series Column Preview
- HTS221 temperature and humidity sensor driver has been added to makecode
- Urgently recruiting a development engineer who knows assembly language
- Arrow Electronics Seminar: Intel FPGA Deep Learning Acceleration Technology will be held both online and offline. We look forward to your presence!
- Three safety regulations
- What are the types of triggers? What is the difference between a trigger and a latch? What are the aspects of the latch's locking and storage?
- Android desktop effect simulation based on LVGL
- We dismantled a domestic medical B-ultrasound machine and let's take a look
- 【TI recommended course】#TI millimeter wave radar technology introduction#