180 likes | 377 Views
CET 360 Smart Car Steering. Team: “TBD” Lead: Tyler Wilt Hardware: Tom Kowalski Software: Daniel Meighan Assistant: Zach Rockwell. Outline. Problem Statement / Theory Hardware System Overview Components Software ColdFire MCF51JM128 Functionality
E N D
CET 360Smart Car Steering Team: “TBD” Lead: Tyler Wilt Hardware: Tom Kowalski Software: Daniel Meighan Assistant: Zach Rockwell
Outline • Problem Statement / Theory • Hardware • System Overview • Components • Software • ColdFire MCF51JM128 Functionality • Required registers and C Code • Q & A
Problem Statement Steering - Mechanism used in guiding a vehicle to a desired position through the manipulation of wheels
Problem Statement • Take input from line-sensing array to determine degree of wheel turn needed Firebird-32 Steering servo motor
Steering Output • Steering output signal will be in the form of a pulse using the on-board Timer/PWM Module and a corresponding port pin ColdFire Firebird32
Hardware Futaba FUTM 0043
Hardware – Servo Motor • Standard High Torque Analog Servo Motor • Power Supply: between 4.8V and 7.4V DC • Capable of drawing up to 2 Amps • Striving for 1 to 2 millisecond signal pulse to avoid linkage problems Futaba FUTM0043
Hardware – Coldfire Timer / PWM Module • Up to 8 separate channels • Channels can be set as input capture, output compare, or edge aligned PWM • We will be utilizing the edge aligned PWM mode of operation
Hardware – TPM Location • PWM outputs can be configured at locations: - TPM1 • Port F: CH 2-5 • Port E: CH 0-1 - TPM2 • Port F: CH 0-1
Hardware - Servo Connection • Black - Ground • Red - Power • White - Input Signal
Software - Registers • 16-bit Modulo Register (plus 1) sets the period for the PWM output signal • (TPMxMODH:TPMxMODL) • Channel Value Register sets the duty cycle of the PWM output signal • (TPMxCnVH:TPMxCnVL) • The time between the modulus register overflow and the output compare of the value register is the pulse width (duty cycle).
Software – Pulse Width • Pulse width will ideally stay between 1 and 2 milliseconds • Pulse width for center position will vary slightly between each individual servo motor
MCG Initialization • voidMCGinit() • { • MCGC1 = 0x1c; // set RDIV = 12MHz/8 = 1.5MHz • MCGC2 = 0x64; // BDIV=2, enable ExtRef and Hi Range • MCGC3 = 0x48; // select PLL source and VDIV= x32 • // VCO is now going to 48 MHz • MCGC1_IREFS = 0; // turn off IREFS • while (!MCGSC_LOCK) {} // wait for OSC initialization to complete • // MCGOUT=24Mhz, Busclk=12MHz • } • voidinitalizeMCU() • { MCGinit(); • // I/O initialize • PTFDD |= PTFDD_PTFDD4_MASK;; // make PTF4 an output port • // initialize MCG module to use external crystal • PTFDD = 7; • SOPT1_COPT = 0; //disable COP • SOPT2_CLKOUT_EN = 1; • // RTC initialize • RTCSC = 0x08; // 1ms period from 1kHz clock • RTCMOD = 9; // RTIF every 10ms
TPM Initialzation • // TPM1 initialization • TPM1SC = &00100000 // select bus clock • + 2; // divide by-4 (12MHz / 4 = 3MHz) • // configure TPM2 for servo output pulse • TPM2SC = TPM2SC_CLKSA_MASK // select bus clock • + 2; // divide by 4 prescaler (3MHz) • TPM2MOD = 3*20000 - 1; // set period to 20ms (50Hz) • // set channel 0 to high-true edge-aligned PWM mode (output on PTF4) • TPM2C0SC = 00000110 // PWM mode • + TPM2C0SC_ELS0B_MASK; // high-true output pulse • TPM2C0V = 3 * 1500; // 1500us = servo pulse width • EnableInterrupts; • }
Summary • Problem Statement / Theory • Hardware • System Overview • Components • Software • ColdFire MCF51JM128 Functionality • Required registers and C Code
References • MCF51JM128 ColdFire Integrated Microcontroller Reference Manual. 2. Freescale Semiconductor, Inc., 2009. Web.<http://www.aet.calu.edu/ftp/cet/360/resources/Coldfire/MCF51JM128-RefManual-v2.pdf>. • Sumey, Jeff. “CET Microprocessor Engineering.” California University of Pennsylvania. Web. 25 Feb 2014. <http://aet.calu.edu/~jsumey>. • “Futaba Analog Servos.” Web. 25 Feb 2014. <http://www.futaba-rc.com/servos/analog.html>.