Sunteți pe pagina 1din 12

Creating an Autonomous Car with the

Stellaris® LM3S316 Microcontroller

Application Note

AN01 245 -0 3 Co pyrigh t © 2 006– 200 9 Te xas In strumen ts


Application Note Creating an Autonomous Car with the Stellaris® LM3S316 Microcontroller

Copyright
Copyright © 2006–2009 Texas Instruments, Inc. All rights reserved. Stellaris and StellarisWare are registered trademarks of Texas Instruments.
ARM and Thumb are registered trademarks, and Cortex is a trademark of ARM Limited. Other names and brands may be claimed as the property
of others.

Texas Instruments
108 Wild Basin, Suite 350
Austin, TX 78746
Main: +1-512-279-8800
Fax: +1-512-279-8879
http://www.luminarymicro.com

June 24, 2009 2


Application Note Creating an Autonomous Car with the Stellaris® LM3S316 Microcontroller

Table of Contents
Introduction ......................................................................................................................................................... 4
Building the Car .................................................................................................................................................. 4
Circuit Board Design........................................................................................................................................... 5
Overview of the Software.................................................................................................................................... 6
Normal Running Mode .................................................................................................................................... 7
Diagnostic Mode ............................................................................................................................................. 8
Schematics ......................................................................................................................................................... 9
Conclusion ........................................................................................................................................................ 11
References ....................................................................................................................................................... 11

June 24, 2009 3


Application Note Creating an Autonomous Car with the Stellaris® LM3S316 Microcontroller

Introduction
The Stellaris® LM3S316 Microcontroller Autonomous Car is a robotic vehicle that is capable of
roaming around a controlled but random area and avoiding colliding with obstacles. The car makes
use of the peripherals of the LM3S316 microcontroller including the Analog-to-Digital Converter
(ADC) module which is used to read the infrared ranging sensors, and the pulse-width modulator
(PWM) block which is used to drive the motors. This application note describes the construction of
the car, the design of the circuit board, and the software that runs the vehicle.

Building the Car


When building a robotic vehicle, the mechanical construction is typically one of the most complex
parts of the task. Some robotics sites on the internet, such as Lynxmotion (www.lynxmotion.com),
provide ready-to-assemble vehicle chassis kits. The LM3S316 car uses the Terminator Sumo Kit
from Lynxmotion, which contains an 8 inch x 8 inch chassis (20 cm x 20 cm), four brushed DC
motors, a Lexan body with aluminum supports, and a convenient cavity inside the vehicle for
mounting the battery.

Using this kit, an initial prototype was created that uses the Stellaris Family Development Board. The
additional components required (such as the dual H-bridge chip) were breadboarded onto the
development board and a working prototype was created. This prototype was used as a
proof-of-concept for the entire design as well as a test vehicle to use for software development while
the custom circuit board was designed.

The car’s mechanical design uses three GP2D12 infrared ranging sensors to determine the distance
to obstacles in three directions; forward, forward left, and forward right. The two side sensors are
mounted at an angle of approximately 30 degrees from straight forward. One sensor property that
must be accounted for is the range of uncertainty for distances closer than 4 inches (10 cm). For
example, the sensor provides the same output for an object that is 3 inches away as one that is
6 inches away. To avoid problems caused by this phenomenon, the sensors are mounted 4 inches
from the front of the chassis; therefore, the car would have to drive through a wall (which is not
physically possible) before that wall can enter the range of uncertainty.

The infrared sensors also provide more accurate results, especially at the edge of a wall, when
mounted vertically and so a lucite “windshield” was created to mount the sensors. The windshield is
mounted across the chassis halfway between the front and back, which places the sensors
approximately four inches from the front edge of the vehicle.

In addition to the sensor mounts and windshield, the following were also added to the vehicle:

„ A large push button was mounted to the side of the circuit board. This button is much easier to
press when the car is running, and helps provide some static insulation for the board (versus
attempting to press a small push button that is mounted on the circuit board itself).

