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

Publisher:创新驿站Latest update time:2013-03-21 Source: dzscKeywords:MCU Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere
  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, 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 controllers, airbag controllers, instrument clusters, 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 of more than 4 doors, electric windows, rearview mirrors and interior lighting, etc. In addition to the above two CAN buses, some advanced cars will also have a third CAN bus, which is mainly connected to satellite navigation and intelligent communication systems.
   
  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 enterprises 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 function, programmable CAN bus wake-up and CPU wake-up function, programmable bus shutdown send bottom reset function, etc. 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 the 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. [page]

  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 indicator lights and control instruments such as direction, water temperature, oil pressure, brake, door, light, ABS/ARS and defrost 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 switch of the air conditioning and the setting of the temperature in the car. 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 photoelectric isolator and BTS442 and BTS740 intelligent switches.

  TLP521-4 is a 4-way optoelectronic isolator. 8 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 (more than 140 A) and a wider temperature range (-55℃~+150℃). 6 BTS442s form a 6-way control switch to control 6 high-current loads such as headlights and fog lights. BTS740 is a 4-way output intelligent switch produced by Infineon. The 2 outputs are combined into 1 to pass larger transient currents. 5 BTS740s form a 10-way control switch to control the remaining small 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. [page]

  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 being controlled, and detect whether the corresponding switch is normal through the switch's 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 the initialization of the microcontroller, including port initialization and initialization of the CAN control module. The microcontroller port initialization mainly resets the I/O port used. The initialization of the CAN module is mainly to set the special function registers used, mainly including the 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 procedures. Mastering the design of these three modules basically completes the software design of CAN communication.

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

References:

[1]. TLP521-4 datasheet http://www.dzsc.com/datasheet/TLP521-4_652802.html.
[2]. 6N137 datasheet http://www.dzsc.com/datasheet/6N137_91364.html.

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

Previous article:Design of vehicle single chip microcomputer test device based on PSoC
Next article:Design of sound positioning system based on MSP430

Recommended ReadingLatest update time:2024-11-16 22:43

The use and application of STC89 microcontroller watchdog
The concept of "watchdog" and its application in the system composed of single-chip microcomputers. Since the operation of the single-chip microcomputer may be interfered by the external electromagnetic field, causing the program to run away and fall into an infinite loop, the normal operation of the program is interr
[Microcontroller]
LED single light flashing experiment of PIC microcontroller under proteus+MPLAB combination
First put the circuit diagram, pay attention to the selection of capacitors on both sides of the crystal oscillator, and pay attention to the resistance value between the LED and the voltage. The program is: Note that you must include the pic.h file, you must first determine the size of _XTAL_FREQ before using the _
[Microcontroller]
LED single light flashing experiment of PIC microcontroller under proteus+MPLAB combination
PIC microcontroller CAN bus protocol transceiver programming
//This program runs on the PIC microcontroller p18f458 to implement the self-test mode of sending buffer 0 to receiving buffer 0, where receiving uses interrupt mode //Sending uses query mode #include "p18f458.h" int CAN_FLAG; //Define the flag register //**************Initialization subroutine****
[Microcontroller]
AT89C2051 MCU pin diagram, pin description
AT89C2051 high performance 8-bit microcontroller (AT89C2051 pin diagram) AT89C2051 Pin Diagram AT89C52 is a low voltage, high performance CMOS 8-bit single-chip computer, with 8k bytes of rewritable Flash read-only program memory and 256 bytes of random access data memory (RAM). The device is pro
[Analog Electronics]
AT89C2051 MCU pin diagram, pin description
51 MCU external interrupt
I rarely used external interrupts before, but I need to use them today, so I reviewed them. The two pins INT0 and INT1 are used to identify external voltage levels. The following are the two registers related to them: EX0 and EX1 are interrupt enable bits for INT0 and INT1 respectively, IT0 and IT1 are trigg
[Microcontroller]
PIC microcontroller temperature sensor DS18B20 C language program code
/*This temperature sensor is written by myself, the timing has been corrected, and the self-test delay time uses the Tianxiang temperature conversion module algorithm */ #include pic.h __CONFIG(0x3B31); #define uint unsigned int #define uchar unsigned char #define DQ RC1 #define DQ_DIR TRISC1 #define DQ_HIGH() TRIS
[Microcontroller]
PIC microcontroller temperature sensor DS18B20 C language program code
iQOO8 series future e-sports flagship machine uses Xinhai Technology signal chain MCU
On August 17, Xinhai Technology’s WeChat official account stated that Xinhai Technology’s signal chain MCU helped the launch of iQOO8. It is understood that iQOO8 adopts a dual-control pressure-sensing solution under the screen, and uses CoreTouch's ForceTouch chip to accurately sense user control. CoreTouch revealed
[Mobile phone portable]
iQOO8 series future e-sports flagship machine uses Xinhai Technology signal chain MCU
STC15 MCU 6-channel dedicated PWM
(1) STC routine analysis /* STC15Fxx series output PWM example with arbitrary cycle and arbitrary duty cycle*/ #define CYCLE 0x1000L //Define PWM cycle (maximum value is 32767) #define DUTY 10L //Define duty cycle as 10% void pwm() {     P0M0 = 0x00; //Because the initial state of the IO port related to the PWM modu
[Microcontroller]
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号