Application of ATmega16L ISP Technology in Automotive Electronic Differential Control

Publisher:shiwanyongbingLatest update time:2013-03-06 Source: 21IC Keywords:ATmega16L Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere
1 Introduction

When a vehicle is driving on a turning road or lane, a traditional fuel vehicle ensures that the wheels on both sides can rotate at different speeds through a mechanical differential between the left and right wheels. Although this meets the requirements of vehicle kinematics, it also increases the complexity of the shock absorption suspension system and reduces the efficiency of the system. The electric vehicle studied in this paper adopts an independent wheel drive mode, that is, each wheel has a direct drive motor. In this way, the two rear wheels of the vehicle can independently provide driving power and can independently distribute power according to the operating conditions. The electronic differential controller distributes the driving torque of the two wheels with the goal of equal adhesion coefficients of the two driving wheels, thereby minimizing the possibility of vehicle slippage. It has the advantages of flexible operation and stable operation, and is the main direction of future electric vehicle development. In addition to considering good stability, the design of the electric vehicle differential controller must also consider easy maintenance and upgrading at the industrial site. There are many inconveniences in reprogramming the CPU using traditional methods, so the controller system is designed using in-system programming (ISP technology).

2 Introduction to development mode and chip selection

The application system introduced in this paper adopts a new development mode (similar to the programmer development mode). Since the in-system programming (ISP) function of the chip is utilized, there is no need to move the chip. When designing the software, it is designed that once the code file is re-edited, it will be automatically downloaded to the chip and automatically reset to run, which is the real "what you program is what you get".

At present, many single-chip microcomputers support in-system programming. There are also many 8051 series single-chip microcomputers that support in-system programming, but most of them support programming the single-chip microcomputer through the serial port of the PC. There are four inconveniences in this way: first, it is inconvenient for the project itself to communicate with the PC serially; second, it is necessary to add a MAX232 level conversion chip; third, some chips need to enter the download mode according to specific steps, and the programming process requires manual intervention; fourth, some chips require the support of firmware (customized program). If the firmware is accidentally damaged, the chip's in-system programming function will also be lost.

After comparison, the ATmega16L produced by ATMEL is a relatively ideal chip. It integrates a large capacity memory and rich and powerful hardware interface circuits. It has all the performance and characteristics of the MEGE series of AVR high-end single-chip microcomputers, which is suitable for the development of this system.

Among AVR products, ATmega16L has outstanding features:

(1) High-performance, low-power 8bAVR microcontroller, advanced RISC reduced instruction set structure, can be programmed in the system through the SPI interface and is compatible with 8051.

(2) A large capacity of non-volatile program and data memory is integrated on the chip. 16KB Flash program memory, erasable life of up to 10,000 times; 512B EEPROM, erasable life of up to 100,000 times; support for in-circuit programming (ISP) and application programmable (IAP); programmable program encryption bit.

(3) Rich and powerful external interface performance. Four-channel PWM, can achieve any PWM pulse width modulation output within 16b, with adjustable phase and frequency, providing conditions for the realization of advanced motor control methods; 8-channel A/D conversion; 32 programmable I/O ports.

(4) Special microcontroller performance. Controllable power-on reset and programmable undervoltage detection circuit; there is an automatic erase cycle during serial programming, which can be downloaded in segments when debugging large programs to save time.

3 ATmega16 microcontroller in system programming mode

When the chip's RESET pin is grounded, the Flash program memory, EEPROM data memory, fuse bits and encryption lock bits can be programmed through the SPI bus interface [SCK, MOSI (input), MISO (output)]. When the RESET pin is low, a programming enable command must be sent before the programming/erase operation. In serial programming mode, the chip automatically inserts an erase cycle before byte programming. Therefore, unless the chip's code protection bit is programmed, it is not necessary to execute a full chip erase command before programming. The chip erase instruction changes every unit of the program and data memory to 0xFF. According to the different system clock sources, the serial programming clock SCK must be coordinated with the system clock. The minimum time of the low level and high level of SCK is defined as follows: Low: greater than 2 MCU clock cycles (fck<12MHz); High: greater than 2 MCU clock cycles (fck<12MHz).

4 Application of system programming technology in automotive electronic differential control

4.1 System composition

The entire vehicle control system is divided into two layers. The outer layer is the differential control layer. According to the speed collected from the DC motor, it is fed back to the CPU. After A/D conversion and CPU internal differential algorithm calculation, the ideal torque value Td is generated. The inner layer is the motor torque control layer. According to the current collected from the DC motor, it is fed back to the CPU. After A/D conversion and CPU internal PID algorithm adjustment, the actual control current Io is generated. The CPU calculates the PWM duty cycle by looking up the table. This signal is transmitted to the DC motor through the power conversion circuit. Once the motor power conversion circuit is found to have abnormal conditions such as overcurrent, overvoltage, and overtemperature, the protection circuit will promptly notify the CPU and make corresponding adjustments. The system operation status is displayed by the external status indicator. RS-485 output is used to communicate with other on-board electronic devices. The system block diagram is shown in Figure 1:


Figure 1 Structure diagram of automotive electronic differential control system [page]

The ISP interface designed in this system is different from the usual practice of converting TTL level into RS-232 level. As shown in Figure 2, this circuit diagram can be used to easily realize the communication between the electric vehicle differential control system and the PC. The computer parallel port is connected to the SPI port of the microcontroller. In order to protect the computer parallel port, a 74HC244 needs to be added as an isolation.


Figure 2 Online download ISP hardware schematic

4.2 ISP technology implementation of Atmega16L microcontroller

(1) Steps for serial programming of Atmega16L in system

● Connect an 8MHz crystal between XTAL1 and XTAL2; add power between VCC and GND, and set RST and SCK to low level at the same time.
● Wait for at least 20ms, and send the serial programming enable command through the MOSI pin.
● Flash is programmed by page, and one operation corresponds to one page programming. Send write/read/erase commands and data, with the high bit of serial data in front and the low bit in the back, and the data is locked at the rising edge of the clock.
● If the previous step is a write command, wait at least 4.5ms.
● Repeat steps ③ and ④ when necessary.
● Set the RESET pin to high level, and the chip starts to execute the program.

(2) Atmega16L serial programming command

The Atmega16L serial programming command table is shown in the attached table.

Appendix Atmega16L serial programming command

Note: a = high address, b = low address, H = 0 (low byte) / L (high byte), o = data output, i = data input, x = any

(3) Atmega16L serial programming timing diagram

Atmega16L serial programming timing diagram is shown in Figure 3:


Figure 3 Atmega16L serial programming timing diagram

5 Conclusion

The application of ISP technology has provided convenience for the development of automotive electronic differential control systems, the maintenance and upgrade process of industrial sites, and significantly reduced the system cost. This system abandons the previous mode of programming the microcontroller through the serial port of the PC, and instead uses the computer parallel port to connect with the microcontroller SPI port, which improves the data transmission speed and system reliability. (end)
Keywords:ATmega16L Reference address:Application of ATmega16L ISP Technology in Automotive Electronic Differential Control

Previous article:Design of reversing radar based on ultrasonic detection
Next article:Automobile electronic combination instrument based on single chip microcomputer

Recommended ReadingLatest update time:2024-11-16 19:40

TWI/IIC header files (GCC) that can be directly used for project development
/*--------------------------File Description---------------------------------- File usage: TWI/I2C driver, query mode, host mode Instructions: Call the last 6 API application program interface functions to read and write I2C Debugging description: Debugging passed under ATmega16L+WinAVR-20090313+AVR studio 4 env
[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号