„ A pair of mini-banana plugs was also mounted to the side of the circuit board. This allows the
internal battery to be recharged without having to extract it from the vehicle

Note: The switch on the board must be turned off so that the charger is not also powering the circuit
board while the internal battery is being recharged.

June 24, 2009 4


Application Note Creating an Autonomous Car with the Stellaris® LM3S316 Microcontroller

The end result is a self-contained, autonomous vehicle with a Stellaris microcontroller for a brain as
shown in Figure 1.

Figure 1. Stellaris LM3S316 Autonomous Car

Circuit Board Design


There were several design considerations that drove the design of the circuit board. First, the board
needed to run from the 7.2 V battery pack that is used to power the 7.2 V motors on the vehicle. The
board also needed to provide interfaces to the three infrared ranging sensors, the four brushed DC
motors, the on-chassis push button, the four LEDs (headlights and taillights), and a compact JTAG
debug interface (the standard 20-pin JTAG header is too big). The final design consideration is that
the board needed to fit into the roughly 2.5 inch (6.4 cm) square area near the back of chassis that
was available for the circuit board.

With these goals in mind, a pair of power regulators were placed on the board. One power regulator
generates the 5 V required by the infrared ranging sensors and the dual H-bridge chip, and the other
generates the 3.3 V required by the Stellaris microcontroller and all the other control electronics.

An STL298 dual H-bridge chip was placed on the board for driving the brushed DC motors. The
motors are paired, with one H-bridge driving the two motors on the left side of the vehicle and the
other H-bridge driving the two motors on the right side of the vehicle. The inputs to each bridge are
simple; if both inputs are the same, then the motor is in a dynamic braking mode. If the inputs are
different, then the motor spins either forward or backward, depending on which input is logic high and
which is logic low. Providing a PWM signal to the logic high input allows the speed of the motor to be
controlled; the four inputs to the STL298 (two per H-bridge) are connected to the four PWM outputs
of the LM3S316 microcontroller. A keyed 4-way connector was placed on the board for connection to
the wiring harness added to the motors on the chassis; the keying helps to prevent plugging the
motors into the board incorrectly.

June 24, 2009 5


Application Note Creating an Autonomous Car with the Stellaris® LM3S316 Microcontroller

The ranging sensors only require 5 V power, ground, and a connection to an analog input. The
LM3S316 microcontroller has a four-channel ADC, so three of the channels are used to sample the
analog value generated by the three ranging sensors. A block of 0.1 inch 1 x 3 stake headers are
provided for connecting to the corresponding connector on the infrared sensors.

The headlight and taillight LEDs are similarly simple. They require only a GPIO on one side of the
LED and a current-limiting pull-up resistor on the other side. A block of 0.1 inch, 1 x 2 stake headers
are provided for connecting to the corresponding connector that was added to the LEDs (along with
a length of wire so that the LEDs could be mounted at the front and back of the car). The LEDs are
connected to GPIOs that can also be configured as PWM outputs from the timer blocks. This allows
the LEDs to be driven by the PWM outputs to provide variable brightness control.

A small push button switch was placed on the board, along with a 0.1 inch, 1 x 2 stake header to
allow an external push button switch to be installed as well. The push button does not have any
hardware debouncing circuitry (such as a capacitor), so debouncing of the switch input is left entirely
to software.

In lieu of the standard 20-pin JTAG connector (of which almost half of the pins are dedicated to
ground connections), a more compact, but non-standard, 8-pin JTAG connector was created. This
has the four required JTAG signals, chip reset, power, and ground. In order to use a JTAG emulator,
a custom 20-pin to 8-pin conversion cable is required.

The board also includes a photocell connected to one of the analog comparators on the LM3S316
microcontroller which allows the headlights to be turned on automatically when it gets too dark, and a
current sense amplifier on the bridge current connected to the fourth ADC channel which allows
monitoring of the bridge current.

