Design and implementation of bus CAN bus lighting node based on μPD780822 single chip microcomputer

Publisher:InspiredDreamerLatest update time:2012-01-14 Keywords:MCU Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

1 Introduction
CAN (Controller Area Network) was first proposed by Bosch of Germany. It is the most popular and commonly used bus in the automotive controller area network. Its main features are: CAN bus is a multi-master bus. Each node can actively send information to other nodes on the network at any time, regardless of master and slave, and the communication is flexible; CAN bus adopts a unique non-destructive bus arbitration technology. The node with high priority transmits data first, which can meet the real-time requirements; CAN bus has the functions of point-to-point, point-to-multipoint and global broadcast data transmission; The number of valid bytes per frame on the CAN bus is up to 8, and there are CRC and other verification measures. The data error rate is extremely low. If a node has a serious error, it can automatically leave the bus, and other operations on the bus will not be affected; CAN bus has only two wires. When the system is expanded, the new node can be directly hung on the bus, so there are fewer wires, the system is easy to expand, and the modification is flexible; CAN bus has a fast transmission speed. When the transmission distance is less than 40 m, the maximum transmission rate can reach 1 Mb/s. The application of CAN bus can not only simplify the wiring harness, realize sensor sharing, and reduce system costs, but also greatly reduce the failure rate of vehicles. The application of CAN bus in automobiles is the development trend of modern automobile technology.

2 Application of CAN bus in automobiles
At present, the network connection in automobiles mainly adopts two CAN buses, one is the high-speed CAN bus of the drive system, with a rate of 500 kb/s, and the other is the low-speed CAN bus of the body system, with a rate of 100 kb/s. The main connection objects of the CAN of the drive system are the engine controller (ECU), ASR and ABS controller, airbag controller, instrument cluster, etc., which have the same basic characteristics and control systems directly related to the driving of the car. The main connection objects of the CAN of the body system are the central control door locks, electric windows, rearview mirrors and interior lighting of cars with more than 4 doors. In addition to the above two CAN buses, some advanced cars will also have a third CAN bus, and its main connection object is satellite navigation and intelligent communication system.
In foreign countries, especially in Europe, CAN has become an indispensable device in modern automobiles. CAN bus technology is becoming more and more mature and its application is becoming more and more extensive. Mercedes-Benz, BMW, Volkswagen, Volvo, Renault and other cars all use CAN as the controller networking technology. Domestic research on CAN bus has just started, and there has been no successful application so far. However, my country attaches great importance to the research and development of vehicle local area network bus technology. Recently, relevant national departments have made clear regulations on the application of CAN bus in luxury buses. I believe that the introduction of this policy will greatly promote the research, development and application of automotive CAN bus by related enterprises and scientific research institutions. This article discusses the design of headlight node in the CAN bus system of bus body, which belongs to the node design on low-speed CAN bus.

3 Microcontroller and its CAN bus module
NEC is the world's second largest automotive microcontroller manufacturer after Freescale. Due to its late promotion in China, domestic companies do not use it much. The CAN bus module is a peripheral of the μPD780822 microcontroller and is a complete CAN controller. It can meet the requirements of the vehicle body CAN bus network. In addition to the basic functions of CAN, it also includes some unique functions, such as time synchronization, programmable CAN bus wake-up and CPU wake-up functions, and programmable bus shutdown sending bottom reset function. Access to the CAN bus is divided into access to the control/status register and access to the send/receive buffer.
The information frames sent by the CAN controller are divided into two types: sending data frames and sending remote frames. There are two send buffers, one of which is 16 bytes and the other is 8 bytes. The 16-byte buffer can store data frames in two formats: standard frame and extended frame, and the 8-byte buffer can be used to store data to be sent. When sending a data frame, after the data is written to the send buffer, if the corresponding send request bit is enabled, the data is sent to the CAN bus, and the data of the data frame can be set to 1 to 8 bytes by software. The format of the data frame is shown in Figure 1.

When the CAN controller receives information, it must first compare the identifier of the received information with the identifier of the corresponding buffer. Only information with the same identifier can be received. The CAN module of the μPD780822 microcontroller has two independent transmit buffers. The two buffers share a 16-byte data area to store CAN frames with a maximum of 8 bytes of data. The structure of the transmit area and the receive area is similar. When the flag bit and control bit are not set to CAN-specific, the CPU can use it as a normal data storage area.
The controller has 16 receive buffers. The buffer area used when receiving information frames is determined by the information quantity register (MCNT). The information received from the bus is directly stored in the transmit buffer. The receive buffer that is not used during operation can be used by the CPU as a normal RAM. Each receive buffer has its own programmable interrupt enable bit.

