Official library for the FRDM-TFC shield
Dependents: TFC-TEST TFC-RACING-DEMO TFC-RACING-DEMO TFC-RACING-FSLMENTORMATTERS ... more
You are viewing an older revision! See the latest version
Homepage
Overview¶
This library is an example driver for the FRDM-TFC shield that can be used for with MBED compiler. Documentation for the hardware can be found here
https://community.freescale.com/docs/DOC-93914
Note that the current videos on that page pertain to the codewarrior example projects hosted on google code, not the library presented here. While the code is very similiar, there are some differences. New videos will be posted for the MBED libraries as the code bases will eventually merge
Implementation Notes¶
The goal of the this library was to provide an easy to use API for the FRDM-TFC hardware that would give one a good start in getting a car working. There are only a couple of function calls needed to make the components on the care work. The library is implemented as a standard C API. While most of the MBED code is provided as a C++, the decision to use a C only API was done for the following reasons:
- Some of the advantages of a C++ class really don't apply in this case. Since there would only be a single instance of the class library, there is no reason to wrap the functions in a class.
- The library tightly integrated to synchronized different components in the interrupts routines. I.E. Camera acquisition is synced to the servo period. To accomplished this we had to write the code in raw C and write our own interrupt routines. Tieing these to a c++ class really didn't make sense.
- Since many users also use an "offline" compiler, (I.E. Codewarrior) it was a design requirement that the the same code/API could be easy moved to the Codewarrior environment.
- Even though the MBED libraries provide classes for PWM that could be used for the servos and drive motor controller, we had to write our own code for the internal TPM units as we needed some special features (Different switching frequency on certain channels) that could not be accomplished with the libraries. This is transparent to the end user.
The library uses a number of of resources on the Freedom board. The list below show what the library uses. The user should not use the MBED libraries to talk to those ports/peripherals.
I/O:
---------------------
PTB0 (Servo Channel 0 - TPM1) <br> PTB1 (Servo Channel 1 - TPM1) <br>
PTB8 (Battery LED0) PTB9 (Battery LED1) PTB10 (Battery LED2) PTB11 (Battery LED3)
PTD7 (Camera SI) PTE0 (Camera CLK) PTD5 (Camera A0 - ADC_SE6b) PTD6 (Camera A1 - ADC_SE7b)
PTE2 DIP Switch 0 PTE3 DIP Switch 1 PTE4 DIP Switch 2 PTE5 DIP Switch 3
PTC13 Pushbutton SW1 PTC17 Pushbutton SW2
PTC3 H-Bridge A - 1 FTM0_CH3 PTC4 H-Bridge A - 2 FTM0_CH4 PTC1 H-Bridge B - 1 FTM0_CH1 PTC2 H-Bridge B - 2 FTM0_CH2
PTE21 H-Bridge Enable PTE20 H-Bridge Fault
PTE23 H-Bridge A - IFB PTE22 H-Bridge B - IFB