Given these on-board components, the design easily fits onto a 2.5 inch (6.4 cm) square board. All of
the connectors for off-board items are placed along the edges and utilize right-angle connectors,
keeping the profile low when the connectors are plugged in.

Figure 4 on page 10 shows the schematics for the circuit board.

Overview of the Software


The software for the LM3S316 microcontroller autonomous car is built in layers. Abstractions are
provided for all of the hardware features (such as the brushed DC motors), and the main control
code for the car uses those abstracted interfaces to obtain inputs and drive outputs. This simplifies
the main control code since it does not need to know the details of the input and output devices
operation, and allows the operation of the input and output devices to be enhanced (or even
changed to a completely different type of device) without affecting the main control loop. Figure 2
shows the software block diagram.

June 24, 2009 6


Application Note Creating an Autonomous Car with the Stellaris® LM3S316 Microcontroller

Figure 2. Software Block Diagram

Control State Machine Random Number Generator


(car.c) (random.c)

Motor Driver Light Driver Switch Driver Sensor Driver


(motors.c) (lights.c) (switches.c) (sensors.c)

Hardware

Abstract interfaces are provided for the motors, sensors, push button switch, and lights. Each of
these interfaces provides a set of functions for operating the device as required by the overall
application (such as setting the speed of a motor or turning on a headlight). Not all hardware features
of a device are abstracted; for example, the hardware allows the headlights and taillights to be set to
a variety of brightnesses; the software abstraction does not support this feature.

The car supports two operating modes; normal running mode (see “Normal Running Mode” on
page 7 for more information) and diagnostic mode (see “Diagnostic Mode” on page 8). Normal
running mode, in which the car wanders around avoiding obstacles, is the typical operating mode for
the car. Diagnostic mode methodically checks each device on the car to verify that the connectors
are plugged into the board correctly and that everything is in working order.

When the car is not in normal running mode or diagnostic mode, it simply stays in place with the
lights and motors turned off.

Normal Running Mode


When the car is in normal running mode, it exhibits one of the following four behaviors.

„ The first behavior occurs when the car does not see any obstacles. In this case, the car simply
drives straight forward.

„ If the car sees an obstacle that is too close to the car (that is, within 20 inches, or 51 cm), the car
continues to drive in a generally forward direction and veers away from the obstacle. The rate at
which the car veers depends on the distance to the obstacle and the rate of approach to the
obstacle; if the obstacle is still far away or is not approaching quickly, the car veers slowly. On the
other hand, if the obstacle is fairly close and/or it is approaching quickly, the car veers quickly.

„ If the car sees an obstacle that is approximately 9 inches (23 cm) away and appears to be running
parallel to the car's path, the car attempts to follow the obstacle. It drives straight ahead, making
minor adjustments to the left or right to keep the obstacle 9 inches (23 cm) from the side of the
car.

„ If the car gets extremely close to an obstacle (that is, within 7 inches, or 18 cm), or if a random
time-out occurs, the car stops and spins in place. This continues until the obstacles are far

June 24, 2009 7


Application Note Creating an Autonomous Car with the Stellaris® LM3S316 Microcontroller

enough away to proceed forward without colliding with any obstacles. While the car is spinning in
place, the taillights are turned on.

During all of these normal running mode behaviors, the car turns on its headlights when the ambient
light conditions get too dark. When the ambient light gets brighter again, the headlights automatically
turn back off again. This behavior is similar to the automatic dusk/dawn lights on automobiles.

A simplified version of the state machine for normal running mode is shown in Figure 3. The
“Turning” state is actually eight distinct states; there is a set of four states that are used for turns that
result from the car getting to close to an obstacle, and another four states that are used for random
turns. “Turning” was drawn as a single state to simplify the diagram. Also, any of the states that are
not the “Stop” state can transition to the “Stop” state by a press of the push button (these transitions
were left off to simplify the diagram).

Figure 3. Software State Machine Diagram

Stop a In Open a - The button is pressed


