Design of intelligent automobile control system based on dual-core and multi-interface

Publisher:zuiquanLatest update time:2016-09-08 Source: eechina Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere
The basic structure of the system is shown in Figure 1, including sensor signal acquisition and processing, power motor drive, steering servo control, and control algorithm software development.

  Introduction of dual cores

  At the beginning of the design of the smart car, we analyzed that the most important thing in the design system of the smart car based on photoelectric sensors is the integrity of the signal, that is, the more track information and car position information obtained through the sensor, the better. By comparing the number of interfaces and performance requirements of 8-bit and 16-bit microcontrollers , this design decided to use two 8-bit microcontrollers MC9S08DZ60 as the core control unit.



  Dual-core communication interface SPI

  During the operation of the vehicle, the information of three sensors needs to be collected by the controller, namely photoelectric sensor, speed sensor, and angular velocity sensor. Since the angular velocity sensor needs an accurate sampling cycle, we use the internal timer of the microcontroller to generate a 1.2ms time base. In this 1.2ms cycle, data collection of the three sensors is performed, and the SPI data transmission program is executed once when the timer overflows and interrupts. SPI is a high-speed, full-duplex, synchronous communication bus , and only occupies four lines on the chip pins, namely mosi, miso, sck, and ss. We use a data transmission speed of 1MHz, use 3 bytes to send sensor data, and two bytes to send data from speed sensors and angular velocity sensors.

  Communication interface SCI between control system and host computer

  The running status of the vehicle during driving cannot be obtained directly by observation, so we use the host computer system for real-time monitoring. Use wap200b wireless serial port module to send data. The module is powered by 3.0V, has a built-in high-speed MCU , and has high data transmission accuracy. The communication between the microcontroller and the module uses a standard serial port, which is set to 115200 baud rate, 8 data bits, 1 stop bit, and no parity check. A total of 7 data are sent in one communication. First, two data are sent as handshake signals, which are 0x00 and 0xFF respectively. Then 3 bytes of data are used to send sensor information, 1 byte of data to send angle information, and 1 byte of data to send speed information. The last bit is reserved for future expansion and 0x00 is sent.

  The communication interface I2C between the keyboard and the main control chip

  has many parameters that need to be debugged continuously during actual debugging, such as PID parameters, vehicle turning angles and speeds. If you re-download the program every time to set different parameters, it will be time-consuming and laborious, so here we use the keyboard to enter the parameters when the vehicle is driving. The keyboard control chip HD7279 is an intelligent display driver chip with a serial interface that can simultaneously drive 8-bit common cathode digital tubes (or 64 independent LEDs ). The chip can also connect to a keyboard matrix with up to 64 keys. A single chip can complete all the functions of LED display and keyboard interface.

  We use the 4 I/O ports of the microcontroller to operate HD7279, namely CS, CLK, DATA, and KEY. Here we can set some parameters through the keyboard, such as the Kp, Ki, and Kd parameters of PID, the speed of straight lines and curves, etc.

  Application of A/D module in collecting angular velocity

  The A/D conversion module in this system is mainly used to collect the output value of the gyroscope . Since the cost of analog gyroscopes is relatively low, and the requirements for angle accuracy in the car model control system are not very high, analog gyroscopes are used to correct the body posture in real time. MC9S08DZ60 integrates a 12-bit digital-to-analog conversion channel. Since the output signal range of the analog gyroscope is 0~5V, the reference voltage of the microcontroller is +5V, which is powered separately by a high-precision voltage regulator module to ensure the accuracy of the conversion. The data processing program after A/D conversion is as follows:

  void Gyro_Process(void)

  {

  if(Gyro_Start == 1)

  {

  unsigned int Max,Min,i,Value;

  signed long Sum;

  Gyro_Data_Num = 0;

  while(Gyro_Data_Num < 13)

  {

  Gyro_Collection();//Data collection function after AD conversion

  }

  Gyro_Start = 0;

  for(i=1,Max=0,Min=0xffff,Sum

  =0;i<13;i++)

  {

  Value=Gyro_Data_BUF[ i];

  Sum+=Value;

  if(Max

  Max=Value;

  if(Min>Value)

  Min=Value;

  }

  Sum= Sum-Max-Min ;

  SUM_Test = Sum;

  CarAngel_V=((((signed long)(Sum/10)- (signed long)Gyro_MidValue)*10000)>>16);

  /Limiting processing/

  if(CarAngel_V > 0)

  {

  CarAngel_V = (CarAngel_V *

  1013) / 1000;

  }

  if(CarAngel_V<0)

  {

  CarAngel_V = (CarAngel_V *

  1004)/ 1000;

  }

  if(CarAngel_V>32767)

  {

  CarAngel_V=32767;

  }

  if(CarAngel_V<-32767)

  {

  CarAngel_V=-32767;

  }

  if(Gyro_Calibration_Flag == 1)

  CarAngelRate = (unsigned int)

  (CarAngel_V + 32767);

  else

  CarAngelRate = 32767;

  }

  }

  Application of TPM module in servo motor

  MC9S08DZ60 has 8 independent PWMThe channel can independently configure the PWM frequency and duty cycle, with the highest frequency being the bus clock frequency of 20MHz, which can meet the control of the servo and motor. At the same time, this module also has two counter modules that can collect the motor speed value returned by the encoder for speed closed-loop control. The PWM initialization in the motor control is as follows:

  void Motor_init(void)

  {

  TPM2SC = 0x00; /* Stop and

  reset counter */

  TPM2MOD = VV_MAX;//15khz /* Period value setting */

  (void)(TPM2C0SC == 0); /* Channel 0 int. flag clearing (first part) */

  /* TPM2C0SC: CH0F=0,CH0IE=0,MS0B=1,MS0A=0,ELS0B=0,ELS0A=4 */

  TPM2C0SC = 0x24;

  /* Int. flag clearing (2nd part) and channel 0 contr. register setting */

  TPM2C0V = VV_MAX/2; //50% duty cycle/* Compare 0 value setting */

  (void)(TPM2SC == 0); /* Overflow int. flag clearing (first part) */

  /* TPM2SC: TOF=0,TOIE=0,CPWMS=0,CLKSB=0,CLKSA=1,PS2=0,PS1=0,PS0=0 */

  TPM2SC = 0x08; /* Int. flag clearing (2nd part) and timer control register setting */

  }

  Application of ordinary I/O interface The

  ordinary I/O port operation of MC9S08DZ60 microcontroller can be used for logic control, display control, information acquisition, etc. The configuration of each pin is also relatively simple. It is necessary to configure the direction register PTXDD, pull-up enable register PTXPE, slew rate register PTXSE and data register PTXD. Take port A as an example:

  Int_A()

  {

  PTADD=0X00;//as input

  PTAPE=0XFF;//pull-up enable

  PTASE=0XFF;//slew rate enable

  }

  When the program needs to read the data of port A, it can directly read the value of the PTAD register.

  Conclusion

  The system realizes the communication between modules in the smart car, makes full use of the chip resources, realizes the real-time monitoring of multiple states of the smart car, ensures the speed control and path optimization of the car model, and provides a good platform for future technological development.
Reference address:Design of intelligent automobile control system based on dual-core and multi-interface

Previous article:Design of vehicle acceleration test system based on single chip microcomputer
Next article:Design of Embedded Vehicle Navigation System Based on Linux

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号