TM
Freescale™ and the Freescale logo are trademarks of Freescale Semiconductor, Inc. All other product or service names are
the property of their respective owners. © Freescale Semiconductor, Inc. 2008.
Freescale Race Challenge 2010
Slot Car Equipment
November 27, 2009 – rev 1.1
Milan BrejlFreescale Semiconductor, Rožnov p.R., Czech Republic
TM
2
FRC2010 – Slot Car Equipment
►Equip the standard slot car by electronics and control algorithm to make it a self-driving slot car
►Take benefits of:• FRC2010 Participant Package
• Code Warrior Special Suit – free software development tools
• Quick Start on-line resources: trainings, software template, etc.
• Your creativity, skillfulness and enthusiasm!
TM
3
FRC2010 – Slot Car Features
►Reference design slot car features• 3-axis acceleration measurement
� using accelerometer MMA7361
• 4-quadrant DC motor control
� using monolithic H-bridge MC33931
• USB connection – miniUSB connector� slot car connected to the PC behaves as a mass storage device
� copy .S19 file in to program your application into Flash
� no debugger provided (although BDM port available on extension header)
• microSD card slot� runtime storage of data (microSD card not provided)
� easy transfer to PC for analysis and algorithm development
• 4 LEDs control using PWM� original Carrera Audi R8 head and bread LEDs
• changeover detection
TM
4
►Every registered FRC2010 participant obtains:• Slot car Carrera Audi R8
• Unpopulated PCB
• Devices� Microcontroller MCF51JM64
� Accelerometer MMA7361
� H-Bridge MC33931
� miniUSB connector
� microSD card slot
� 8.000MHz Crystal
� 1A Bridge Rectifier DB106S
� 3.3V Linear Voltage Regulator LP2951
FRC2010 Participant Package
TM
5
►PCB design files (Eagle 5.1.0): http://hw.cz/files/FRC2010SlotCarHW.zip
►Populate the provided PCB• resistors, capacitors and diodes are not provided
• use line filter from the original car PCB
Slot Car Electronic Equipment - PCB
line filter
TM
6
►Bill Of Materials
Slot Car Electronic Equipment - PCB
Self-Driven Slot Car v2.1 BOM
--------------------------------------------------------------------------------
Part Value Package Source
--------------------------------------------------------------------------------
IC4 MCF51JM64VLH LQFP64 Freescale http://www.freescale.com/files/32bit/doc/data_sheet/MCF51JM128.pdf
IC3 MMA7361LR1 LGA14 Freescale http://www.freescale.com/files/sensors/doc/data_sheet/MMA7361L.pdf
IC2 MC33931VW HSOP44 Freescale http://www.freescale.com/files/analog/doc/data_sheet/MC33931.pdf
IC1 LP2951CDM-3.3R2G MICRO8 ON Semi http://www.onsemi.com/pub/Collateral/LP2950-D.PDF
IC5 MICRO_SD microSD http://www.gme.cz/cz/index.php?product=823-036
CON8 MINI-USB-SCHIELD 32005-301 http://www.gme.cz/cz/index.php?product=832-177
B1 DB106S DBS http://www.gme.cz/cz/index.php?product=924-009
Q1 8MHz HC49UP http://www.gme.cz/cz/index.php?product=970-023
L1 SF0905 DB-1S line filter from the original Carrera Audi R8 PCB
--------------------------------------------------------------------------------
JP1 JUMPER JP2
D1,D2 MBRS130LT3G SMB
D3,D4 1N4148 MICROMELF-W
R1,R2 62k R0603
R3,R4 12k R0603
R5,R9,R12,R17 10k R0603
R6 270R R0603
R7 1M R0603
R8 0R R0603
R10,R11 220R R0603
R13,R14 33R R0603
R15,R16 27R R0603
R18 330k R0603
C1 100uF SMC_C
C2,C3 1uF SMC_A
C4,C5 (100nF)? C0603
C6 100nF C0603
C7 1uF SMC_A
C8 33nF C0603
C9,C10 5pF C0603
C11,C12,C13 100nF C0603
C14 4.7uF SMC_A
C15 0.47uF C0805
C16 100nF C1206
C17 100nF C0603
C18,C19,C20 3n3 C0603
provided
not provided
TM
7
1. Remove the traction magnets – they are not allowed
Slot Car Electronic Equipment - Installation
TM
9
3. Unplug all connectors
4. Remove the original PCB
Slot Car Electronic Equipment - Installation
Line Filter – to be used on the new PCB
TM
11
6. Install the populated PCB in, use the original screw
Slot Car Electronic Equipment - Installation
TM
12
9. Connect original LEDs, motor, power and external capacitor
Slot Car Electronic Equipment - Installation
TM
13
8. Connect external capacitor (prevents from MCU reset on changeovers)
Slot Car Electronic Equipment - Installation
TM
14
9. Make holes in the body for miniUSB connector and microSD card
Slot Car Electronic Equipment - Installation
TM
16
►Datasheets• Microcontroller MCF51JM64
http://www.freescale.com/files/32bit/doc/ref_manual/MCF51JM128RM.pdf
• Accelerometer MMA7361http://www.freescale.com/files/sensors/doc/data_sheet/MMA7361L.pdf
• H-Bridge MC33931http://www.freescale.com/files/analog/doc/data_sheet/MC33931.pdf
• miniUSB connectorhttp://www.gme.cz/_dokumentace/dokumenty/832/832-177/dsh.832-177.1.pdf
• microSD card slothttp://www.soselectronic.com/a_info/resource/f/2900_serie.pdf
• 8.000MHz Crystalhttp://www.gme.cz/_dokumentace/dokumenty/970/970-023/dsh.970-023.1.pdf
• 1A Bridge Rectifier DB106Shttp://www.gme.cz/_dokumentace/dokumenty/924/924-009/dsh.924-009.1.pdf
• 3.3V Linear Voltage Regulator LP2950http://www.onsemi.com/pub_link/Collateral/LP2950-D.PDF
Slot Car Electronic Equipment - Datasheets
TM
17
►Development Tools• Compiler
� Freescale Code Warrior for Microcontrollers Special Suite (free)– http://www.freescale.com/webapp/sps/site/prod_summary.jsp?code=CW-MICROCONTROLLERS
– editor
– compiler & linker
– simulator
• Debugger� no hardware debugger provided, use
USB Bootloader to program your application into the MCU
►Trainings• Introduction to CodeWarrior
� http://www.freescale.com/webapp/sps/site/training_information.jsp?code=WBT_24571
• Learn Programming with C� http://www.freescale.com/webapp/sps/site/training_information.jsp?code=TP_C_PROGRAMMING
Control Algorithm Development
TM
18
► Enables to program MCU flash memory via USB• preflashed to every MCF51JM64
provided with the participant package
1. Connect car to PC via USB� Mass Storage Device and new disk
letter appears
� contains READY.TXT (0 bytes) file
2. Copy your application .S19 file in� The bootloader programs it to flash
3. Disconnect, put car on track
Control Algorithm Development – USB Bootloader
TM
19
► After reset, based on the power source, either
the Bootloader or the User Application is started:• USB power – Bootloader runs
• Track power – User Application runs
► Coexistance of Bootloader and User Application1. Use the provided Linker Command File (.lcf)
to keep the memory limits for the user application:
2. Redirect Interrupt Vectors into RAM, because Interrupt Vector Table in Flash is occupied by the Bootloader – use the provided routine:
3. Include interrupt handlers into a table in ramvector.c,include its prototype in ramvector.h
Slot Car Application – Working in Bootloader Framework
MEMORY {
bootcode (RX) : ORIGIN = 0x00000410, LENGTH = 0x000033F0
code (RX) : ORIGIN = 0x00003A00, LENGTH = 0x0000C600
vectorram (RWX) : ORIGIN = 0x00800000, LENGTH = 0x00000200
userram (RWX) : ORIGIN = 0x00800200, LENGTH = 0x00003E00
}
UserApplication
(51kB)
Bootloader(13kB)
FlashBootloader Interrupt Table
Applicationusage(15.5kB)
RAMApplication Interrupt Table
0x0000
0x39FF0x3A00
0xFFFF
0x0410
RedirectInterruptVectorsToRAM();
TM
20
►Slot car embedded application quick start template• Available for download at http://hw.cz/files/FRC2010-SlotCarApp.zip
• Created under USB Bootloader framework
• Includes� MCU and slot car hardware initialization
� Simple application: car runs, all analog values and measured and logged on SD card– X and Y accelerations are filtered by two different filter types (suitable or not?).
– Head lights indicate the detection of a right or a left curve, based on simple thresholding of X-acceleration.
– Break lights indicate detection of a curve beginning, based on a simple thresholding of Y-acceleration.
� 4 interrupts:– 0.5 ms TPM interrupt to update PWM duty cycle and start conversion of all analog inputs
– ADC interrupt to handle sequence of conversions
– 10 ms periodic RTC interrupt for data logging
– KBI interrupt can be used to check power outage on crossover track piece
� Macros– SET_LED_xy_ON/OFF – control LEDs
– GET_SWITCH_STATE – read switch position
– MOTOR_ENABLE/DISABLE, SET_MOTOR_VOLTAGE(x) – control the motor
– START_CONV(channel), READ_ADC_SAMPLE – use the ADC
– and more
� SD card driver supporting SD/SDHC, FAT/FAT32, using f_open, f_printf, f_close, etc.– port of ChaN’s FAT File System Module to ColdFire v1
Slot Car Application – Quick Start Template
TM
21
►Quick Start Application logs all
analog inputs into a CSV file,
which can be opened in Excel
►Files names are automatically
incremented numbers
►File dates are fixed
Slot Car Application – Analyzing logged data in Excel
f_printf(&file,"%d;%d;%d;%d;%d;%d\n",
timeCounter, accXFilt, accYFilt, accZ,
trackVoltage, motorCurrent);
TM
22
►Use Matlab CSV Import Wizard
Slot Car Application – Analyzing logged data in Matlab
1.
2.
3.
>> plot(timeCounter, [accXFilt accYFilt accZ]);
TM
23
►Modify connection piece so that the hand controller is not used• The track is continuously powered by the a power supply voltage
Training Track