b - An obstacle can be seen
c - No obstacle is visible
d - An obstacle is parallel to the car
f e - The obstacle is no longer parallel to the car
b f - An obstacle is too close or the random time-out has occurred
c c
g - The car has turned enough to not see obstacles too close
Turning h - The button is pressed (not shown, from non-stop state to
the stop state)
g
f f

Following Approaching

d
e

Diagnostic Mode
Diagnostic mode uses a sequence of steps to verify that each functional piece of the car is in good
working order. Diagnostic mode runs the steps as follows:

1. Turns on the headlights and taillights, but leaves the motors off. This step is mainly for
photographic purposes; the car stays in place with all of the lights on, allowing for good still
photography.

2. Blinks only the left headlight and runs only the left motors in the forward direction. This step shows
that the left headlight is correctly connected, that the left motors are correctly connected, and that
the left motors can be driven in the forward direction.

3. Blinks only the left taillight and runs only the left motors in the backward direction. This step shows
that the left taillight is correctly connected, that the left motors are correctly connected, and that
the left motors can be driven in the backward direction.

4. Blinks only the right headlight and runs only the right motors in the forward direction. This step
shows that the right headlight is correctly connected, that the right motors are correctly
connected, and that the right motors can be driven in the forward direction.

June 24, 2009 8


Application Note Creating an Autonomous Car with the Stellaris® LM3S316 Microcontroller

5. Blinks only the right taillight and runs only the right motors in the backward direction. This step
shows that the right taillight is correctly connected, that the right motors are correctly connected,
and that the right motors can be driven in the backward direction.

6. Blinks all four lights, runs all motors in the backward direction, and sets the speed of the motors
based on the raw sensor reading from the left sensor, which can be seen by moving an object
(such as a hand) closer and farther from the left sensor (with no effect being seen if the same is
done to the right and center sensors). This step shows that the left sensor is correctly connected.

7. Blinks all four lights, runs all motors in the backward direction, and sets the speed of the motors
based on the raw sensor reading from the right sensor, which can be seen by moving an object
(such as a hand) closer and farther from the right sensor (with no effect being seen if the same is
done to the left and center sensors). This step shows that the right sensor is correctly connected.

8. Blinks all four lights, runs all motors in the backward direction, and sets the speed of the motors
based on the raw sensor reading from the center sensor, which can be seen by moving an object
(such as a hand) closer and farther from the center sensor (with no effect being seen if the same
is done to the left and right sensors). This step shows that the center sensor is correctly
connected.

Any perceived problems with the operation of the car can be easily identified by running through the
steps of diagnostic mode. If one of the steps fails to operate as expected (for example, Step 6,
changing the motor speed based on the right sensor instead of the left sensor), then the wiring
problem can be corrected and it is likely that the problem will go away. If all of the diagnostic steps
pass, then the problem is likely with the code that handles the normal mode of operation.

When running, the car samples the sensors 500 times per second, samples the push button
200 times per second, and makes decisions 10 times per second. All processing occurs within
interrupt handlers; the full application only requires .25 MIPS of processing power.

The application for the car uses approximately 6 KB of flash and 384 bytes of SRAM (256 bytes of
which is the stack). Since the ADC is used by the application, and the ADC requires that the PLL be
used, the processor is run at 12.5 MHz, which is the slowest that the processor can be clocked when
running from the PLL. The .25 MIPS consumed by the application uses approximately 2% of the
processor.

The software for the LM3S316 microcontroller autonomous car is provided in the accompanying ZIP
file. The contents of this ZIP file should be extracted to the same directory to which StellarisWare™
was extracted. For example, if the StellarisWare™ ZIP file was extracted toC:\, then this ZIP file
should also be extracted to C:\. This creates a C:\StellarisWare\AppNotes\an01245 directory that
contains the source code for the car. See the an01245sw-nnn.pdf file in this directory (where nnn is
replaced by a version number) for full details of the functions, global variables, and so on, in the
source code.

Schematics
Figure 4 shows the schematics for the car.

June 24, 2009 9


1 1 2 2 3 3 4 4 5 5 6 6

