The Design of CAN Bus Communication Based on STM32
- Author
- KangXueLin
- Advisor
- HuangYongPing
- School
- Jilin University
- Major
- Software Engineering
- Classification
- TP273.5 Computer control, computer control system
- Degree
- Master's thesis
- Year
- 2013
- Downloads
- 185
- Citations
- 0
Abstract
Distributed industrial control system is one of the most dynamic part in the field ofindustrial control.Depending on the fast developed technology of computer hardware andsoftware and progress of integrated circuit technique,Distributed industrial control systemhas achieved rapid development in the field of industrial control area.The diversity ofcontrol and diversification of system enhance the demand on system reliability andflexibility.A typical distributed control system includes field devices, interface, computingequipments, and communications equipments. Communication demand of industrial controlsystem is becoming more and more important,no matter in industrial automation field,ormedical instruments and Transportation construction field.CAN—Controller Area Network is a multi-master network which created byBOSCH.Cause it satisfied high requirements of the system on the flexibility andreliability,it quickly becomes the most promising bus in public.First CAN was created tosolve the data exchange problem between controllers and test instruments.CAN has manymasters,provides the possibility that each node communicate with others as ahost.Communication medium can be twisted pair,coaxial cable and optical fiber.The biggest characteristic of the CAN protocol is encoding communication datablock,abolishing the traditional station address coding,its communication rate can be up to1MB/s.So that we can make the network node number not limited theoretically.CRC checkfunction of CAN ensures the reliability of data communication. The length of data is up toeight data bytes.While guaranteed the length of control command,it also ensures improvedthe real-time communication and won’t take too long bus time at the same time.Thearbitration mechanism of CAN protocol guarantees to avoid clash when two units sendmassages at the same time when allots the bus.Due to the high reliability and flexibility of CAN bus protocol,a variety of control chipsof CAN communication system emerge in endlessly.The developed systems are widelyused in detection, monitoring, recording all kinds of signals.Such as automobilecommunication system, temperature humidity test system, etc.Their stable and reliableresults have been achieved in practice.This paper introduces the design of CAN buscommunication system based on STM32.In the numerous32-bit microprocessors,STM32 series is specially designed for embedded applications based on ARM Cortex-M3withthe performance,of rich superior peripheral and widely used in industrial and consumerelectronics products.Using STM32as main control chip to build high-performance, CANbus communication system will be more conducive to meet the requirements of highreliability in the production practice.In this paper, the CAN bus technology is introduced in detail,CAN bus communicationsystem based on STM32is designed and analysised.Recording and summarizing the workof each step, in this paper, the main work has the following contents:1.Introduce the CAN bus technologyThe first step of this article is to work on the CAN bus technology to conduct acomprehensive and meticulous research and learning and made a summary of thecharacteristics of CAN bus technology development.Introduced the layer structure of theCAN protocol, packet format, error and priority arbitration.2.The design of CAN communication systemPut forward the design requirements of the system.To build the basic framework of CANcommunication system based on STM32,including the system structure, hardware designand software design part.The system hardware design part includes:STM32master controlchip performance and the introduction of CAN communication module functions.Systemsoftware design includes: System application development environment, the systeminitialization process, the main program design process, the CAN module initialization andso on.3.Debugging and summaryDebugging of master controller STM32,mainly includes the main controller nodeinitialization and message receiving and sending.Debugging the system, mainly in order toensure that node can accomplish network communication.After the debug and experiment,this system works well, runs stably, satisfying the design standards.It provided a reliabletheoretical and practical basis for the application of CAN bus technology in the field ofindustrial control.
Table of contents
Summary 4-6
Abstract 6-10
Chapter 1 Introduction 10-14
1.1 research background 10 - 11
1.2 domestic and foreign research topics overview 11-12
1.3 CAN bus embedded development 12-13
1.4 thesis work content and structure 13 -14
Chapter 2 CAN bus technology introduced 14-33
2.1 CAN bus basic principle 14-16
2.2 CAN protocol features 16-18
2.3 CAN protocol communication process 18-19
2.4 CAN message format 19-27
2.4.1 data Frame 20 -22
2.4.2 remote frame 22-23
2.4.3 error frame 23-24
2.4.4 overload frame 24-25
2.4.5 frame interval 25-26
2.4.6 priority decision 26-27
2.5 CAN bus error handling mechanism 27 - 31
2.5.1 error Status 28-30
2.5.2 error Detection 30-31
2.6 sync 31-33
2.6.1 synchronization type 31-32
2.6.2 synchronization principle 32-33
Chapter 3 hardware-based STM32 CAN communication design 33-42
3.1 CAN bus topology 33
3.2 CAN bus node hardware configuration 33-34
3.3 CAN line two-node communication 34-42
introduction 3.3.1 STM32 controller 35-37
3.3.2 STM32 CAN communication module 37-39
3.3.3 CAN controller MCP2515 introduction 39-41
3.3.4 Arduino microprocessor introduced 41-42
Chapter 4 software Design based on the STM32 nbsp CAN communication ; 42-49 <br / > Introduction 4.1 development tools 42
4.2 system software design 42-45
4.2.1 system program flow 43-44
4.2. 2 system receives the transmit interrupt handling 44-45
4.3 CAN initialization procedure designed 45-46
4.4 system to send messages procedures 46-47
4.5 system receives the message program 47-49
Chapter 5 experiments and debugging 49-52
5.1 system overall physical map 49-50
5.2 STM32 running the program 50-51
5.3 summarizes 51
5.4 Prospects 51-52
References 52-54 <br / > Thanks 54
Related dissertations
- The Research and Development of Automatic Step Feeding Control System
- Design and Implement of Wood Processing Network Control System Based on Canopen
- The Design of Small Coal Mine Remote Monitoring System Based on ARM
- Research and Development of Froth Flotation Video Surveillance Hardware Platform Based on DSP
- The Research and Design of Embedded Graphic Remote Monitor Terminal
- Design and Research on Fire Detection and Alarm System Based on Multi-sensor Information Fusion Technology
- Design of Industrial Equipment State Wireless Monitoring System Based on STM32
- Research and Realization of Dynamic Simulation Circulating Water Device Control and Data Processing System Based on ARM
- The Design of Data Monitoring and Control System Based on USB and Lab VIEW
- Research on Techniques of Network Topologyandad Hoc Network in Cold Chain Transportation Monitoring System
- The Research and Design of Infrared Sensor Monitoring System Based on STM32
- High-precision In-pipeline Temperature Measurement System Based on STM32
- Design and Implementation of a Cooler of Data Acquisition and Control System Based on STM32
- Design of Steam System Data Acquisition Sub-station
- The Design and Implementation of Integrated Data Acquisiton Instrument Hardware Platform for Gas Station
- The Collection and Storage of Physiological Signals System Based on STM32
- The Research for the Engraving Machine Control System Based on ARM and FPGA
- Research on Solid Materials Storage and Transportation Control System
- Design and Implementation of Control System for Stabilized Platform Based on Embedded System
- Design of Dynamic Pressure Controller Based on μC/OS-Ⅱ