4 Network structure and nodes
The bus body CAN system includes the master control node, lighting node, air conditioning node, door node and instrument node, as shown in Figure 2. Among them, the front light node control includes 16 control units, including the front left and right clearance lights, front left and right position lights, front left and right distress warning lights, front left and right parking lights, left and right headlights, high beams, left and right headlights, low beams, front left and right fog lights and front left and right turn lights. The rear light node control includes 12 control units, including the rear left and right clearance lights, rear left and right turn lights, rear left and right brake lights, rear left and right position lights, rear left and right fog lights and rear left and right reverse lights. The master control node mainly receives some switch input signals from the driver. The instrument node mainly controls the direction, water temperature, oil pressure, brake, door, light, ABS/ARS and defrost indicators and control instruments by receiving data on the bus to display the values ​​of vehicle speed, engine speed, water temperature, fuel, oil, voltage, stepper motor, etc. The air conditioning node controls the air conditioning switch and the setting of the interior temperature. The door and rearview mirror node controls the door solenoid valve switch, rearview mirror adjustment switch and rearview mirror heating switch. The safety node monitors the power supply of ABS and ECAS.

5 Hardware Circuit Design
The hardware structure of the lighting node is shown in Figure 3, which includes a lighting control module and a CAN interface module. The lighting control module consists of a TLP521-4 optoelectronic isolator and BTS442 and BTS740 intelligent switches. TLP521-4 is a 4-way optoelectronic isolator. Eight TLP521-4s form 32-way optoelectronic isolation, connecting the signals transmitted to the switch and the switch feedback to the microcontroller. BTS442 is a single-channel output intelligent switch (PROFET) produced by Infineon. It has the advantages of allowing larger transient currents (above 140 A) and a wider temperature range (-55℃~+150℃). Six BTS442s form a 6-way control switch to control six high-current loads such as headlights and fog lights. BTS740 is a 4-way output intelligent switch produced by Infineon. The two outputs are combined into one to pass a larger transient current. Five BTS740s form a 10-way control switch to control the remaining low-current loads. Both BTS442 and BTS740 have diagnostic feedback functions. If an error occurs, a low-level signal will appear on the 4th pin of BTS442 and the 4th and 8th pins of BTS740. The signal is connected to the microcontroller through the optoelectronic isolator to realize the endpoint detection function and feedback to the instrument node through the CAN information frame. The hardware CAN interface module of all nodes is the same, including the light node. Since this microcontroller has a CAN bus module, a special CAN controller is not required. The microcontroller does not have a CAN transceiver and needs an external 82C250 transceiver, with a 6N137 optoelectronic isolator in the middle. The hardware interface circuit of the microcontroller, optoelectronic isolator and CAN transceiver is shown in Figure 4.

6 Node software design
The node software flow is shown in Figure 5. The program adopts the query mode. After the node is initialized and reports normal operation, it will remain in the query state until the light control command sent by the master node reaches the light node. The microcontroller can then determine which light or lights are controlled, and detect whether the corresponding switch is normal through the switch diagnostic feedback function. If normal, the corresponding control command is sent to the corresponding high/low end switch, and then returns to the query state. If abnormal, the abnormal information frame of the corresponding endpoint is sent to the instrument node, and the corresponding endpoint is continued to be detected.
Node initialization is mainly microcontroller initialization, including port initialization and CAN control module initialization. Microcontroller port initialization mainly resets the used I/O port. CAN module initialization is mainly to set the special function registers used, mainly including protocol mode, acceptance filter mode, CAN communication rate and interrupt register settings. Write the acceptance code and acceptance mask code into the acceptance code register and acceptance mask register.
The software design of the CAN bus mainly includes the initialization of the CAN node, the data sending and receiving program. Mastering the design of these three modules basically completes the software design of CAN communication.


7 Conclusion
Although this node is designed to control bus lights, it can also serve as a reference for some other nodes, especially the hardware interface part of the CAN bus, which can be used on other CAN network nodes of buses, and can even be used on CAN networks in other non-automotive fields, such as industrial automation.

Keywords:MCU Reference address:Design and implementation of bus CAN bus lighting node based on μPD780822 single chip microcomputer

Previous article:Multi-channel Data Acquisition System Based on MSCl210Y5
Next article:Research on the synchronization of data flow in SPI communication of single chip microcomputer

Recommended ReadingLatest update time:2024-11-16 18:09