J1 J1
3.3V 3.3V U1 U1 1 1
2 2
17 17 29 29
MR_PWMa MR_PWMa 3 3
TP1 TP1 PA0/U0Rx PA0/U0Rx PB0/PWM2PB0/PWM2
18 18 30 30
MR_PWMb MR_PWMb 4 4
TP2 TP2 PA1/U0Tx PA1/U0Tx PB1/PWM3PB1/PWM3
19 19 33 33 TP6

10K
10K
10K
TP3 PA2/SSIClk PB2/I2CSCL TP6

10K
10K
10K
TP3 PA2/SSIClk
20 PB2/I2CSCL 34
TP4
20 PA3/SSIFss 34
PB3/I2CSDA TP8 TP8 1X4HDR 1X4HDR
TP4 PA3/SSIFss
21 PB3/I2CSDA 44 MCTRL MCTRL J3 J3
TP5
21 PA4/SSIRx 44
TP5 PA4/SSIRx
22 PB4/C0- PB4/C0- 43 1
TP7
22 43
PB5/CCP5 TP9 1
TP7 PA5/SSITx PA5/SSITx PB5/CCP5

June 24, 2009


A 42 42 TP9 TP10 2 2 A A
J2 JTAG J2 JTAG PB6/C0+ PB6/C0+ TP10
41 7.2V 3

R2
R3
R1
41 7.2V 3

R2
R3
R1
PB7/TRST PB7/TRST TP14 TP14
8 87 RSTn7 RSTn 4 4
TCK 40 25 ML_PWMa U2 U2
6 65 TCK 5 40 PC0/TCK/SWCLK 25 ML_PWMa
PC0/TCK/SWCLK PD0/PWM0PD0/PWM0
Application Note

4 43 TMS 3 TMS 39 39 26 26
ML_PWMb ML_PWMb HDR-1X4FL-RA
HDR-1X4FL-RA
PC1/TMS/SWDIO
PC1/TMS/SWDIO PD1/PWM1PD1/PWM1 Vs Vs
2 21 TDI 1 TDI 38 38 27 27 TP15 6 6 BDC BDC
PC2/TDI PC2/TDI PD2/U1Rx PD2/U1Rx
TDO TDO 37 37 28 28 TP15 TP16
PC3/TDO/SWO
PC3/TDO/SWO PD3/U1Tx PD3/U1Tx TP16 In1 In1 + C1 + C1 C2 C2
2x4 HDR-RA 2x4 HDR-RA RUN RUN 14 14 45 45 7 7
PC4 13 PC4 PD4/CCP0 PD4/CCP0 D1 D1
D2 D2
D3 D3
D4 D4100uF 100uF
0.1 uF 0.1 uF
R_HLIGHT R_HLIGHT13 46 46
PC5/CCP1 PC5/CCP1 PD5/CCP2 PD5/CCP2
R_TLIGHT R_TLIGHT12 12 47 47 TP17 3.3V 3.3V
PC6/CCP3 PC6/CCP3 PD6/Fault PD6/Fault In2
11 11 48 48 TP17 9 In2 9
TP11 TP11 PC7/CCP4 PC7/CCP4 PD7/C0o PD7/C0o TP18 TP18 Out1
Out1 4 4
35 R4 R4 Out2 Out2 5
TP12 35 PE0 5
TP12 PE0 36 10K 10K
TP13 36 PE1
TP13 PE1 4
4 ADC3
5V 5V 3
ADC3 3
ML_D1 ML_D1
J4 ADC[0:2] ADC2
J4 ADC[0:2] 2
ADC2 2
ML_D2 ML_D2
ADC1 EnA
1 1 3 3 1
ADC1 1
8 EnA 8 MR_D1 MR_D1
ADC0 ADC0 SenseA
2 2 SenseA 2 2 MR_D2 MR_D2
4 4 6 6
5 5
7 7 9 9 OSC0 OSC0 9 9 3.3V 3.3V
OSC0 In3
8 8 OSC1 OSC1 10
OSC010
13 In3 13
OSC1 OSC1

