University Programs Knowledge Base

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

University Programs Knowledge Base

Labels

Discussions

Sort by:
Pulse-width modulation (PWM), is a technique utilized in robotics for controlling motors and servos. Through the use of internal counters, the microcontroller modulates the duty cycle of a square wave to control the amount of power delivered to a device. The Duty Cycle referes to the porportion of time the square wave is 'on' as compared to the repeating signal period. The higher the duty cycle the higher the power carried in the signal. Duty cycle is expressed as a percentage of time the signal is 'on', with 100% being consistently on. Configuring the Timer The generation of a PWM signal using is based on hardware comparisons between register values and free running hardware counters. The timer module offers similar hardware comparison in the form of output compare circuitry. The contents of a register are continually compared to the master free-running timer. When a match occurs, a hardware output event can be configured to take place and an interrupt can then call a service routine. Timer I/O The Timer I/O port control registers are located in the Port Integration Module (PIM). Each port can be configured on a pin-by-pin basis and each timer input capture/output compare channel is associated with a single pin. On reset, timer modules are disabled and the appropriate I/O port defaults to a high impedance input. The initial state of a pin can be defined by configuring the appropriate general purpose I/O pin as an output in the Data Direction Register (DDRT) and writing the Port Data Register (PTx) to the appropriate state. An external pull device is required to control the level during reset.Setting the Timer Enable (TEN) bit in the Timer System Control Register (TSCR1) enables the timer module. The output compare functionality is disabled in the default module reset state. In this mode, the Data Direction bits (DDRTx) control the I/O state of the pins while the Input Compare logic monitors transitions on the pins. Setting the appropriate bit in the Timer Input Capture/Output Compare Select (TIOS) register enables a timer channel for output compare, as needed for PWM generation. In output compare mode, the Output Mode (OMn) and Output Level (OLn) bits in the Timer Control Registers (TCTL1/2) simultaneously select the compare event action and enable the connection of the output compare output logic to the relevant pin. If the OMn:OLn control bits for a channel are both zero the DDRTx and PTx bits control the state of the I/O pin. Setting either (or both) of the OMn:OLn bits connects the output compare circuitry to the pin, over-riding the DDRTx and PTx settings. Following a reset, the output state for each output compare circuit is zero. For PWM generation, the OM bit is set (= 1) so that the output compare output follows the state of the associated OL bit on each compare event. The state of the OL bit is inverted every time the timer channel interrupt is serviced to produce a toggling output. Clearing or setting the TEN bit disables or enables the timer module respectively, but does not modify the contents of any other timer control registers or the state of the output compare output logic A number of considerations have to be made when configuring the timer module for PWM. From a high-level point of view, the main considerations are: • PWM Frequency • PWM Duty Cycle In order to generate the required PWM frequency, the bus clock frequency must be known, and the timer prescaler must be set. These values will depend on the range of PWM frequencies that will be generated and the degree of resolution of the PWM signal. Maximum resolution and PWM frequency are limited by the maximum timer clock frequency. Lower PWM frequencies are limited by the minimum timer clock frequency. This can sometimes result in a trade-off and can be evaluated as shown in Figure 1. Once the timer channel is configured, the PWM signal can be generated using the timer channel interrupt. This should be configured to call an interrupt service routine (ISR) to load the timer compare register with the appropriate compare value (mark or space). This is achieved by identifying whether the last action was a negative or a positive edge transition, switching the transition status and loading the compare register with the next appropriate value. References to the master timer count register can be avoided by simply adding consecutive mark and space values to the timer compare register on successive ISR function calls as shown in Figure 3. Timer roll-over is seamless when using unsigned integer addition. Using the previous compare value as a reference for generating the next compare value allows precise output timing even though the ISR latency may vary. Starting the PWM is a task that requires careful consideration. In order to start the PWM generation using the interrupt, it is necessary to configure the first compare event manually. It is necessary to configure a forced compare by setting a compare to switch the output pin to the first transition state. After the initial compare event, interrupts will handle the PWM generation. The HCS12 does not support hardware forced compare, but a forced compare can be configured by setting a normal compare a few cycles ahead of the current free-running timer value. The cycles are necessary to compensate for internal latency within the MCU. The number of cycles will vary depending on the core and module clocks. When stopping the PWM generation, it is important to consider runt pulses (pulses with width shorter than the prescribed mark or space ratio as appropriate). To avoid these pulses, disable the PWM generation by setting the appropriate local interrupt mask within the associated interrupt service routine. The appropriate state of the pin at stop time can be set by disabling the interrupt in either part of the ISR; either the rising or falling edge portion. Additional Tutorial Resource: Introduction to DC Motor Control - Part II Lecture 2: Pulse Width Modulation
View full article
Which Platform to use?  Qorivva or Kinetis? Both are 32-bit devices. The Qorivva products, a Power architecture, are used widely in the automotive industry.  It has specialized peripherals such as CAN and LIN.  Automotive products are built tough, to high industry standards. The Kinetis products, ARM M4 architecture, are widely used.  You will find it in lots of everyday devices and industrial automation (such as robotics). It can support a lot of consumer peripherals such as USB, WiFi, and Graphical Displays. Which platform is more powerful or easy to use? Both supported processors are powerful 32 bit microcontrollers with similar software peripherals. Take an hour or two to research the evaluation boards on the Freescale sites and their underlying technologies. Think through the design and implementation process of connecting various components like the motor, battery and servo, to the evaluation board. The Tower System provides a modular prototyping platform, and the TRK evaluation board has many features. What level of support does a technology have? For the Cup Challenge, you may use any Freescale microcontroller. There are reference designs here on the wiki and TONS of code and examples on the Freescale site. Students should speak with their professor, and check out their respective documentation and software examples to make a choice. Having on campus support is invaluable in this case. There are online communities for the respective technologies as well. Research which technologies are have more active user communities which best complement the teams design approach? Obviously the Freescale Cup Wiki itself is a resource, and provides details on how to use two different microcontrollers - so it might be best to limit choices to one of these two supported platforms.
View full article
1. Download CodeWarrior 10 Evaluation Version (Eclipse, Windows-hosted) To Program your microcontroller you will need to set up the CodeWarrior Integrated Development Environment. CodeWarrior is available on the Freescale.com Website. Method 1: Direct Link direct download link (Caution - link may not be up to date) Method 2: Navigate to the Download Link From Freescale.com click on: "Design Resources" tab at the top of the page, then navigate to "Software and Tools", and then to "Codewarrior Devleopment Tools" Click on the "Download CodeWarrior now link" Click on the Download Evaluation Versions link" Within this page, use your browser "find" feature (Typically CTRL-F) to search for the text string "Kinetis." Click the "download" button next to "Evaluation: CodeWarrior for Microcontrollers(Eclipse, Windows-hosted) version". and save it to your computer. 2. Install CodeWarrior To install CodeWarrior Development Studio for Microcontrollers v10, double-click the installation package and a wizard will guide you through the installation process. Installation Notes: Are you using Windows Vista or Windows 7? 1. The CodeWarrior installer should be run using the ‘Run as administrator’ option. CodeWarrior service packs are installed with the Eclipse Updater. The updater should also be run with this option. To start the Eclipse Updater select ‘Window > Install new software’ in the menu. 2. Eclipse needs read/write access to the installation folder. Make sure the eclipse installation folder has the appropriate permissions for all users. 3. Make sure your project workspace has read and write permissions Evaluation Edition User: If you are installing the Evaluation Edition, the Evaluation license is automatically installed with your product and you do not need to register it. This license allows you to develop projects as Professional Edition within the 30-day evaluation period. After 30 days, the license works as Special Edition license (free permanent, but feature limited) which supports unlimited assembly code, up to 32KB of C code for HCS08/RS08 derivatives, up to 64KB of C code for V1 ColdFire derivatives and up to 128KB of C code for V2-V4 ColdFire and Kinetis derivatives and up to 512KB of C code for MPC56xx derivatives. Once you have finished downloading and installing CodeWarrior, users can return to Downloading and Installing P&E as part of the Blink a LED on Kinetis Tutorial Additional Resources: CW10 User Manual —The Above user manual has a list of other helpful docs which can be found within your CodeWarrior installation directory. (i.e. <CWInstallDir>\MCU\Help\PDF\)
View full article
2013 Global Freescale Cup Participant: USA Car Specs: -Custom motor driving circuitry -FRDM-KL25Z -Dual line scan camera Related Videos             
View full article
2013 Global Freescale Cup Participant: Brazil Car Specs: -Freescale "Bolero" MPC5604B 32-bit MCU
View full article
After completing the LED, Motor Control and servo tutorials, students should be comfortable with many of the subjects necessary to enable and input data from the Line Scan Camera. The line scan camera module consists of a CMOS linear sensor array of 128 pixels and an adjustable lens. This camera has a 1x128 resolution. The camera is mounted on a boom above the car to ensure the greatest field of view. Determining the angle of orientation about the pivot at the top of the boom will change the “look ahead” distance of the camera and enable more efficient steering algorithms Solution Overview One method of implementation is to take the entire readout of the camera and store it in the memory. Then a line detection algorithm can be used to locate the position of the black line. Due to varying lighting conditions, some level of pixel thresholding may be necessary as the intensity differences across the data may not always produce a clear indication of the line location. A good approach is to use an algorithm that looks for changes in the magnitude of voltage from one portion of the array to another, since the camera’s AO magnitude is directly related to the brightness the pixel array senses. If the microcontroller finds a significant decrease in magnitude followed by large increase in magnitude this would give us a good indication of the location of the line. For this a derivative function can be utilized. Once we have successfully determined the position of the black line, immediately adjust the wheels to adjust the direction of the car so that the black line will remain in the center of the camera’s view. Sample camera output (for illustrative purposes only) The camera outputs an analog signal from 0 to 5V depending on the grey-scale value of the image. to simplify our sample we will assume that we have set limits for the line and have transformed the data to digital bits using a threshold value. 0’s are high intensity (non-line locations), 1’s are low intensity (black or line locations) 10000000000000000000000000000000001111101000000000000000000010000000000000000 Since the camera provides a 128x1 bit picture, and the camera will be pointing down at the track which is a fixed width. A control algorithm should be developed to line up the 1’s in the center of the 128 bits. The center of the field of view will be require calibration and testing, but it is assumed that the camera will remain in a fixed location pointing down the center of the forward looking axis of rotation. Usage For normal operation of the camera, the following signals must be produced and processed: CK (clock) - latches SI and clocks pixels out (low to high) continuous signal SI (serial input to sensor) begins a scan / exposure discrete pulses, pulse must go low before rising edge of next clock pulse AO (analog output) - Analog pixel input from the sensor (0-Vdd) or or tri-stated The CK and SI signals are simple ON/OFF signals which can be produce using a GPIO Pin, setting the pin high and low corresponding to the desired exposure time of the camera. The only other requirement is to read the Analog Output of the camera which requires the initialization of the Analog Module and setting it to the proper pinout.  Actual camera output, below:                                                                                                                        Yellow = SI, Green = Camera Signal, Purple = clock More camera waveforms and information (Power Point) available here This link shows a video of the camera connected to the oscilloscope http://www.youtube.com/watch?v=YOAd3ERnXiQ To obtain this signal, connect channel 1, 2 and 3 of an oscilloscope to the SI pulse (Trigger off this signal), CLK, and AO signals. GPIO Details are provided in the LED tutorial. The timing for creation and read of the signals is crucial and is detailed in the diagram below. This information can also be found in the Line Scan Datasheet. Analog Read: The Analog Output (AO) signal from the camera needs to be processed and read by the microcontroller's Analog to Digital Converter (ADC). This ADC device converts a continuous signal into a discrete number which is proportional to the signal voltage. An 8 bit ADC has 256 discrete levels (2^8). If a analog signal between 0 and 5 volts is sampled, a digital discrete number of 0 would correspond to zero volts, and a digital discrete number of 255 would correspond to 5 volts. A number such as 145w would correspond to about 2.8 volts. The maximum signal sample rate is limited by the microcontroller. Proper configuration of the ADC peripheral and the multiplexer of the chip will configure a pin to read in an analog signal when calling the function. More details on analog to digital converters can be found on the wikipedia site here. Read/Write In write mode, the GPIO pin can be set, cleared, or toggled via software initiated register settings. Microcontroller Reference Manual: Analog to Digital Converter You will find high level information about GPIO usage in several different areas of a reference manual. See the reference-manual article for more general information. Relevant Chapters: (see GPIO chapters for clock and SI Creation)  Introduction: System Modules: System Integration Modules (SIM) - provides system control and chip configuration registers Chip Configuration: Signal Multiplexing: Port control and interrupts Hardware The device discussed within this tutorial is the Line Scan Camera featuring TAOS 1401  Focusing the camera: Once the sensor is perfectly working the next step is to find the best position of the lens that will generate the clearest images. The best way to do it is using an oscilloscope: Connect the SI and AO signals to the oscilloscope Set the SI pulse so that it can be clearly seen and then trig the AO signal with the SI signal using the trig function Fix the camera looking at a sheet of paper with a black line in the center The image of the black line will appear on the oscilloscope screen Screw the camera until you find the position where the line seems the clearest Camera Circuit   5 wires must be connected  ground power SI CLK AO Camera Limitations According to the datasheet:  "The sensor consists of 128 photodiodes arranged in a linear array. Light energy impinging on a photodiode generates photocurrent, which is integrated by the active integration circuitry associated with that pixel. During the integration period, a sampling capacitor connects to the output of the integrator through an analog switch. The amount of charge accumulated at each pixel is directly proportional to the light intensity and the integration time." Integration Time: T T = (1/fmax)*(n-18)pixels + 20us, where n is the number of pixels Minimum integration time: 33.75us Maximum integration time: capacitors will saturate if exceeding 100ms frequency range 5 Khz - 8 Mhz (8 Mhz is fmax in equation above) The integration time is the following: It occurs between the 19th CLK cycle and the next SI pulse. The CLK frequency itself has little to do with the integration time. One each rising edge, the clock outputs one of the previously sampled intensity values. This means that integration time should be set by varying the time between SI pulses, not changing the clock frequency. Make the CLK frequency high, and have as much time as needed between the two SI pulses to obtain the desired intensity value. Helpful Hints Light can be transmitted through the pcb on the back of the camera. This unwanted extra light shining on the CMOS linear sensor can induce significant errors into your signals received. A shroud or housing for the camera unit can easily eliminate this problem. One of the easiest solutions is to place a piece of electrical tape across the back of the camera in the highlighted area indicated in the picture below. When testing the car on the track or transporting it, it is not uncommon for the focus on the camera to loosen or change. Therefore it is recommended that after adjusting your camera focus for maximum performance you make mark (ex. metallic sharpie) between the lens and its body so you can realign the camera lens to it's proper position easily if it does shift.   *When hooking up the linescan camera, regardless of position or focus there is a drop off at each end of the image data. This is easily viewed with an oscilloscope. This effect is undesirable, particularly when you are finding your line position utilizing a derivative approach. These fallouts cause erroneous derivative values, and hence a poor line position solution. Two solutions we found useful were: (1) Ignoring the first 10-15 pixels and last 10-15 pixels of the image data array, and then determining the line position; (2) Often when making decisions in the code as to where the line was at it was found useful to use a threshold value for the difference in the derivative position, and secondly a binary threshold on the camera data. Note that the falloff depends on camera focus, position, etc. Therefore, these threshold values and pixels in which to ignore are relative to a specific instance. The problem however is common to the camera.  * Saving previous line position values Since the camera can read the line very quickly while the servo can only update every 20ms, there are multiple camera reads before the servo can update, if you are reading the camera fast and then overriding without saving them in some form then those camera reads are being wasted and are better off not having occurred. What can help is to create some sort of filter by bringing new values into an array with previous values and preforming some sort of averaging. The following code will take the new line position value and place it in a 1xA array where A is defined by CAMERA_AVG. NO AVERAGING IS OCCURRING HERE all that is happening is the camera values are being saved in a simple array, what is done with them is up to you. The way this works is that it shifts the entire array so the oldest data point is discarded in order to make room for the new line position at the other end of the array. It will only adds the new value if there is one available if not it copies the previous first position value to the new first position value. CAMERA_AVG => an integer value for how long the averaging length will occur gfpLineAverage => global floating point array of camera center line values fpLinePos => returned from read camera this is the center line position ReadCamera() => is the read camera function call returns a floating point value of fpLinePos // this will shift the values up and throw away the oldest value // then add a new reading for (i=CAMERA_AVG;i>0;i—) { gfpLineAverage[i]=gfpLineAverage[i-1]; } // if no line was detected the previous camera value will be passed on if (fpLinePos=ReadCamera()) { gfpLineAverage[0]= fpLinePos; } For example an array of of center line position values ranging from 0-127 could look like. Initial values [51 50 52 54 58 55] New position of 45 read [45 51 50 52 54 58] New position of 44 read [44 45 51 50 52 58] No value read [44 44 45 51 50 52] No value read [44 44 44 45 51 50] New position of 50 read [50 44 44 44 45 51] Tutorials Line Scan Camera: Kinetis ARM Cortex M4 Tutorial Specifics of how to configure the K40 ADC, to create the delay code is covered in the K40: Line Scan Camera Tutorial. Line Scan Camera: Qorivva Tutorial Specifics of how to configure and program the trk-mpc5604b board to blink an LED is covered in the qorivva:line-scan-camera Tutorial. Additional Resources Freescale app note on interfacing with a linescan camera Freescale app note on interfacing with an RCA camera
View full article
This tutorial covers the details of Blinking an LED on the TRK-MPC5604B: MPC5604B StarterTRAK evaluation board. It will introduce the evaluation board, and some basic CodeWarrior features. Overview Hardware Set up the Software Development Environment A. Download and Install Codewarrior B. Download and Install Drivers Sample Code Serial Debugging: I made the hardware modifications for serial debugging: I did not make the hardware modifications for serial debugging: Download/Debug/Run Learning Step: LED Code Description Functions Blink the LED(s): Other Qorivva Tutorials Useful Links to Technical Data Overview In this exercise students will run sample code and build an application which enables testing of the Qorivva TRK-MPC5604B board. Students will: Configure the Software Development Environment Configure the evaluation board hardware Learn how to open CodeWarrior project example files Build a project Download and run the code on TRK-MPC5604B board Learn how to utilize the GPIO Peripheral to blink a LED   To successfully complete this exercise, students will need the following board and development environment. TRK-MPC5604B evaluation board CWX-MPC-5500P-EX: Evaluation: CodeWarrior for MPC55xx/MPC56xx Microcontrollers V2.8 (Classic) RAppID initialization Tool P&E Micro Driver Software Hardware Read the MCU 101: LEDs article for general information on LED circuits. The LED's are located on the board and visible in the board schematic on page 4 as below: This schematic is found here. Set up the Software Development Environment There are several steps necessary to prepare the evaluation board and PC for microcontroller programming and development. Interfacing the evaluation board with a PC requires downloading and installing the CodeWarrior IDE, as well as the device drivers for programming the microcontroller via USB. A. Download and Install Codewarrior Before completing this example project, download and install CodeWarrior for MPC56xx 2.8 or the latest version. B. Download and Install Drivers In addition to CodeWarrior, it may (needs verified) be necessary to install one or both of the following tools: RAppID initialization tool- RAppID comes on the DVD provided with your evaluation board. In the main directory of the DVD, click on the "TRK_MPC5604B.html" file to open the DVD interface which provides user manuals, software, schematics and documentation for the evaluation board. P&E Microcomputer Systems, Inc drivers- P&E is a a computer driver for the TRK-MPC5604B device, enabling evaluation board programming via USB through the CodeWarrior debug OSJTAG interface. This driver can be downloaded here Because this isn't found on the disk. Sample Code To use the Hyperterminal communications features described in the following sections and in the attached sample code you must populate the U5 on your TRK-MPC5604B board. Qorivva Sample Code Download Serial Debugging: To use hyperterminal style debugging through the Serial port you must populate U5 with a RS232 transceiver and C55. I made the hardware modifications for serial debugging: From the Start menu Run the hyper terminal by using All programs> Accessories> Communications> HyperTerminal and make COMx properties port s ettings as Baud rate 115200, Data bits 8, Parity None, Stop bits 1 and Flow control None. 8. In the project menu select make (or F7) you will get few warning messages. I did not make the hardware modifications for serial debugging: In the project menu select MAKE (or F7) you will get few warning messages and can ignore them. Next select Debug option (or F5) from project menu. The debug window opens with few sub windows such as Code, Status and CPU etc. To run the program, select the Source GO menu button. Note: Much of the code in the sample file is utilized to send and receive messages serially. Some quick, minor changes can be applied as follows: Open main.c within the for loop, remove or comment out all the code. Now, manually call the specific function desired, in this case: for (; ; )      {           LED();      } Download/Debug/Run In sample.mcp project manager window target selection window is set to the default RAM. This means the code runs in the RAM. This target option can be changed using the drop down menu to internal_FLASH. This means the code runs in the flash and this code can run without debugger when the board is powered up. You can select either RAM target or internal_FLASH target for the following test procedure. If you select internal_FLASH target you can test the standalone operation of the board. If you encounter errors, look in the Problems view and resolve them. You can ignore any warnings. If the project builds correctly, it is time to download to the board and watch it work. Ensure that the USB cable that came with the board connects the board to the host computer’s USB port. There are multiple ways to issue the Debug command. Right click the project in the projects view and choose Debug As->CodeWarrior Download. Alternatively, y go to the Run menu and choose Debug (F11). Learning Step: LED Code Description Within the sample code, there is a for loop which calls a switch statement. With working hyper-terminal and proper serial connector interface into a PC, entering the numerical characters "1" - "9" into the hyper-terminal will call each separate function initiating the following actions Blinks Leds & outputs text strings to hyperterminal Calls the Switch function - which sends text strings to hyperterminal indicating which switch has been pressed Calls the Servo function which sweeps the servo back and forth; sends text strings to hyperterminal Calls the motor function which enables and disables the left motor; sends status text strings to hyperterminal Calls the motor function which enables and disables the right motor; sends status text strings to hyperterminal Calls the Camera function which sends the correct signals to the camera and reads the data; sends status text strings to hyperterminal Calls the Left_Motor_Current function; sends status text strings to hyperterminal Calls the Right_Motor_Current function; sends status text strings to hyperterminal   (hyperterminal code documentation needs verified ) TransmitData("\n\r**The Freescale Cup**");         TransmitData("\n\r*********************");         TransmitData("\n\r1.Led\n\r");         TransmitData("2.Switch\n\r");         TransmitData("3.Servo\n\r");         TransmitData("4.Motor Left\n\r");         TransmitData("5.Motor Right\n\r");         TransmitData("6.Camera\n\r");         TransmitData("7.Left Motor Current\n\r");         TransmitData("8.Right Motor Current");         TransmitData("\n\r**********************"); option = ReadData(); option = 1;     switch(option)         {             case '1':                 LED();             break;             case '2':                 SWITCH();             break;             case '3':                 SERVO();             break;             case '4':                 MOTOR_LEFT();             break;             case '5':                 MOTOR_RIGHT();             break;             case '6':                 CAMERA();             break;             case '7':                 LEFT_MOTOR_CURRENT();             break;             case '8':                 RIGHT_MOTOR_CURRENT();             break;             default:             break;          } As visible from the schematic - the LED's are accessed via the following ports. Hardware Chip Port/Pin Comment LED1 PE4 LED2 PE5 LED3 PE6 LED4 PE7 Functions The following function is utilized in the code to blink the LED's This function is located in main.c void LED(void) {    SIU.PCR[68].R = 0x0200;  /* Program the drive enable pin of LED1 (PE4) as output*/    SIU.PCR[69].R = 0x0200;  /* Program the drive enable pin of LED2 (PE5) as output*/    SIU.PCR[70].R = 0x0200;  /* Program the drive enable pin of LED3 (PE6) as output*/    SIU.PCR[71].R = 0x0200;  /* Program the drive enable pin of LED4 (PE7) as output*/    TransmitData("****Led Test****\n\r");    TransmitData("All Led ON\n\r");    Delayled();    SIU.PGPDO[2].R |= 0x0f000000;  /* Disable LEDs*/    SIU.PGPDO[2].R &= 0x07000000;  /* Enable LED1*/    TransmitData("Led 1 ON\n\r");    Delayled();    SIU.PGPDO[2].R |= 0x08000000;  /* Disable LED1*/    SIU.PGPDO[2].R &= 0x0b000000;  /* Enable LED2*/    TransmitData("Led 2 ON\n\r");    Delayled();    SIU.PGPDO[2].R |= 0x04000000;  /* Disable LED2*/    SIU.PGPDO[2].R &= 0x0d000000;  /* Enable LED3*/    TransmitData("Led 3 ON\n\r");    Delayled();    SIU.PGPDO[2].R |= 0x02000000;  /* Disable LED3*/    SIU.PGPDO[2].R &= 0x0e000000;  /* Enable LED4*/    TransmitData("Led 4 ON\n\r");    Delayled();    SIU.PGPDO[2].R |= 0x01000000;  /* Disable LED4*/ } Code Details: SIU - System Integration Unit PCR - Port Configuration Register PGPDO - Parallel GPIO Pad Data Output Registers : definition From viewing the user manual, under Functional port pin descriptions, it is Blink the LED(s): Within the main find the infinite for loop. for ( ; ; )      {      } loop of Main.c, remove all code, and add the LED's with the following function: for(;;) { LED(); } To alter the behavior of the LEDs, change the function itself, or pull specific code from the function and insert it within loops of a program for testing purposes. LED's are often used for testing important parts of an algorithm. By connecting an oscilloscope to a LED, it is possible to test the duration of a key algorithm, or to verify if signal timing is as expected along with the visual cue. Other Qorivva Tutorials Qorivva: Drive DC Motor Tutorial Qorivva: Turning A Servo Qorivva: Line Scan Camera Tutorial Useful Links to Technical Data TRK-MPC5064B Freescale Webpage TRK-MPC5064B Freescale Reference Manual TRK-MPC5064B Freescale Schematic
View full article
Este proyecto está siendo desarrollado por alumnos del Tecnológico de Monterrey Campus Guadalajara, el cual está orientado para servir como un tipo de terapia para personas discapacitadas. El proyecto en sí consiste en el control de un vehículo de juguete por medio de pulsaciones que serán realizadas con pelotas anti-estrés, de esta forma la persona podrá realizar un ejercicio de fortalecimiento en sus extremidades superiores de una forma más entretenida y menos tediosa que las clásicas terapias. Es importante mencionar que para poder realizar este proyecto es necesario el uso de dos tarjetas Freedom KL25Z de Freescale®, dos módulos Bluetooth®, dos servomotores de rotación continua y dos sensores de presión, los cuales serán incorporados dentro de las pelotas anti-estrés. El vehículo de juguete estará compuesto por los servomotores, que servirán como llantas; un módulo Bluetooth®, el cual recibirá las señales del otro módulo; y una de las tarjetas Freedom KL25Z. Por otro lado una de las tarjetas Freedom KL25Z estará conectada con los sensores integrados en las pelotas anti-estrés y a un módulo cuya función es mandar la información capturada por los sensores al vehículo de juguete. La mecánica del proyecto depende de la pelota que sea presionada, pues si se presiona solamente una pelota, el vehículo avanzará, por otro lado si se presiona la otra pelota, el vehículo girará sobre su propio eje. Este proyecto tiene como fin la implementación de conocimiento prácticos y teóricos en busca de una aportación en beneficio de la sociedad. También es relevante comentar que las visiones a futuro de este proyecto es que pueda ser implementado como una especie de control para una silla de ruedas, con el fin de facilitar la movilidad y aumentar la comodidad al momento de usar este tipo de vehículo. Original Attachment has been moved to: Codigo-tarjetas-freedom.zip
View full article
You can view the history of the "motor control shield" here.  The latest Freescale Cup Motor Control board (part number TFC-SHIELD), which is included by default in the kit, is pinned out to directly connect to the FRDM-KL25Z development board.  If you are using the TRK-MPC560xB or other board you will have to direct-wire the connections, as illustrated below.
View full article
Couple of new videos. This time I am running the FRDM-TFC library demo code written by Eli Hughes without any change at all-- successfully on my car. I have had the 0 ohm R24 res replaced with a higher one thanks to the soldering skills of David DiCarlo! The first video highlights demo modes 0 through 3: Car demos - YouTube Demo 0- test buttons and switches Demo 1- test servo Demo 2- test motors Second, I was able to get my little o-scope (xprotolab) to capture the camera analog out-- here: Camera testing - YouTube No major coding done but I understand the library and ports on the boards much better now.   Still haven't resolved the 'whining' apparent when I enable the H-bridge but I will try a few things this week-- it is possible it is harmless. Next steps, buffering camera data then on to control loops! Daniel Oh, I was also able to get the serial port working while code was running so I could get some dynamic feedback. This document was generated from the following discussion: Videos testing out Freescale Cup kit
View full article
On this page you will find additional notes to chassis assembly you may find useful. Examples of components used are obtained from the http://www.soselectronic.com/ distributor. Cables To connect battery you will need cable shown at the image top right. You can use the cable provided with the car and add an appropriate connector to its end. This usually requires special crimping tool, so it may be more appropriate to buy the "Tamyia charging cable" (shown on the bottom left side of the image above), cut the banana ends and attach the connector to the board. If you search for the appropriate type of the connector, it is called usually Tamiya charging connector, Tamiya jack 6,3 mm (SOS code 70479) or similar. Another cable you have to assemble is a power supply cable for the microprocessor board. You will need approx. 10-15 cm long cable with the barrel jack (SOS code 3834) or similar on one end and 2-pin 2.54mm connector (e.g. SOS code 4934 + 4937) on the other end. 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! Battery You may find (as we did) the provided cable strips too weak to hold the battery on the place. Replace them with the classic electricians cable strips (e.g. SOS code 67504). Also do not forget that the batteries need to be charged fully the first time you charge them or they will not be able to fully charge in the future. If you jump the gun because you want to test your code as soon as you can you will hurt yourself later as we found our battery was absolutely shot in later stages of our build. Motor wires To attach the motor to the interface board you may find (as we did) the cables too short. Then remove 6 screws on the bottom (see image on the left), open the motor box and desolder the short wires. Replace with approx. 15 cm long silicon cables at least 1mm2. End of the cables should be connected to the 3-pin connectors with the 3,9mm pitch (e.g. SOS order code 5914 ) - see image on the right. Again, the contacts should be attached using a special crimp tool. Camera To attach the camera we found useful to prepare two metal L-shaped pieces made from aluminium. With the help of black plastic distance posts (already available in the kit) and these metal stands, you may freely change the position of the camera over the surface. You may use following files to cut the required shapes (drawing was made using the QCad program): Preview (.pdf) CAD file (.dxf)   Base board There was no motherboard in the kit, so you will need to provide your own. To make life easier, we offer you our CAD files created with QCad program. You may use it to produce your board. We use plexiglass for ours, but any other plastic material is appropriate. The large hole in the middle is for cables from the servo. We attach the board to the car using the plastic standoffs (you will need them 55 mm long, so in our case, we used the combination of 40 + 15 mm) - see an example (SOS code 10260). To attach both the processor and interface boards the simillar 5mm plastic standoffs were used. Preview (.pdf) CAD file (.dxf) Getting all together Please, notice the orientation of cables, especially the power supplies. You may find useful following connection diagram. Enlarged Schematic (.png) 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! Servo Motor connectors The parts provided are extremely flimsy and if you snap them in and the wheels are not perfectly straight the wheels will align wrong when the servo first turns on. First off just concentrate on one wheel at a time and we found it useful to have one person hold the wheel straight while the arm was in the proper position and then we used needle nose pliers to quickly and precisely snap the pieces into the wheel. Don't be afraid to use some muscle we hesitated a few times at first because it didn't look good but it was fine.
View full article
2013 Global Freescale Cup Participant: Japan Car Specs: -Freescale "Bolero" MPC5604B 32-bit MCU
View full article
Kinetis Header Part 2 of 2
View full article
The TWR-K40X256 Kit is a Freescale evaluation board powered by the Kinetis K40 microcontroller. The Kinetis microcontroller family is a set of 32 bit ARM Cortex M4 chips which feature flexible storage, lower power usage, high performance and optional Floating Point Unit with many useful peripherals. For more information on the Kinetis family see Freescale's Kinetis website. The Tower System is a prototyping platform with interchangeable and reusable modules along with open source design files. Freescale K40 MCU Tower Module: TWR K40X256 Hardware Setup There are several main hardware configuration steps. After installing the battery, once the USB cable has been connected between the evaluation board and PC, it may be necessary to update the chip firmware which requires moving a jumper pin on the evaluation board. TWR K40X246 Hardware Setup Instructions Board Specific Tutorials K40 Blink LED K40 Drive DC Motor K40 Drive Servo Motor K40 Line Scan Camera Board Tips The TWR-K40X256 features a socket that can accept a variety of different Tower Plug-in modules featuring sensors, RF transceivers, and more. The General Purpose TWRPI socket provides access to I2C, SPI, IRQs, GPIOs, timers, analog conversion signals, TWRPI ID signals, reset, and voltage supplies. The pinout for the TWRPI Socket is defined in Table 3 of the TWR-K40X256 User's Manual, but the user manual does not describe how to order a connector. A Samtec connector, part number: SFC-110-T2-L-D-A is the proper female mating connector for the TWR-K40X256 TWRPI socket. SIDE A/SIDE B White DOTS for counting Pins Solder Wire to GND, and to MCU VDD Pin for testing purposes Important Documents TWR-K40X256 User's Manual TWR-K40X256 Schematics External Links TWR-K40X256-KIT Webpage Kinetis Discussion Forum Tower Geeks Community Website Tower Geeks Freescale Cup Group
View full article
The components of this kit will provide students with the basic materials. The challenge for teams is to collaborate with peers to design the interconnecting hardware and to create the algorithms that will give a vehicle the competitive edge. The sensor interfacing, vehicle navigation, signal processing and control systems techniques students will learn can be applied to most embedded systems. Included in the Freescale Cup Kit Part Number: TFC-KIT Model Car chassis Line Scan Camera Interface and Motor Controller Board   Part Number: TFC-5604B-KIT  All pieces inside TFC-KIT Freescale Microcontroller Board (Qorivva MPC5604B) Getting Started: 1. Purchase the kit 2. Explore the tutorials and reference materials Take the Freescale Cup Training Tutorials Browse through the sample code within the tutorials Download the reference manuals for your microcontroller, many which are linked to from this wkik Navigate to the training modules and videos of the Designing and programming your Cup Car: Hardware 1.Tools needed: In addition to what is provided in the kit, you will need several other tools you will need to design and build a working intelligent car. Must have Soldering iron Solder Solder wick Wire (gauges) Oscilloscope Useful Power Supply Solder remover bulb Oscilloscope DMM Optional Access to a Rapid Prototyping Machine Software such as Eagle or PCBArtist 2.Electronics Components you will want to obtain soon Software What we’ve provided The software provided in this wikiwill get you started in your task of creating an intelligent car. We have included files which you can load onto your microcontroller which blink a led, activate the motor and servo, as well as a small simple driver for the camera which sends it the proper signals and reads data into your microcontroller. What you need to design Your job will be to connect the various components together, refine and add to the code we have provided and create a working intelligent car. Start thinking about how you will determine where the line is on the track, what algorithm you will use for steering and deciding how much power you want to send to your motor. You may want to read up on PID controllers, or other types of control systems. Are there any special features that you might want to add to your car – such as real time debugging? Those features will require extra work and up front planning. Planning and Teamwork You might not have the time to document all your designs and concepts properly before sitting down to code or to create a piece of hardware, but you might want to create an ordered list of all the different tasks which will be necessary to finish the car, who will do those items, and when you want each task to be finished. A schedule will help you determine if you are on track with your goals …
View full article
2013 Global Freescale Cup Participant from Mexico Car Specs: -Freescale "Bolero" TRK-MPC5604B
View full article
2013 Global Freescale Cup Participant: India Car Specs: -Freescale "Bolero" MPC5604B 32-bit MCU
View full article
The pages are being reorganized to better support multiple languages. All pages that were currently in English are being renamed with a prefix "en:" Pages that had prefixes "k40:", "overview", or "qorivva:" will be made into the page name. For example- k40:pagename will be renamed to en:k40-pagename Sorry for any saved bookmark broken links this may cause.
View full article
A microcontroller includes a microprocessor (CPU) as well as a number of other components like RAM, flash and EEPROM to store your programs and constants. While a microprocessor requires external devices to control things like input/output, or timers to implement periodic tasks, and digital to analog converters, a microcontroller is all inclusive. Contrast this all-in-one approach with a typical personal computer which contains an INTEL or AMD CPU, as well as separate chips for RAM, a separate video card, a dedicated hard drive, silicon chips or PCI circuit boards to enable the processor to access USB, serial and video card signals Microcontroller pins are general purpose, whereas CPU pins are specific. This means that each pin is tied to a multiplexer which you must set to choose the particular use for the pin. For example, in a microcontroller, one pin pin might be re-purposed for the following tasks 1. The output of a timer 2. Send a signal to a motor 3. Receive an input from a sensor or analog device Basic Concepts Covered Thus far: Blink an LED - overview of GPIO and setting up the microcontroller Drive a Motor - using the Timer and PWM modules of the microcontroller Turn a Servo - More details on using timer modules and PWM to control a servo Obtain Data from the Line Scan Camera - ADC Setup and GPIO Bit Blasting to create clock and pulse signals controlling the line scan camera I2C tutorial - Using I 2 C to communicate with various sensors using the K40 Button - An overview of how to implement a simple button Additional Concepts we would like to add to the Wiki: Timer Modules PWM watchdog-timer memory
View full article
'''Topics we want to cover''' Advanced Components Accelerometer Gyro Ultra-sonic Temperature Humidity Pressure GPS Power Efficiency Modes Serial I/O SD Card Terminal Debugger Bluetooth Wifi RF - Zigbee Capacitive Touch Memory Data Logging Graphics Segmented Display TFT DSP CMSIS A/D conversion Advanced Motor Control Three Phase Motor Control Motor Synchronization
View full article