An ISD4004 voice chip application circuit based on single-chip microcomputer control
1 Introduction The ISD4004 voice chip is a new product recently launched by the American ISD company. As the pin description and internal circuit of the voice chip can be easily found in the chip data provided by ISD, I will not describe it in detail in this article. I will only briefly introduce its characteris
[Microcontroller]
An ISD4004 voice chip application circuit based on single-chip microcomputer control
Does the timer of the microcontroller still count in the interrupt function?
Take stm32F103 as an example to explain: if the initialization configuration is to automatically reload the initial value (the third bit in register TIMx- CR1 defaults to the counter not stopping when an update event occurs, and can be set to 1 by software to manually start the counter), then the next round of countin
[Microcontroller]
The automotive-grade MCU market is dominated by three major players, with the domestic production rate less than 10%
In recent years, many Chinese manufacturers have entered the field of mid- and low-end automotive MCUs that have little relevance to safety performance. Preface: ICInsights predicts that from 2021 to 2026, the global MCU market size will have a compound growth rate of approximately 6.7%, reaching US$27.2 billio
[Embedded]
The automotive-grade MCU market is dominated by three major players, with the domestic production rate less than 10%
STC microcontroller programming software installation
STC microcontroller is a microcontroller based on the C51 core independently developed by Hongjing Technology and is widely used in China. Based on the traditional C51 microcontroller, STC's performance design has been greatly improved. It has superior performance and relatively low price, and has been loved by many c
[Microcontroller]
C language programming of DS1302 digital tube time display based on AVR microcontroller
#include #include #define uchar unsigned char #define uint unsigned int #include "DS1302_drive.h" uchar K1_FLAG=0; //Define the key flag. When the K1 key is pressed, this position is 1. When the K1 key is not pressed, this position is 0. uchar const bit_tab ={0xfe,0xfd,0xfb,0xf7,0xef,0xdf,0xbf,0x7f}; //Bit sele
[Microcontroller]
PIC microcontroller drives TM1616 source program
/*This program is suitable for adding SIP sending function to MCU without SIP function*/ #include pic.h __CONFIG(0x1832);         //Chip configuration word, watchdog off, power-on delay on, power-off detection off, low voltage programming off, encryption, 4M crystal HS oscillation #define clk P10 //Define the clock
[Microcontroller]
Summary of MCU key learning
Basic key program structure analysis:  1 void key_scan(void)  2 {  3 if (!key) //Check if the key is pressed  4       {  5 delay_ms(20); //delay debounce, usually 20ms  6           if(!key)  7           {  8                ......  9           } 10 while (!key); //Wait for the key to be released 11      }        12 }
[Microcontroller]
Design of short message receiving and sending system based on AT89C52 single chip microcomputer
0 Introduction The GSM (Global System for Mobile communication) system is a relatively mature, complete and widely used system in the current mobile communication system based on time division multiple access technology. The GSM digital cellular mobile communication network that has been built to cover the whol
[Microcontroller]
Design of short message receiving and sending system based on AT89C52 single chip microcomputer
Latest Microcontroller Articles
  • Download from the Internet--ARM Getting Started Notes
    A brief introduction: From today on, the ARM notebook of the rookie is open, and it can be regarded as a place to store these notes. Why publish it? Maybe you are interested in it. In fact, the reason for these notes is ...
  • Learn ARM development(22)
    Turning off and on interrupts Interrupts are an efficient dialogue mechanism, but sometimes you don't want to interrupt the program while it is running. For example, when you are printing something, the program suddenly interrupts and another ...
  • Learn ARM development(21)
    First, declare the task pointer, because it will be used later. Task pointer volatile TASK_TCB* volatile g_pCurrentTask = NULL;volatile TASK_TCB* vol ...
  • Learn ARM development(20)
    With the previous Tick interrupt, the basic task switching conditions are ready. However, this "easterly" is also difficult to understand. Only through continuous practice can we understand it. ...
  • Learn ARM development(19)
    After many days of hard work, I finally got the interrupt working. But in order to allow RTOS to use timer interrupts, what kind of interrupts can be implemented in S3C44B0? There are two methods in S3C44B0. ...
  • Learn ARM development(14)
  • Learn ARM development(15)
  • Learn ARM development(16)
  • Learn ARM development(17)
Change More Related Popular Components

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

About Us Customer Service Contact Information Datasheet Sitemap LatestNews


Room 1530, 15th Floor, Building B, No.18 Zhongguancun Street, Haidian District, Beijing, Postal Code: 100190 China Telephone: 008610 8235 0740

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京ICP证060456号 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号