3X3 HDR-RA 3X3 HDR-RA 5 5 6


RST RST LDO
6 LDO In4
15 In4 15
Y1 8 7 Out3 16
Y1 8 Out3
GND VDD
7 VDD 16Out4
1 21 2 16
GND 16 15 Out4 17 17
GND 24 GND VDD
15VDD
24 23
6.000MHz GND 31 GND VDD
23VDD
6.000MHz 31 32 LDO
C3 C4 GND 32VDD LDO
C3 C4 GND VDD
3.3V 18pF 18pF C5 C6
3.3V 18pF 18pF C5 C6
1uF 0.1 uF EnB
LM3S316 LM3S316 1uF 0.1 uF 14 EnB 14
SenseB 19
SenseB 19
R5
R5
10K C7 C8 C9 C10 1 Gnd 5V
TEST 10K C7 C8 C9 C10 1 Gnd 5V
TEST 0.1 uF 0.1 uF 0.1 uF 0.1 uF Gnd Vss 12
0.1 uF 0.1 uF 0.1 uF 0.1 uF 10 Gnd 10 Vss 12
SW2 Gnd
SW2 Gnd 11

4
11 Gnd NC1 D5 D6 D7 D8

1
41
B J6 Gnd 20 NC1 3 D5 D6 D7 D8 B
J6 20 Gnd(Slug) 3 NC2 B
J5 2 21
Gnd(Slug) NC2 18
J5 1 2 21 18 C11
1
1x2 HDR-RA 1 C11
1x2 HDR-RA 2 1 0.1 uF
2 MX_IS STL298 0.1 uF

3
MX_IS STL298

2
32
1x2 HDR
TEST 1x2 HDR ISENSE
TEST ISENSE M_IS
M_IS

3.3v
3.3v
5V R13 R14
3.3V 5V R7 R13 R14
3.3V 0.20 0.20
R7 0.20 0.20
1/2W 1/2W
1/2W 1/2W
1% 1%
R6 C12 C13 PHOTOCELL-P8102 1% 1%
R6 10K C12 C13
1uF 0.1 uF PHOTOCELL-P8102
10K 1uF 0.1 uF

5
SW1

5
U3

4
SW1 U3 R11

1
41
3 LMV321M7 R11
+ C14 3 LMV321M7 4 10K DLIGHT
+ C14 10uF 10K DLIGHT
10uF
1 4 THRESHOLD
1 THRESHOLD

3
RESET

2
32
2
RESET

2
R10 R15
R10 20K R15 2K
20K 2K

5V
R17 160K J8 HEADLIGHTS 5V
R17 160K J8 HEADLIGHTS
L_HLIGHT 1 2 R18 200
L_HLIGHT L_TLIGHT 1 3 2 4 R18 R19 200 200
L_TLIGHT 3 5 4 6 R19 R20 200 200
5 7 6 8 R20 R21 200 200
7 8 R21 200
2x4 HDR-RA
2x4 HDR-RA
Figure 4. Schematics for the LM3S316 Autonomous Car

C C
C

FID1 FID2
FID1 40 Mil Pad FID2 40 Mil Pad
TL1 TL2 40 Mil Pad 40 Mil Pad
J10 7.2V TL3 7.2V TL4 5.0V 5V
J10 S1 TL3 7.2V U7 MIC5209 TL4 5.0V TL1 TL2
1 1 7.2V 5V
S1 U7 MIC5209 GND GND
1 2 1 2 2 4
VIN VOUT GND GND
2 23 2 4
1101M2S3CQE2 VIN VOUT R35 100 Mil Mask 100 Mil Mask
Term_Block_V_2pos 3
Battery
Term_Block_V_2pos 1101M2S3CQE2 R34 10K 1 5 R37 45.3K R35 1.50K 100 Mil Mask 100 Mil Mask
R34 10K EN ADJ R37 45.3K 1.50K
Battery 1 5 FID3 FID4

