Freescale Cup Shield for the Freedom KL25Z

Showing results for 
Search instead for 
Did you mean: 

Freescale Cup Shield for the Freedom KL25Z

No ratings

Freescale Cup Shield for the Freedom KL25Z


The FRDM-TFC is a convenient "shield" that can drive up to two DC motors (5A per channel), two servos and I/O for the Freescale cup line scan camera and Hall effect sensors.  This board mates with the KL25Z Freedom board for primary usage with a Freescale Cup car.

FRDM-TFC.pngPicture 004.jpg


  • 2 channel Motor Driver ICs (MC33887APVW)
  • 2 channel servo Outputs
  • Dual Linescan Camera interfaces
  • Two inputs for speed sensors
  • Two potentiometers for user functions
  • Two push buttons for user functions
  • 4 Position DIP Switch for user function
  • 4 LEDs (green) for battery indicator or user functions

Design Files

Rev A is attached to this document.

Rev B is attached to this document

Code Examples

Codewarrior "Bare Metal" Example Code:

All Codewarrior based code examples for the FRDM-TFC are hosted on in a Subversion repository on Google Code:

frdm-tfc -   Example code for the FRDM-TFC Shield - Google Project Hosting

You can check out the code with your favorite SVN client.   Static releases are available in the attachments section of this page.  The current release is "R1.0" Example Code:





Labels (1)


Are you going to use the freedom board for the Freescale Cup competitions?

Varies by region.  But yes, starting in 2014 we will be offering a freedom based version.  What you see above is the work we are doing today to get it ready. 

**The rules will likely stay the same that you can use any Freescale 32-bit MCU.


Where I can buy the freescale cup shield for the freedom board?

Best Regards,

It will be in the new TFC-KIT.  Currently we don't sell individually, but working to set that up for the future.

Still reading the specs but I assume the KL25Z is getting power from the power up of the TFC shield?  Saw the ground warnings about not powering up both (TFC with battery while KL25Z from USB) so likely we have to program first (no batt)-- then unplug USB to test with battery (or other 7.2V, 0.1A source).   There is no direct way to test the car 'online' so to speak.


Where did you see this warning?  I have had the battery and USB hooked up at the same time.

Comment in the assembly manual PUB doc near the end: "Never power the microcontroller from different power sources! Switch off the MCU board before you connect your it to your PC."   Also here: where it mentions:

NOTE: Never power the microprocessor board and interface boards from different power supplies! In such case the grounds on both boards are

not connected and you can damage the board. The grey flat ribbon cable that interconnects the boards is for signals only, there is no common

GND connection!"

This could be specific to the Qorriva implementation-- just wanted to be sure before frying anything.

It was an issue with that setup.  More broadly though, it is still a valid preventative caution.  Don't assume! Read the schematics and understand what the underlying circuitry is doing. 


This is not an issue KL25Z based TFC board.    The return for the battery and the return for the USB are tied together so the reference potential is held to the same value.    

That being said.... Here is the only issue you may have.     NEVER measure the voltage across the motors during  operation with a scope ground connected to either side.    This could cause a path issue.  With an H-Bridge,  The outputs are references to 1/2 VCC.        This could cause an issue unless you scope is floating or running on  battery.   You can look at each side of the motor (H-BRIDGE) with respect the GND on the PCB and be OK or take a different measurement.



Thanks—Was not looking to measure the actual motor voltage but the PWM inputs to the Hbridge very soon to confirm the issue that David found (where openSDA appears to cause contention)—as I saw some funny stuff when operating the demo code.



What happened with RCA camera demo with the FRDM and the shield?

Best Regards,


I have a problem trying to run the labview application for the line scan camera. I got the following error:


Can someone help me?

Best Regards,

Dear Andres,

Do you have installed the NI VISA drivers from National Instrument Website?

Here is the link:
NI-VISA 5.4 - National Instruments

Hi Juan,

Thanks for your help. I have to install the drivers before or after install Labview?


Dear Andres,

1.- First install the LabVIEW.

2- Then install the NI Device drivers: NI Device Drivers 2013.02 - National Instruments

3.- Finally install the NI VISA drivers: NI-VISA 5.4 - National Instruments



The link for mbed example code doesn't work.

Best Regards,



This example code works also for the FRDM-KL46Z?

Best Regards,


Is it still not possible to buy FRDM-TFC board alone(not the TFC kit)?

Best Regards,

Send me a private email with how many you need.

Me too!! Can I also send you a private email?

Best Regards,



Anyone can send me private message on the community.  Click Create->Message at the top of this page! 


How can I find out how to use the inputs of the H-Bridge control? I get from the schematic that there are 8 inputs (A-IN1, A-IN2, A-IFB, ENABLE, FAULT, B-IN1, B-IN2, B-IFB) and the schematic shows their corresponding pins, but I don't know what signals to give them. The example code doesn't seem to be using all of them, and I'm planning to write code using Processor Expert components. Can I find the specs somewhere?


1.)   Have you looked at the Datasheet for the part?   It has a good picture of the internals!    Even processor expert won't tell you how the chip works.  It is important to study datasheet *before* you write any code

2.)  Study the source code for the example code to see how it works.    Basically, you need to drive complementary signals into each bridge.

Hello Eli,

Thank you for replying.

  1. I think I have the wrong datasheet( because it shows me less pins (IN1, IN2, D1, D2) than the ones from the schematic, and I'm not sure how they correspond to those from the TFC shield and therefore, to those from the KL25Z board. Can you tell me if it's the right one and if it is, how to deal with the pin problem?
  2. I've studied the code and your videos on how to control the motors, and the demo videos. I've tested your code and it works. I have some troubles in writing code like yours, but with PE components. Maybe with the answer from question 1), I'll understand what I'm missing.

