Getting Started with Freescale's FSLBOT Using CodeWarrior v7.2 and Stick OS
The Freescale FSLBOT is a mechatronics development platform used to demonstrate the capabilities of the ColdFire TWR-MECH dev board. The TWR-MECH board can be programmed in C/C++ or through one of two higher-level, BASIC-style coded operating systems, Stick OS or the Robot Vision Toolkit. The TWR_MECH board features:
• Sensors interface via I2C, SPI, A/D, or through GPIO
• On-board accelerometer, magnetometer, and touch sensing
• Touch sensing boards with 12 touch pads and 10 LEDs
• Four PWM controlled RC servo motors
• Programmable in C/C++ through CodeWarrior or a BASIC style language through Stick OS or the Robot Vision Tool Kit
This getting started guide goes over what the Freescale getting started documentation doesn’t cover such as setting up the Flash Programmer within CodeWarrior v7.2, programming the MCF52259 with the Stick OS s-record file, and using a communication terminal to load the correct libraries and program the robot to walk. This getting started guide assumes the developer has already assembled the FSLBOT, installed batteries, and double checked the proper jumper configuration as outlined in the Freescale FSLBOT documentation found at http://www.freescale.com/webapp/sps/site/prod_summary.jsp?code=FSLBOT&fpsp=1&tab=Documentation_Tab.
Setting up the CodeWarrior Flash Programmer
1. The First Step is to download and install CodeWarrior for ColdFire v7.2.
2. Next download and install Stick OS (www.freescale.com/mechbot).
3. Connect the USB cable from the TWR-MECH board OSBDM (j17) to an open USB port on your PC.
• Ensure the TWR-MECH jumper settings are in the default configuration, as noted in the Quick Start Guide
• Follow the prompts to install the OSBDM driver the first time the board is connected.
• Now CodeWarrior can be opened
• Close the Startup pop-up window or click Start Using CodeWarrior
• Close the Tip of the Day Window
• Click on Tools in the upper toolbar and click Flash Programmer as seen below in figure 1
• In the “Connection” box, select ColdFire v2-v4 JM60 OSBDM (this is found circled in red in figure 1)
Figure 1 – Opening the Flash Programmer Utility
• In the box found under “Use Target Initialization” Browse within the ColdFire V7.2\ColdFire_Support\Initialization_Files and select MCF52259.cfg or click the Load Settings button at the bottom of the window and select the same MCF52259.cfg file. This can be seen below in figure 2 and 3 respectively.
Figure 2 – Selecting Target Initialization File
Figure 3 – Clicking the Load Settings Button to Configure Flash Programmer
• The Flash can be erased by clicking on the Erase / Blank Check within the Flash Programmer window. Simply click the Erase button as seen in figure 4.
Figure 4 – Erasing Flash Memory
• Next click Program \ Verify within the Flash Programmer window on the left.
• In the top window, Browse to the location of the downloaded, and unzipped, Stick OS file. Here you will find an s-record file (StickOS.TWR-MECH.v1.90g.elf.S19). Click on this file to point the programmer to it. See figure 5 below.
Figure 5 – Pointing the Flash Programmer to the Downloaded S-Record File
• Finally click the Program button and the Status box should read “Program Command Succeeded”.
• Next we can continue to connect the USB to the other port labeled USB OTG (j50)
4. The fourth step in getting the FSLBOT to walk is to follow the Freescale FSLBOT Quick Start Guide to ensure the Stick OS USB driver is installed.
• If the computer does not install the driver automatically, after connecting the USB OTG port to the PC, you will need to “Browse” to the previously downloaded Stick OS folder.
5. Once the Stick OS driver has been installed:
• Open a Communication Terminal, such as Hyper Terminal, and set it up as follows:
a. Bits per second: 9600
b. Data bits: 8
c. Parity: None
d. Stop bits: 1
e. Flow control: None
Loading the Stick OS Library and Programs Through the Terminal Window
6. Three text files have been included, one (StickOS_Library.txt) is the libraries with the Stick OS subroutines, and the other two are variations on robot walking programs. To use these files, after connecting to a Terminal program, follow the instructions at the top and bottom of each text file.
• The command “new” will be typed into the Terminal window followed by “auto”.
• The library file can then be cut and pasted into the Terminal window.
• Then type “renumber10000” and “save” to save the subroutine library.
• To load a program, type “auto”.
• Cut and paste the program into the Terminal window.
• Type “save” and then “run”.
• One can type “list” or “subs” to show the current program loaded and the library subroutines. This can be seen below in figure 6, and 7 respectively.
• Make sure the battery switch is in the on position to provide power to the servo rails.
• Depending on the program loaded the Terminal window will provide feedback with respect to the touch-sense pads. See figure 8 for Terminal window feedback examples.
Note: After cutting and pasting libraries and programs in the Terminal window, be sure to delete the auto-generated line number at the command prompt before entering in commands. This shows up when pasting in libraries with no line numbers, the line numbers are auto-generated
Figure 6 – The “list” Command in the Terminal Window
Figure 7 – The “subs” Command in the Terminal Window
Figure 8 – Touch-Sense Feedback in the Terminal Window
Capabilities, Limitations, and Alterations
The FLSBOT and TWR-MECH board can also be programmed exclusively using CodeWarrior and C/C++ in a bare metal implementation, or using MQX, the Freescale real-time operating system.
Further information and documentation can be found on the Freescale website at www.freescale.com/mechbot and the Tower community at www.towergeeks.org.
The OSBDM USB drivers can be found at www.pemicro.com/osbdm.
Any questions regarding this eeWiki article can be directed to the author:
The complete, Getting Started with Freescale’s FSLBOT Using CodeWarrior v7.2 and Stick OS, and Stick OS program and library files can be downloaded from the Digi-Key, eewiki.net website under the Microcontroller section.