GND
TAB
+ C29 C30 EN ADJ C31 R36 + C32
FID3 40 Mil Pad FID4 40 Mil Pad

GND
TAB
+ C29 22uF
C30 0.1 uF C31 470 pF
R36 137K + C32 22uF
40 Mil Pad 40 Mil Pad

3
22uF 0.1 uF 470 pF 137K 22uF D9

3
TAB
D9 GREEN LED

TAB
GREEN LED
5.0V
5.0V
100 Mil Mask 100 Mil Mask
100 Mil Mask
Fiducials 100 Mil Mask
Fiducials

5V TL5 3.3V 3.3V


5V U8 MIC5209 TL5 3.3V 3.3V
U8 2 MIC5209 4
VIN VOUT
2 4
VIN VOUT R40
R38 10K 1 5 R39 82.5K R40 510
R38 10K
EN ADJ R39 82.5K 510
1 5

GND
TAB
+ C33 C34 EN ADJ C35 R41 + C36

GND
TAB
+ C33 22uF
C34 0.1 uF C35 470 pF
R41 137K + C36 22uF

3
22uF 0.1 uF 470 pF 137K 22uF D10

3
TAB
D10 GREEN LED

TAB
GREEN LED
3.3V
3.3V
D D
D

This document contains information proprietary to Luminary Micro, Inc. and shall not be used for
engineering
This document design,
contains procurement
information of manufacture
proprietary to Luminary whole or
in Micro, Inc.
in and without
part shall notthe
be express
used forwritten
permission
engineering design, of Luminary Micro,
procurement Inc. Copyright
of manufacture © 2006
in whole or inLuminary Micro,
part without theInc. All rights
express reserved.
written
permission of Luminary Micro, Inc.
Designer:
Copyright © 2006 Luminary Micro, Inc. All rights reserved.
Drawing Title:
Designer: A. Cruz Drawing Title:
LM3S316Autonomous Car
A. Cruz Drawn by: LM3S316 Autonomous Car
Page Title:
Drawn by:A. Cruz Page Title:
LM3S316 and Brushed DC Motor Driver
A. Cruz Approved: LM3S316 Brushed
Size andDocument DC Motor Driver
Number: Rev
Approved:* Size C
Document Number: 0001 Rev R1
* C Date: 11/9/2006 0001 Sheet 1 of R1
1
1 2 3 4 5 6 1 1
Date: 11/9/2006 Sheet of

10
Creating an Autonomous Car with the Stellaris® LM3S316 Microcontroller

1 2 3 4 5 6
Application Note Creating an Autonomous Car with the Stellaris® LM3S316 Microcontroller

Conclusion
The intelligent, autonomous car effectively demonstrates the use of the Stellaris LM3S316
microcontroller features, including the ADCs, analog comparators, timers, motion-control
PWMs, and GPIOs. The vehicle software, written in easy-to-maintain C, shows how the
32-bit ARM® Cortex™-M3 core enables a straightforward software architecture that is completely
interrupt-driven—an important consideration in product development as software development
costs continue to balloon. While this is a fun microcontroller application, the concepts demonstrated
here are directly applicable to products in many different applications.

References
The following are available for download at www.luminarymicro.com:

„ Stellaris® LM3S316 microcontroller data sheet, Publication Number DS-LM3S316

„ StellarisWare® Driver Library

„ StellarisWare® Driver Library User’s Manual, publication number SW-DRL-UG

„ Creating an Autonomous Car with the Stellaris® LM3S316 Microcontroller collateral, number
an01245-nnn.zip (where nnn is the revision number)

June 24, 2009 11


Application Note Creating an Autonomous Car with the Stellaris® LM3S316 Microcontroller