The schematic (available to download above) says the part number is a MC33887.   Not sure where you found that part number.

Sorry, I didn't compare the part number from the schematic with the part number from the datasheet I found. I got that datasheet by clicking the Example Code link on this page (Freescale Cup with FRDM-KL25Z | mbed), clicked under Datasheet (The Freescale Cup Knowledge Center), then on Freescale Cup DC Motor Specifications and then on H-Bridge Specifications

I realize now that it was a mistake.

Anyway, it still shows me less pins (IN1, IN2, D1, D2, EN) and I don't know how they corespond to the ones from the schematic (A-IN1, A-IN2, A-IFB, ENABLE, FAULT, B-IN1, B-IN2, B-IFB) or the ones in your code. Your insight would be most helpful.

Did you get schematics?   If you did, you will see the page that has the 2 H-Bridges and the signal mapping.   There are 2 sets of signals for each H-Bridge

Thank you Eli!

I managed to get the code working. Turns out I only need to set ENABLE to High and send complementary PWM signals to A-IN1, A-IN2 to controll the speed and direction of motor A, and send complementary PWM signals to B-IN1, B-IN2 to controll the speed and direction of motor B. I would have been stuck without your help.

Hi John

I sent a private message and a e-mail also (in your Freescale address) but I didn't receive any response. Did you receive them?


Is there any example code for the speed sensor?

Hi, see for the implementation of the speed sensor. To my knowledge there is no sample code readily available from Freescale but I would post the question in the open forum or your respective region to see if a team member from another group can share one with you.

Hey John

Could you send/sell me:

1 x FRDM-TFC shield rev1.0 (or newest version)

1 x TFC-CAMERA-ASY line scan camera

In the website the delivery time is in August and I can't wait this time. Flavio Stiffan told me he doesn't have these hardware with him....

I would just place the order.  John mentioned that the online system often reports very long delivery times even though eveything is in stock.

What country are you in?



I have 1 question....

I can't know how I apply 'build package' to code warrior.

plz someone answer my question.

Best Regards

Hi, have you looked at the videos under thread Freescale Cup Shield for the Freedom KL25Z?


I'm using Processor expert to generate some configuration code.

The problem I have is that I can't get to work the PTD6 or PTD5 pins used by the linescan sensor.

But with the same configuartion I can use other pins to do the ADC.

I don't think this is a hardware problem because sample code works fine.

And my code works too but only on other ADC pins.

Best regards

emh203 would you have a chance to look at this, maybe you have an idea. Thanks

I am quite backed up with work right now.    Some source code would be helpful.

My guess is that the environment is getting trashed by Processor Expert.    My best advice is to inspect the device registers with the debugger and see what isn't configured right.   Also,  since you have working drivers,  just skip PE and get to writing your application.  

We have been provided 7.2V 2000mAh Ni-Cd battery with the freescale kit and 12V charger.So, what can be the maximum voltage of the Ni-Cd battery when fully charged? once when i charged, it reaches upto 8.5V, so I fear of damaging the battery.

So, Should I charge it with given charger and Charge battery upto 9V??

Take a look at the specs for the battery.    7.2 is nominal voltage BUT you do not want it overcharging.   (i.e. Fire!)

You mention a 12v charger.   Can you take a picture?


my team is starting at the innovation cup and we want to use this TFC-Shield combined with the FRDM K64F board. Is there any example like this, how to use the TFC-Shield in a K64F project?

Best regards

Hi David,

Yes, it has been tested. I recommend you get in touch with massimoviolante and RichardBalogh, they have worked on that.

RichardBalogh_ng has 2 addresses, you can also try on this one


TFC-Shield and K64F is a logical combination, but unfortunately not an easy one. As the boards don't have the compatible pinouts, you'll need to rewire the connections

and can't use the boards immediately. Here you can find the comparison table (also Arduino Uno included, as the producer declared the boards compatible with Arduino shields):

As you can see, the appropriate signals don't match.

I have wired it up and it isn't too bad.   Some notes:

1.)    The selection of I/O on the FRDM board was based upon TPM (Timer Pulse Width Modulators) availability to optimize the usage of the hardware.  It was not mapped to Arduino as the psuedo standard pinout was not optimal for using the the FRDM board.   Arduino compatibility really only means power and some I/O line up and that it meets a mechanical footprint.       

2.)  TPM0 (labeled as FTM0 in the spreadsheet) is the Timebase for the PWM to the DC motors.    You need complimentary drive so you need 2 channels of TPM on the same time base (@5-10Khz switching)

3.)  TPM1 channels 0 and 1 are for the servo time base.   It is *much* slower period than the motor drive so it needs it's own time base.

4.)  The speed sensors are on there own time base (TPM2).

5.) The K64 CPU has FTM units, not TPM like the KL25Z.    FTM peripherals are more complex are you will need to port functionality!  This means you will need to read the reference manual and write some code.

So,  before you start,   make sure you absolutely understand what signals are needed to drive the motors (@10KHz complimentary PWM) and servo (0.5mS to 2mSec pulse @ 20mS period).    You need map these signals onto the flex timer units on the K64.   Some of the signals line up and others do not.  I only needed a couple of air wires to make the connections.   The bigger job is updating the code to the FTM and not TPM.

It is a good academic exercise but you must first fundamentally understand the IO on the FRDM-TFC.   Once you understand the IO and peripherals you should be able to wire it up to *any* microcontroller.

Version history
Revision #:
1 of 1
Last update:
‎01-06-2013 05:28 PM
Updated by: