May 2, 2008 Copyright © 2008 BEST Robotics, Inc. All rights reserved. 1
BBEST EST RRobotics obotics AAdvanced dvanced IInstruction nstruction NNodeode
Basic BRAIN TrainingBasic BRAIN Training
Using Your BRAIN
(For Beginners)
May 2, 2008 Copyright © 2008 BEST Robotics, Inc. All rights reserved. 2
Content of this Basic ClassContent of this Basic Class
Section 1: Hardware Overview Section 2: The Programming Environment Section 3: Programming Using the BRAIN Wizard Section 4: BRAIN Debug & Support
May 2, 2008 Copyright © 2008 BEST Robotics, Inc. All rights reserved. 3
BBEST EST RRobotics obotics AAdvanced dvanced IInstruction nstruction NNodeode
Basic BRAIN TrainingBasic BRAIN Training
Section 1 - Hardware Overview
May 2, 2008 Copyright © 2008 BEST Robotics, Inc. All rights reserved. 4
BRAIN OverviewBRAIN Overview
Electronics covered (Do NOT DISASSEMBLE!)
Replaceable connectors
Dual 16-bit microcontroller architecture (TI MSP430)
Easy program download via USB interface
May 2, 2008 Copyright © 2008 BEST Robotics, Inc. All rights reserved. 5
BRAIN FeaturesBRAIN Features Interface with standard Futaba radio
PWM input from receiver Dedicated “trainer” cable interface for tethered
operation 4 proportional motor control outputs 6 servo motor outputs 8 discrete digital inputs USB port for program download Onboard power switch and replaceable fuse Powered by a single 7.2 volt RC hobby
battery
May 2, 2008 Copyright © 2008 BEST Robotics, Inc. All rights reserved. 6
Components ReplacedComponents Replaced
Tether box too!
May 2, 2008 Copyright © 2008 BEST Robotics, Inc. All rights reserved. 7
BRAIN Hardware ConnectionsBRAIN Hardware Connections
G = Ground for digital input and battery powerB = Battery power (passed through fuse)
May 2, 2008 Copyright © 2008 BEST Robotics, Inc. All rights reserved. 8
Example HookupExample Hookup
Receiver BoxServos
DC Motors
Battery
May 2, 2008 Copyright © 2008 BEST Robotics, Inc. All rights reserved. 9
Out of the Box ConfigurationOut of the Box Configuration All channels active as both servo output and
proportional speed control motor output.
Motor Limits
Transmitter
Channel
Servo Output
Motor Output
Positive Direction
Negative Direction
Channel 1 Servo 1 Motor 1 Digital 1 Digital 2
Channel 2 Servo 2 Motor 2 Digital 3 Digital 4
Channel 3 Servo 3, 5 Motor 3 Digital 5 Digital 6
Channel 4 Servo 4, 6 Motor 4 Digital 7 Digital 8
May 2, 2008 Copyright © 2008 BEST Robotics, Inc. All rights reserved. 10
Out of the Box ConfigurationOut of the Box Configuration
Allows a team to hook up the BRAIN any way they wish and have it work without ever having to program the BRAIN.
Referred to as the “default” project – described later. This is NOT the only configuration for the BRAIN! Good for initial checkout, but we want teams to load a
unique configuration.
May 2, 2008 Copyright © 2008 BEST Robotics, Inc. All rights reserved. 11
BBEST EST RRobotics obotics AAdvanced dvanced IInstruction nstruction NNodeode
Basic BRAIN TrainingBasic BRAIN Training
Section 2 - Programming Environment
May 2, 2008 Copyright © 2008 BEST Robotics, Inc. All rights reserved. 12
What You Need…What You Need…
Minimum System Requirements PC only, Mac not supported by BEST 1 USB port available for BRAIN programming Windows NT, XP, VISTA
Software & Installation Software provided on CD or via download from
http://www.besting.org, 2008 Official Documents BRAIN installer auto-runs from CD
May 2, 2008 Copyright © 2008 BEST Robotics, Inc. All rights reserved. 13
What is on the BRAIN CD?What is on the BRAIN CD?
FTDI Driver: to access BRAIN via USB IAR Embedded Workbench – Kickstart
C programming environment
BRAIN Tools Utility functions for downloading to BRAIN Provides the hardware interface library Projects and source code to use with Wizard
BEST Wizard Integrated tool to generate BRAIN program Modified to remove rule-imposed limits for 2008.
May 2, 2008 Copyright © 2008 BEST Robotics, Inc. All rights reserved. 14
IAR Software InstallationIAR Software Installation
The BRAIN Support installer performs multiple functions on the target system (PC) to provide all the software support needed to use the BRAIN hardware. The installer loads to your PC:
1. Sample software projects
2. A BRAIN software library
3. A utility to download code to the BRAIN (BSLUSB)
4. A Wizard program
5. USB drivers for communication with the BRAIN (FTDI’s CDM driver)
6. IAR Workbench, Kickstart edition Because the BRAIN installer includes a driver for the USB
interface, you must install the software prior to connecting the BRAIN hardware to a USB port.
May 2, 2008 Copyright © 2008 BEST Robotics, Inc. All rights reserved. 15
Key Software LocationsKey Software Locations
Start Program Menu item is added for IAR Embedded Workbench (under the IAR Systems Group)
Within IAR Workbench, under the “Tools” menu BRAIN Wizard Boot Load via USB
IAR Workbench Projects are added under “My Documents\Best\Brain Projects” Wizard Project – for use with Wizard Default Project – runs all motors, all servos
May 2, 2008 Copyright © 2008 BEST Robotics, Inc. All rights reserved. 16
Typical Directory Structure Typical Directory Structure after BRAIN SW Installationafter BRAIN SW Installation
*
*
*
Sam
e D
ir L
oca
tion
*
May 2, 2008 Copyright © 2008 BEST Robotics, Inc. All rights reserved. 17
IAR Workbench SetupIAR Workbench Setup
Initial BRAIN Support Installer dialog box
May 2, 2008 Copyright © 2008 BEST Robotics, Inc. All rights reserved. 18
Dialog box - USB driver Install.Dialog box - USB driver Install.
May 2, 2008 Copyright © 2008 BEST Robotics, Inc. All rights reserved. 19
Initial IAR setup dialog boxInitial IAR setup dialog box
Sometimes this dialog will be hidden by other windows and the installer will appear to hang
May 2, 2008 Copyright © 2008 BEST Robotics, Inc. All rights reserved. 20
Verifying Your InstallationVerifying Your Installation
Verify BRAIN Tools are setup correctly in IAR Workbench
Verify Microsoft serial mouse to avoid conflicts with BRAIN USB
May 2, 2008 Copyright © 2008 BEST Robotics, Inc. All rights reserved. 21
IAR Configure Tools MenusIAR Configure Tools MenusNote: Insure that you configure the
BRAIN tools as shown in these drop-down menus.
May 2, 2008 Copyright © 2008 BEST Robotics, Inc. All rights reserved. 22
BRAIN Detected as BRAIN Detected as Microsoft Serial MouseMicrosoft Serial Mouse
On some machines, when the BRAIN is plugged into a USB port, the system detects it as a Microsoft Serial Mouse. This condition will prevent the BSLUSB program from downloading programs to the BRAIN hardware. A “failed to enumerate port” error may appear when trying to download a program to the BRAIN. (This is also the error that will appear if the BRAIN is not plugged into the USB port when a download is attempted.) To fix the detected-as-mouse problem, on a Windows XP system:
1. Right click on My Computer. 2. Select Properties. 3. Select the Hardware Tab. 4. Select Device Manager. 5. Click on the + sign next to Mouse and other pointing devices. 6. Click on "Microsoft Serial Mouse". 7. Press the Delete key. 8. Confirm that you want to delete the mouse.
Note that if the BRAIN is later plugged into a different USB port, the problem may occur again.
May 2, 2008 Copyright © 2008 BEST Robotics, Inc. All rights reserved. 23
BBEST EST RRobotics obotics AAdvanced dvanced IInstruction nstruction NNodeode
Basic BRAIN TrainingBasic BRAIN Training
Section 3 - Programming
Using The BRAIN Wizard
May 2, 2008 Copyright © 2008 BEST Robotics, Inc. All rights reserved. 24
Programming (step-by-step)Programming (step-by-step)
1. Generate a wizardgen.h file using the Wizard; save the file into the wizard project directory.
2. Compile and link the code using IAR Workbench.
3. Download the program to the BRAIN (from within the IAR Workbench)
Refer to BRAIN Software GMKE00005 Revision 0; October 2007 for specific details
May 2, 2008 Copyright © 2008 BEST Robotics, Inc. All rights reserved. 25
Programming TermsProgramming Terms
Compile – changes your C program into object code that the linker understands.
Link – combines your program’s object code with the BRAIN API library and other libraries to create code that is executable on the MSP430 processor.
Download / Bootload – transfers the machine code version of your program from the PC to the BRAIN where it will execute.
May 2, 2008 Copyright © 2008 BEST Robotics, Inc. All rights reserved. 26
Software Build OverviewSoftware Build Overview
WIZARD PROJ ECT IARWORKBENCH
WIZARD
MENU BASEDCHANNEL
DEFINITION
WIZARDGEN.H
WIZARD
REBUILD
BOOTLOAD
WIZARD.TXT
BOOTLOADVIA USB
BRAIN USERPROCESSOR
May 2, 2008 Copyright © 2008 BEST Robotics, Inc. All rights reserved. 27
Software Build OverviewSoftware Build Overview
WIZARD PROJ ECT IARWORKBENCH
WIZARD
MENU BASEDCHANNEL
DEFINITION
WIZARDGEN.H
WIZARD
REBUILD
BOOTLOAD
WIZARD.TXT
BOOTLOADVIA USB
BRAIN USERPROCESSORYOU ARE
HERE!
May 2, 2008 Copyright © 2008 BEST Robotics, Inc. All rights reserved. 28
Starting the Wizard From Starting the Wizard From within IAR Workbenchwithin IAR Workbench
May 2, 2008 Copyright © 2008 BEST Robotics, Inc. All rights reserved. 29
Step 1. BRAIN WizardStep 1. BRAIN Wizard
May 2, 2008 Copyright © 2008 BEST Robotics, Inc. All rights reserved. 30
Wizard Output Options - 1Wizard Output Options - 1
Speed Control Output – provides motor speed control proportional to the transmitter joystick position.
Servo Output – provides servo position output proportional to the transmitter joystick position.
You CAN enable “speed control output” and “servo output” on the same channel.
May 2, 2008 Copyright © 2008 BEST Robotics, Inc. All rights reserved. 31
Wizard Output Options - 2 Wizard Output Options - 2 Reversing Switch Output –
When the transmitter joystick exceeds a user-specified position, the motor will be run at full speed;
when the transmitter joystick exceeds another user- specified position, the motor will be run at full speed in the opposite direction.
Optionally, you can specify proportional servo output on this same channel.
Emulates this method usingkit hardware.
May 2, 2008 Copyright © 2008 BEST Robotics, Inc. All rights reserved. 32
Reversing Switch Output – Reversing Switch Output – Threshold OptionThreshold Option
Transmitter stick position must exceed threshold value to activate motor.
Value is fraction of full stick movement, i.e., a threshold of 0.2 means the motor will activate when the transmitter stick is moved 20% of the way between the center position and full “throw”.
Small difference in threshold values, provides quick response to stick motion.
Large difference in threshold values, prevents accidental activation.
May 2, 2008 Copyright © 2008 BEST Robotics, Inc. All rights reserved. 33
Illustration of ThresholdIllustration of Threshold(only applies to reversing switch output)(only applies to reversing switch output)
-1
-0.8
-0.6
-0.4
-0.2
0
0.2
0.4
0.6
0.8
1
-1 -0.8 -0.6 -0.4 -0.2 0 0.2 0.4 0.6 0.8 1
Stick Position
Mo
tor
Ou
tpu
t
Standard ThresholdSmall Threshold DifferenceLarge Threshold Difference
Note: Stick values do not have to be symmetricNegative
full speed
Positivefull speedWhen the stick position
is between threshold values (vertical lines) the motor is off.
May 2, 2008 Copyright © 2008 BEST Robotics, Inc. All rights reserved. 34
Wizard Options – GainWizard Options – Gain(applies to both speed control & servo outputs)(applies to both speed control & servo outputs)
Multiplier used to map transmitter stick input to motor speed output.
Lower gain requires more stick input; this results in more control, but may limit maximum speed.
Higher gain requires less stick input, i.e., gives a faster reaction, but there is no overall increase in maximum speed.
May 2, 2008 Copyright © 2008 BEST Robotics, Inc. All rights reserved. 35
Illustration of GainIllustration of Gain
This is only an example. A gain greater than one may be required to get full motor output.
-1
-0.8
-0.6
-0.4
-0.2
0
0.2
0.4
0.6
0.8
1
-1 -0.8 -0.6 -0.4 -0.2 0 0.2 0.4 0.6 0.8 1
Stick Position
Mo
tor
Ou
tpu
t
Optimum Gain
Gain < Optimum
Gain >Optimum
May 2, 2008 Copyright © 2008 BEST Robotics, Inc. All rights reserved. 36
Wizard Options – Motor limitsWizard Options – Motor limits
Input switch closure stops motor travel in one direction.
Separate inputs for positive and negative stick directions.
Can be used to prevent robot mechanisms from exceeding design limits, allow motion to stop at a specific location, etc…
Can be used with either Speed Control Output or Reversing Switch Output options
May 2, 2008 Copyright © 2008 BEST Robotics, Inc. All rights reserved. 37
Programming (step-by-step)Programming (step-by-step)
1. Generate a wizardgen.h file using the Wizard; save the file into the wizard project directory.
2. Compile and link the code using IAR Workbench.
3. Download the program to the BRAIN (from within the IAR Workbench)
Refer to BRAIN Software GMKE00005 for specific details
May 2, 2008 Copyright © 2008 BEST Robotics, Inc. All rights reserved. 38
Step 2. Compile & LinkStep 2. Compile & Link
WIZARD PROJ ECT IARWORKBENCH
WIZARD
MENU BASEDCHANNEL
DEFINITION
WIZARDGEN.H
WIZARD
REBUILD
BOOTLOAD
WIZARD.TXT
BOOTLOADVIA USB
BRAIN USERPROCESSOR
YOU AREHERE!
May 2, 2008 Copyright © 2008 BEST Robotics, Inc. All rights reserved. 39
Step 2. Compile & LinkStep 2. Compile & Link
Use “Rebuild All”
May 2, 2008 Copyright © 2008 BEST Robotics, Inc. All rights reserved. 40
Step 2. Compile & Link ResultsStep 2. Compile & Link Results
Rebuilding configuration: wizard - Debug Updating build tree... 4 file(s) deleted. Updating build tree... wizardmain.c Linking Total number of errors: 0
Total number of warnings: 0
Message Window Output
May 2, 2008 Copyright © 2008 BEST Robotics, Inc. All rights reserved. 41
Programming (step-by-step)Programming (step-by-step)
1. Generate a wizardgen.h file using the Wizard; save the file into the wizard project directory.
2. Compile and link the code using IAR Workbench.
3. Download the program to the BRAIN (from within the IAR Workbench)
Refer to BRAIN Software GMKE00005 for specific details
May 2, 2008 Copyright © 2008 BEST Robotics, Inc. All rights reserved. 42
Step 3. Boot Load via USBStep 3. Boot Load via USB
WIZARD PROJ ECT IARWORKBENCH
WIZARD
MENU BASEDCHANNEL
DEFINITION
WIZARDGEN.H
WIZARD
REBUILD
BOOTLOAD
WIZARD.TXT
BOOTLOADVIA USB
BRAIN USERPROCESSOR
YOU AREHERE!
May 2, 2008 Copyright © 2008 BEST Robotics, Inc. All rights reserved. 43
Step 3. Boot Load via USBStep 3. Boot Load via USB.
Connect the BRAIN to a USB port on your PC
It will take a few seconds for the system to detect the BRAIN
Battery power is not needed
May 2, 2008 Copyright © 2008 BEST Robotics, Inc. All rights reserved. 44
Boot Load MenuBoot Load Menu
Note: if you experience a failure here – “Inability to connect”See the chart regarding MS Serial Mouse errors
May 2, 2008 Copyright © 2008 BEST Robotics, Inc. All rights reserved. 45
Step 3. Boot Load ResultsStep 3. Boot Load Results
MSP430 Bootstrap Loader - FTDI USB Interface (Version 1.02)Mass Erase...Additional mass erase cycles...Transmit standard password...BSL version: 1.10 - Family member: F149 - Process: 0043Patch for flash programming required!Load PC with 0x0C22...Transmit standard password...Load and verify patch "C:\Program Files\Best\BRAIN\bin\PATCH.TXT"... Erase Check by file "wizard.txt"...00 KByte 01 KByte 02 KByte Program "wizard.txt"...00 KByte 01 KByte 02 KByte 2177 bytes programmed.Verify"wizard.txt"...00 KByte 01 KByte 02 KByte Resetting TargetProgramming completed.Prog/Verify: 14.1 sec - Over all: 17.0 sec
Message Window Output
May 2, 2008 Copyright © 2008 BEST Robotics, Inc. All rights reserved. 46
Testing TipsTesting Tips Ensure your robot is ‘safe’ to operate:
Can’t move or fall off table (use a jack-stand) All team members clear of moving parts
Connect either the Team Receiver Box, the Tether Box or BRAIN Tether Cable.
Make sure BRAIN switch is in OFF position. Check that BRAIN has a good fuse installed. Attach a charged battery. Turn on radio transmitter (if not using tether). Turn BRAIN switch to ON position. Test robot operations with transmitter.
May 2, 2008 Copyright © 2008 BEST Robotics, Inc. All rights reserved. 47
BBEST EST RRobotics obotics AAdvanced dvanced IInstruction nstruction NNodeode
Basic BRAIN TrainingBasic BRAIN Training
Section 4 - BRAIN Debug & Support
May 2, 2008 Copyright © 2008 BEST Robotics, Inc. All rights reserved. 48
Basic DebugBasic Debug Diagnostic LEDs (D41/D42) indicate status:
D41 – Control Processor; D42 – User Processor Slow blink (once per second) – normal operation Fast blink (five times per second) – absence of
tether/receiver signal, or absence of communication between processors.
Solid on/off – something is hung up, cycle power first then reprogram if power cycle doesn’t solve.
Low Battery LED Located near the receiver connecter (BatOK). LED OFF indicates battery needs charging.
Internal fuse/breaker, self-resets with a few seconds. 5vok LED OFF by receiver indicates there is a short (5V) Find and fix the short.
May 2, 2008 Copyright © 2008 BEST Robotics, Inc. All rights reserved. 49
Team TipsTeam Tips Tin motor wires with solder before attaching to BRAIN since
frayed stranded wires can cause a short. Do NOT solder wires to BRAIN connectors! Servo wires are keyed in correct orientation; insert and remove
carefully to avoid destroying connectors. Tighten screws on motor and digital input connectors so that
wires are not loose and do not pull out. Lock receiver connector completely Mount BRAIN to robot using #10 (or #8) screws through holes in
ears; be careful not to over tighten. Two motors can be driven from one motor output. Voltage pass through can be used for other motor drive
functions. Avoid hot insertion of receiver or tether box. Insert the tether cable (RJ45) until locked; carefully remove
when done and don't break the tab.
May 2, 2008 Copyright © 2008 BEST Robotics, Inc. All rights reserved. 50
Where to find help?Where to find help?
Online documentation (BRI Site) Public Message Board (for anyone)
Must register for login account Share ideas, resolve issues, …
Official Q&A “BRAIN” Category Use “Official Q&A” page during contest for “rules
specific” questions Is this legal?
May 2, 2008 Copyright © 2008 BEST Robotics, Inc. All rights reserved. 51
Online Documentation Online Documentation Public Information
http://www.bestinc.org 2008 Official Documents Link
BRAIN Description & Rules BRAIN Quickstart Docs
Hardware Software
2008 BRAIN Tutorials BRAIN Software API Software Download Package
Top Related