Important Notice
Texas Instruments Incorporated and its subsidiaries (TI) reserve the right to make corrections, modifications, enhancements,
improvements, and other changes to its products and services at any time and to discontinue any product or service without notice.
Customers should obtain the latest relevant information before placing orders and should verify that such information is current and
complete. All products are sold subject to TI’s terms and conditions of sale supplied at the time of order acknowledgment.
TI warrants performance of its hardware products to the specifications applicable at the time of sale in accordance with TI’s standard
warranty. Testing and other quality control techniques are used to the extent TI deems necessary to support this warranty. Except where
mandated by government requirements, testing of all parameters of each product is not necessarily performed.
TI assumes no liability for applications assistance or customer product design. Customers are responsible for their products and
applications using TI components. To minimize the risks associated with customer products and applications, customers should provide
adequate design and operating safeguards.
TI does not warrant or represent that any license, either express or implied, is granted under any TI patent right, copyright, mask work
right, or other TI intellectual property right relating to any combination, machine, or process in which TI products or services are used.
Information published by TI regarding third-party products or services does not constitute a license from TI to use such products or
services or a warranty or endorsement thereof. Use of such information may require a license from a third party under the patents or other
intellectual property of the third party, or a license from TI under the patents or other intellectual property of TI.
Reproduction of TI information in TI data books or data sheets is permissible only if reproduction is without alteration and is accompanied
by all associated warranties, conditions, limitations, and notices. Reproduction of this information with alteration is an unfair and deceptive
business practice. TI is not responsible or liable for such altered documentation. Information of third parties may be subject to additional
restrictions.
Resale of TI products or services with statements different from or beyond the parameters stated by TI for that product or service voids all
express and any implied warranties for the associated TI product or service and is an unfair and deceptive business practice. TI is not
responsible or liable for any such statements.
TI products are not authorized for use in safety-critical applications (such as life support) where a failure of the TI product would
reasonably be expected to cause severe personal injury or death, unless officers of the parties have executed an agreement specifically
governing such use. Buyers represent that they have all necessary expertise in the safety and regulatory ramifications of their applications,
and acknowledge and agree that they are solely responsible for all legal, regulatory and safety-related requirements concerning their
products and any use of TI products in such safety-critical applications, notwithstanding any applications-related information or support
that may be provided by TI. Further, Buyers must fully indemnify TI and its representatives against any damages arising out of the use of
TI products in such safety-critical applications.
TI products are neither designed nor intended for use in military/aerospace applications or environments unless the TI products are
specifically designated by TI as military-grade or "enhanced plastic." Only products designated by TI as military-grade meet military
specifications. Buyers acknowledge and agree that any such use of TI products which TI has not designated as military-grade is solely at
the Buyer's risk, and that they are solely responsible for compliance with all legal and regulatory requirements in connection with such use.
TI products are neither designed nor intended for use in automotive applications or environments unless the specific TI products are
designated by TI as compliant with ISO/TS 16949 requirements. Buyers acknowledge and agree that, if they use any non-designated
products in automotive applications, TI will not be responsible for any failure to meet such requirements.
Following are URLs where you can obtain information on other Texas Instruments products and application solutions:
Products Applications
Amplifiers amplifier.ti.com Audio www.ti.com/audio
Data Converters dataconverter.ti.com Automotive www.ti.com/automotive
DLP® Products www.dlp.com Broadband www.ti.com/broadband
DSP dsp.ti.com Digital Control www.ti.com/digitalcontrol
Clocks and Timers www.ti.com/clocks Medical www.ti.com/medical
Interface interface.ti.com Military www.ti.com/military
Logic logic.ti.com Optical Networking www.ti.com/opticalnetwork
Power Mgmt power.ti.com Security www.ti.com/security
Microcontrollers microcontroller.ti.com Telephony www.ti.com/telephony
RFID www.ti-rfid.com Video & Imaging www.ti.com/video
RF/IF and ZigBee® Solutions www.ti.com/lprf Wireless www.ti.com/wireless

Mailing Address: Texas Instruments, Post Office Box 655303, Dallas, Texas 75265
Copyright © 2009, Texas Instruments Incorporated

June 24, 2009 12

S-ar putea să vă placă și